[gst-devel] assertion `GST_IS_CAPS (caps)' failed
thaytan at noraisin.net
Tue May 16 02:19:10 CEST 2006
On Mon, 2006-05-15 at 22:18 +0200, bertrand haut wrote:
> I'm trying to port a working plugin for gstreamer 0.8 to gstreamer
> 0.10. The caps of this plugin are
> GST_STATIC_CAPS ("video/x-raw-yuv, "
> "width=(int)720, "
> "height=(int)576, "
> At this moment the chain function is simply :
> static GstFlowReturn
> gst_undiscret_chain (GstPad *pad, GstBuffer *buf)
> Gstundiscret *filter;
> filter = GST_UNDISCRET (GST_OBJECT_PARENT (pad));
> GstBuffer * out_buf;
> out_buf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(buf));
> GST_BUFFER_TIMESTAMP (out_buf) = GST_BUFFER_TIMESTAMP (buf);
> GST_BUFFER_DURATION (out_buf) = GST_BUFFER_DURATION (buf);
> gst_buffer_set_caps (out_buf, GST_PAD_CAPS (filter->srcpad));
^ This line is the problem. GST_PAD_CAPS (pad) is NULL until the caps
are set, either by calling gst_pad_set_caps, or by pushing a buffer that
has caps on it. You're setting the caps on the buffer to NULL, and then
pushing it. You can use gst_static_caps_get or
gst_static_pad_template_get_caps to get the caps that you've defined as
your static caps for the pad template.
Even more simply, you can copy the caps from the incoming buffer.
Or, more simply again you can replace the whole lot with
out_buf = gst_buffer_make_writable (buf);
This will a) Take ownership of the buffer reference b) Copy the buffer
and all caps/flags/timestamps etc onto a new buffer only if necessary c)
Return the result as out_buf, which is a writable version of the input
buffer, avoiding any memory copying if the original was already
Jan Schmidt thaytan at noraisin.net
It all works, but it limits Linux processes to a mere 512GB of virtual
address space. Such limits are irksome to the kernel developers when the
hardware can do more, and, besides, somebody is likely to release a web
browser or office suite which runs into that limit in the near future.
More information about the gstreamer-devel