Connecting decodebin2 to autovideosink

David Walker dwalker0044 at gmail.com
Tue Nov 8 01:42:59 PST 2011


Hi Mike,

Thank you for your response. The diagrams were very helpful.

I see from the diagrams that the output media type should be
video/x-raw-yuv. However, when my program receives the pad-added signal the
pad still has caps of video/quicktime. Is it required/possible to force the
output type of decodebin2?

I also receive an "autoplug-continue" signal which I currently don't do
anything with. Not sure if that is important at this stage.

Please find attached my code should you wish to take a look.

Many thanks,


On 7 November 2011 18:13, Mike Mitchell <mike.mitchell at panometric.net>wrote:

> Your original pipeline does not negotiate on my h264 encoded file.  It
> requires ffmpegcolorspace to work.  I've attached some before and after
> diagrams as well as the script I used to generate them. The diagrams
> provide visibility into the auto-plugging process that decodebin2 creates.
>
> *Mike Mitchell*
>
>
>
>
> On Mon, Nov 7, 2011 at 8:27 AM, David Walker <dwalker0044 at gmail.com>wrote:
>
>> Hi,
>>
>> I'm having some trouble connecting decodebin2 to autovideosink in order
>> to play mp4 video. So far, using the command line, I have managed to play
>> mp4 video by creating the following pipe:
>>
>> gst-launch filesrc location="file.mp4" ! decodebin2 ! autovideosink
>>
>> I now want to create the same pipeline but in C. Noticing that decodebin2
>> has a dynamic pad, I've attached a callback to the "pad-added" signal in
>> which I then try to link the pads of decodebin2 and autovideosink - however
>> with no success.
>>
>> I then investigated the caps and noticed that the caps of decodebin2
>> are: video/quicktime, variant=(string)iso which isn't a cap of
>> autovideosink which would explain the GST_PAD_LINK_NOFORMAT error I am
>> seeing.
>>
>>
>> How is it possible that the pipeline on the command line is able to play
>> the video but my program seems to provide incompatible type? Is there
>> something else that needs to be done?
>>
>> I'd really appreciate any help, been trying to get my head round this for
>> a couple of days now!
>>
>> Thanks.
>>
>>
>> PS my callback looks like this (I am also using Qt libraries - qDebug
>> simply writes to terminal like printf):
>>
>> static void on_pad_added(GstElement *element, GstPad *srcpad, gpointer
>> data)
>>
>> {
>>
>>     qDebug("on_pad_added");
>>
>>
>>     GstElement *videosink = (GstElement *)data;
>>
>>     GstPad *sinkpad = gst_element_get_static_pad(videosink, "sink");
>>
>>
>>     qDebug("src caps are %s", gst_caps_to_string(gst_pad_get_caps(srcpad)));
>>
>>     qDebug("sink caps are %s", gst_caps_to_string(gst_pad_get_caps(sinkpad)));
>>
>>
>>      if (!gst_pad_can_link(srcpad, sinkpad)) // can link fails
>>
>>         qDebug("Cannot link these pads");
>>
>>
>>      switch (gst_pad_link(srcpad, sinkpad)) {
>>
>>     case GST_PAD_LINK_OK:
>>
>>         qDebug("1");
>>
>>         break;
>>
>>     case GST_PAD_LINK_WRONG_HIERARCHY:
>>
>>         qDebug("2");
>>
>>         break;
>>
>>     case GST_PAD_LINK_WAS_LINKED:
>>
>>         qDebug("3");
>>
>>         break;
>>
>>     case GST_PAD_LINK_WRONG_DIRECTION:
>>
>>         qDebug("4");
>>
>>         break;
>>
>>     case GST_PAD_LINK_NOFORMAT: // reason for link error
>>
>>         qDebug("5");
>>
>>         break;
>>
>>     case GST_PAD_LINK_NOSCHED:
>>
>>         qDebug("6");
>>
>>         break;
>>
>>     case GST_PAD_LINK_REFUSED:
>>
>>         qDebug("7");
>>
>>         break;
>>
>>     default:
>>
>>         qDebug("8");
>>
>>         break;
>>
>>     }
>>
>>
>>      gst_object_unref (sinkpad);
>>
>> }
>>
>>
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>>
>
> _______________________________________________
> 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/20111108/25fcdcd9/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: player.c
Type: text/x-csrc
Size: 6980 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111108/25fcdcd9/attachment-0001.c>


More information about the gstreamer-devel mailing list