[gst-devel] Caps problem when writing encoder/decoder
Hunterwood
markus.jagerskogh at imentum.se
Thu May 20 12:54:36 CEST 2010
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
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Caps-problem-when-writing-encoder-decoder-tp2219436p2224288.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100520/98d65bc9/attachment.htm>
More information about the gstreamer-devel
mailing list