Connecting decodebin2 to autovideosink

David Walker dwalker0044 at gmail.com
Mon Nov 7 08:27:57 PST 2011


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);

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111107/16e5020b/attachment-0001.htm>


More information about the gstreamer-devel mailing list