caps negotiations in a GstBaseSink derivative

Atish Nazir gstreamer at littleworld.co.uk
Tue Sep 25 08:59:22 PDT 2012


Hi all,
I'm having difficulty getting cap negotiations to work in my hardware
accelerated video sink.  All my code is using GStreamer 0.10.  The sink is
derived from GstBaseSink and my element can handle both video/mpegts and
video/x-h264:

GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
        GST_PAD_SINK,
        GST_PAD_ALWAYS,
        GST_STATIC_CAPS ( "video/mpegts; video/x-h264" ) );

The default mode of operation is "video/mpegts" and that works fine.  I
wanted to use set_caps to determine how to set up my hardware decoder (just
need to flick two flags to flip between elementary stream and transport
stream) however found set_caps was never called.  Here's how it's
registered:

static void gst_xxx_sink_class_init( GstXxxSinkClass * klass )
{
    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
    GstBaseSinkClass *gstbasesink_class = GST_BASE_SINK_CLASS (klass);

    gobject_class->set_property = gst_xxx_sink_set_property;
    gobject_class->get_property = gst_xxx_sink_get_property;
    // register dispose function to clean
    gobject_class->dispose = gst_xxx_sink_dispose;

    gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_xxx_sink_start);
    gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_xxx_sink_stop);
    gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_xxx_sink_render);
    gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_xxx_set_caps);

... install pad properties

    GstElementClass* gstelement_class = (GstElementClass *) klass;
    gst_element_class_add_pad_template( gstelement_class,
gst_static_pad_template_get( &sinktemplate ) );
}


If I change my pad template to the following:

GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
        GST_PAD_SINK,
        GST_PAD_ALWAYS,
        GST_STATIC_CAPS ( "ANY" ) );


Then my set_caps fires correctly.

As a work around that's fine, but I would like to gst-inspect-0.10 to
report that this is a video sink with mpegts, x-h264 capabilities rather
than reporting ANY.  I'm concerned that I'm missing something fundamental
in caps negotiation.

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120925/f06e81b3/attachment.html>


More information about the gstreamer-devel mailing list