On Sat, 2009-05-09 at 11:34 -0300, Juan Pablo Hernández Vogt wrote:

> I'd like to draw lines in a RGB space before show it. I let you a
> simple c++ program that shows a webcam. I've add a callback to get the
> buffer after convert it, but it's in YUY2 and not in RGB. What am I
> doing wrong?
>  ...
>   // setup capsfilter
>   g_object_set (G_OBJECT (flt), "caps",
>     gst_caps_new_simple ("video/x-raw-yuv",
>       "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
>  ...

Ok, so you've put a capsfilter right after the camera source, and set
filtercaps requesting YUY2 format on it, which means that the pipeline
will either fail (if the cam doesn't support YUY2 or the
framerate/resolution you've chosen), or capsfilter will output buffers
in YUY2 format.

Next you have ffmpegcolorspace ! xvimagesink. This makes sure that the
YUY2 buffer gets converted into a format xvimagesink can handle in case
xvimagesink does't support YUY2 in your setup.

This means in practice that you can't really make any assumptions about
what format the video data pushed to xvimagesink will be.

You have set up a pad probe on xvimagesink's sink pad, so the buffer you
receive in the callback could be any format. You can check the format
with something like:

if (GST_BUFFER_CAPS (buffer)) {
  gchar *str = gst_caps_to_string (GST_BUFFER_CAPS (caps));
  g_print ("buffer caps: %s\n", str);
  g_free (str);
}

If you absolutely need to manipulate RGB data, you could write an
element that does that and which exposes RGB caps on its pad templates,
and then have a pipeline like: v4l2src ! ffmpegcolorspace ! capsfilter !
yourelement ! ffmpegcolorsapce ! xvimagesink
 
Cheers
 -Tim


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Gstreamer-embedded mailing list
Gstreamer-embedded@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded

Reply via email to