[gst-devel] Caps problem when writing encoder/decoder

Martin Bisson martin.bisson at gmail.com
Tue May 25 08:04:01 CEST 2010


Hi,

I don't know if you're still having problem, but I just went to the exact
same thing of adding new caps type, I managed to make it work, but doing so
I got some errors that you might still be having.

As Marco said, it's true that the caps of the buffers have to be set.

But the main error I got might be the same problem you're having.
Basically, I also had NULL caps so the caps negociation was failing.  This
was caused by the use of gst_caps_proxy_getcaps as the function passed to
gst_cap_set_getcaps_function.  I was using it because it was used in the
gst-template example, but I didn't really understand what it did.  Since it
basically computes the intersection of the caps of all pads, it can only
works for plugin with pads that have pretty much the same caps.  So in a
plugin with different caps for different pads, the intersection is empty...
If that is your problem, you just have to write your own get_caps function.

Hope this helps,

Martin



On Thu, May 20, 2010 at 10:52 AM, Hunterwood
<markus.jagerskogh at imentum.se>wrote:

>  Hi again,
>
>
>
> I think you are right, Marco, about the caps of the buffer. I didn’t think
> about that!
>
> I haven’t been able to get it to work, though.
>
> At first I tried:
>
>   base_caps = gst_caps_copy (gst_pad_get_pad_template_caps
> (filter->srcpad));
>
>   gst_buffer_set_caps(outbuf, base_caps);
>
>
>
> But I got the error:
>
> ** (gst-launch-0.10:6344): CRITICAL **: file
> ..\Source\gstreamer\gst\gstpad.c: line 2508: assertion `caps == NULL ||
> gst_caps_is_fixed (caps)' failed
>
>
>
> So I tried to remove the fixed caps and use _*set*_caps-functions for the
> pads.
>
> But what do I need to do in the _*set*_caps-functions? The input to the
> encoder has a fixed format and the output from the decoder has the same
> fixed format.
>
> The compressed audio could have different rates, that could be represented
> in the caps. Do the _set_caps for the sink-pad need to set the caps of the
> source?
>
> I tried:
>
>   ...
>
>   filter = GST_GtestENC (gst_pad_get_parent (pad));
>
>   otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad;
>
>   base_caps = gst_caps_copy (GST_PAD_CAPS(otherpad));
>
>   return gst_pad_set_caps (otherpad, base_caps);
>
>
>
> But I get an empty caps from GST_PAD_CAPS(filter->sinkpad) and
> gst_caps_copy gives this error:
>
> ** (gst-launch-0.10:6724): CRITICAL **: file
> ..\Source\gstreamer\gst\gstcaps.c: line 280: assertion `GST_IS_CAPS (caps)'
> failed
>
>
>
> However. In my “real” encoder/decoder I *do* set the caps in my
> _chain-function:
>
>   ret =
>
>     gst_pad_alloc_buffer_and_set_caps (filter->srcpad,
> GST_BUFFER_OFFSET_NONE,
>
>                FRAME_LENGTH, GST_PAD_CAPS (filter->srcpad), &outbuf);
>
>
>
> But I get an error in the _*set*_caps-function for the sink in the
> decoder:
>
> static gboolean
>
> gst_mydec_sink_set_caps (GstPad * pad, GstCaps * caps)
>
> {
>
>   mydec *filter;
>
>   GstPad *otherpad;
>
>   GstCaps *base_caps;
>
>   GstFlowReturn ret;
>
>
>
>   filter = GST_MYDEC (gst_pad_get_parent (pad));
>
>   otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad;
>
>   base_caps = gst_caps_copy (gst_pad_get_pad_template_caps (otherpad));
>
>
>
>   ret = gst_pad_set_caps (otherpad, base_caps); // error
>
>
>
>   return ret;
>
> }
>
>
>
> The error I get is:
>
> ** (gst-launch-0.10:2964): CRITICAL **: file
> ..\Source\gstreamer\gst\gstpad.c: line 2508: assertion `caps == NULL ||
> gst_caps_is_fixed (caps)' failed
>
>
>
> But I checked with GST_IS_CAPS (base_caps) and
> gst_caps_is_fixed(base_caps) and base_caps IS a caps and it is not fixed,
> so why do I get an error?
>
>
>
> Clearly there is something I have done wrong or misunderstood, but I can’t
> figure it out…
>
>
>
> Regards
>
> Markus
>
>
>
>
>
> *Från:* Marco Ballesio [via GStreamer-devel] [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=2224286&i=0>]
>
> *Skickat:* den 18 maj 2010 14:54
> *Till:* Markus Jagerskogh
> *Ämne:* Re: Caps problem when writing encoder/decoder
>
>
>
>
> Are you setting the proper caps/type on the buffer itself?
>
>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html#gst-buffer-set-caps
>
> Imho you're passing a buffer incompatible with the pad caps.
>
> Regards
>
>
>
>
>
> ------------------------------
> View this message in context: SV: Caps problem when writing
> encoder/decoder<http://gstreamer-devel.966125.n4.nabble.com/Caps-problem-when-writing-encoder-decoder-tp2219436p2224286.html>
>
> Sent from the GStreamer-devel mailing list archive<http://gstreamer-devel.966125.n4.nabble.com/>at Nabble.com.
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100525/fdca6f03/attachment.htm>


More information about the gstreamer-devel mailing list