caps negotiations in a GstBaseSink derivative

Atish Nazir gstreamer at littleworld.co.uk
Tue Sep 25 10:06:58 PDT 2012


I made a mistake in identifying the situation when set_caps is called and
not called.  In my original test case I'm using filesrc:

    gst-launch -m filesrc location=/usr/assets/shortie.ts ! xxxsink
videowindow=0.5,0.5,1.0,1.0

In the above situation set_caps does not fire.  Presumably because the caps
from filesrc is ANY.  If I apply a filter:

    gst-launch -m filesrc location=/usr/assets/shortie.ts ! video/mpegts !
xxxsink videowindow=0.5,0.5,1.0,1.0

Then set_caps fires.


Is it expected behaviour that feeding an element with "ANY" data bypasses
set_caps irrespective of the sink pad capabilities?



On 25 September 2012 16:59, Atish Nazir <gstreamer at littleworld.co.uk> wrote:

> 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/bdb4f71f/attachment.html>


More information about the gstreamer-devel mailing list