[gst-devel] Init pipeline in the function

giorgio giorgio at ketron.it
Thu Apr 22 10:35:31 CEST 2010


Try in this Way:

#include <gst/gst.h>

GstElement* initPipeline()
{
    return(gst_pipeline_new("camera"));
}

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

    //
    //	Now you can use pipeline   
    //	

    return 0;
} 


Giorgio

Il giorno gio, 22/04/2010 alle 10.58 +0300, Igor Mironchick ha scritto:
> 
> 
>         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;
>         }
> 
> Thx for your reply. I've already found the solution. But a little bit
> in another way:
> 
> void initPipeline( GstElement *& pipeline )
> {
>   pipeline = ...
> }
> 
> void main()
> {
>   ...
>   GstElement * pipeline;
>   initPipeline( pipeline );
>   ...
> } 
> 
> 
> 
> 
> -- 
> Regards,
> Igor Mironchick
> ------------------------------------------------------------------------------
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel






More information about the gstreamer-devel mailing list