[gst-devel] assertion `GST_IS_CAPS (caps)' failed
bertrand haut
bertrand.haut at gmail.com
Tue May 16 08:54:07 CEST 2006
On 5/16/06, Jan Schmidt <thaytan at noraisin.net> wrote:
> 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, "
> > "format=(fourcc){YUY2}"
> > )
> >
> > 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);
I've tried this proposition. My code of the chain function is for the moment
GstBuffer * out_buf;
out_buf = gst_buffer_make_writable (buf);
unsigned char * g_out = (unsigned char *) (GST_BUFFER_DATA(out_buf));
int i,j;
for(i=0 ; i < filter->height ; ++i)
for(j=0 ; j< filter->width ; ++j)
g_out[(i*filter->width+j)*2 ]=0;
return gst_pad_push (filter->srcpad, out_buf);
So gst-launch-0.10 v4l2src ! undiscret ! xvimagesink must produce a
constant image. But it does not work... I still see the tv (
/dev/video0 is a tv capture card)
--
Bertrand Haut
pgp key:B9514013C02E33FA
More information about the gstreamer-devel
mailing list