[gst-devel] Init pipeline in the function

Tristan Matthews tristan at sat.qc.ca
Thu Apr 22 09:52:20 CEST 2010


You're passing the pointer by value, you need to pass its address. Also, you
need to call gst_init beforehand, so your code should look like:

#include <gst/gst.h>

void initPipeline(GstElement **pipeline)
{
    *pipeline = gst_pipeline_new("camera");
}

int main(int argc, char **argv)
{
    gst_init(&argc, &argv);
    GstElement *pipeline;
    initPipeline(&pipeline);
    return 0;
}

2010/4/22 Igor Mironchick <imironchick at gmail.com>

> Hi.
>
> I'm a new with gstreamer and glib.
>
> Why can't I init pipeline in function and then use it somewhere else.
>
> Here is the code example:
>
> void initPipeline( GstElement * pipeline )
> {
>   pipeline = gst_pipeline_new( "camera" )
> }
>
> void main()
> {
>   GstElement * pipeline;
>
>   initPipeline( pipeline );
>
>   // And here pipeline == 0 !!! Why?
> }
>
> --
> Regards,
> Igor Mironchick
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>


-- 
Tristan Matthews
email: tristan at sat.qc.ca
web: http://tristanswork.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100422/62ddb803/attachment.htm>


More information about the gstreamer-devel mailing list