not well linked : avidemux - decodebin - queue

Rossana Guerra guerra.rossana at gmail.com
Thu Jan 5 13:44:09 PST 2012


Hi Nicolai, actually as I said I already did it and ir didn't work. Here is
my original message
"I tryed to link avidemux - decodebin with on-pad event, and decodebin -
queue as well. It didn't work."


I post the code:

// pad-event for avidemux
static void on_pad_added (GstElement *element, GstPad *pad, gpointer  data)
{
        g_debug ("Signal: pad-added");
        GstCaps *caps;
        GstStructure *str;

        GstElement *queue = (GstElement*)data;
        caps = gst_pad_get_caps (pad);
        g_assert (caps != NULL);
        str = gst_caps_get_structure (caps, 0);
        g_assert (str != NULL);

        cout << "enlazando enlazara pads" << endl << endl;
        if (g_strrstr (gst_structure_get_name (str), "video")) {
                g_debug ("Linking video pad to dec_vd");
                // Link it actually
                GstPad *targetsink = gst_element_get_pad (queue, "sink");

                //GstCaps *capsV =
gst_caps_from_string("video/x-raw-yuv;video/x-raw-rgb");
                //GstPad *targetsink =
gst_element_get_compatible_pad(data,pad,capsV);
                cout << "enlazando cola de video" << endl << endl;
                g_assert (targetsink != NULL);
                gst_pad_link (pad, targetsink);
                gst_object_unref (targetsink);
        }

        if (g_strrstr (gst_structure_get_name (str), "audio")) {
                g_debug ("Linking audio pad to dec_ad");
                // Link it actually
                //GstPad *targetsink = gst_element_get_pad (decad, "sink");
                GstPad *targetsink = gst_element_get_pad (queue, "sink");
                cout << "enlazando cola de audio" << endl << endl;
                g_assert (targetsink != NULL);
                gst_pad_link (pad, targetsink);
                gst_object_unref (targetsink);
        }

        gst_caps_unref (caps);
        //gst_caps_unref (capsV);
}

// pad event for decodebin2
static void cb_pad_added (GstElement *element, GstPad *pad, gpointer  data)
{
  GstPad *sinkpad = NULL;
  GstElement * queue = (GstElement *) data;

  /* Ahora linkeo el pad de comp con sink pad */
  g_print ("Dynamic pad created, linking queue\n");
  sinkpad = gst_element_get_static_pad (queue, "sink");

  gst_pad_link (pad, sinkpad);

  gst_object_unref (sinkpad);

}



2012/1/5 Nicolai Hess <nicolaihess at web.de>

>
>
> 2012/1/5 Rossana Guerra <guerra.rossana at gmail.com>
>
>> Hi I am trying to play an avi file, for some reasons I don't want to do
>> it with a playbin.
>> The fact is I had an avidemux and a mad decoder but not every avi file
>> can play. Then I replaced it for the following pipeline, to get the most
>> codecs.
>>
>>                                 decodebin ----- queue ------ audioconvert
>> ---- audioresample ------ autoaudiosink
>> filescr --- avidemux ---
>>                                 decodebin ----- queue ------
>> ffmpegcolorspace ----- videoscale ----autovideosink
>>
>>
>> I tryed to link avidemux - decodebin with on-pad event, and decodebin -
>> queue as well. It didn't work.
>>
>> I tryed to link avidemux - decodebin with the following code, but it
>> didn't work either.
>>
>> // demuxer avidemux's name
>> // decvd a decodebin name for video, decad a decodebin name for audio.
>>
>> GstPad *targetsrc = gst_element_get_pad(demuxer, "video_%02");
>>
>> GstPad *targetsrc2 = gst_element_get_pad(demuxer, "audio_%02");
>>
>> GstPad *padV = gst_element_get_static_pad(decvd,"sink");
>>
>> GstPad *padA = gst_element_get_static_pad(decad,"sink");
>>
>> gst_pad_link (targetsrc,padV);
>> gst_pad_link (targetsrc2,padA);
>>
>> Any suggestion? Thanks a lot.
>>
>> Rossana
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>>
> I think this is the same error I wrote about in
> your last program. You can not get the srcpads from the
> avidemux, as they are dynamic pads.
> At this point, the demuxer can not know if there are audio and/or
> video streams at all.
> You have to create a pad-added callback for the demuxer as well.
>
> nicolai
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120105/5f503ffd/attachment.htm>


More information about the gstreamer-devel mailing list