[gst-devel] Converting a gst-launch pipeline to C code

Stefan Kost ensonic at hora-obscura.de
Sat Oct 4 21:53:24 CEST 2008


Alan Carvalho de Assis schrieb:
> Hi,
> 
> 2008/9/29 Alan Carvalho de Assis <acassis at gmail.com>:
>> Hi Thijs,
>> I will test it and let you know if it works.
>>
> 
> I got it working but using an ugly/dirt/newbee/dumb hack:
> 
> static GstElement *decoder, *decvd, *decad;
> static int i;
> 
> static void
> on_pad_added (GstElement *element,
>               GstPad     *pad,
>               gpointer    data)
> {
>   GstPad *sinkpad;
>   //GstElement *decoder = (GstElement *) data;
>   if(i==0)
>           decoder = decvd;
>   else
>           decoder = decad;
>   i++;
> 
>   /* We can now link this pad with the vorbis-decoder sink pad */
>   g_print ("Dynamic pad created\n");
> 
>   sinkpad = gst_element_get_static_pad (decoder, "sink");
> 
>   gst_pad_link (pad, sinkpad);
> 
>   gst_object_unref (sinkpad);
> }
> 
> 
> I can't figure out how can on_pad_added get access to two decoders?
> currently I can just pass one:
> g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decvd);
> 
> Please, let me know the right way to on_pad_added get the decvd in the
> first call and get the decad in the second call. I am ashamed because
> this code, but anyway I am here to learn.

If you write your whole app based on GObject then you can store them in your
object and pass the object as user-data (an alternative would be using a
struct). In the callback you check the media-type of the caps of the new pad and
link to the right decoder.

Stefan

> 
> Thank you,
> 
> Alan
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> 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