On Fri, 2009-08-07 at 07:04 +0100, Yaser Hameed (RBEI/ECA3) wrote:
> Hi
>  
> When I use cogl_texture_get_cogl_texture(CLUTTER_TEXTURE (video)) to
> get the texture from a video and extract the data from the
> cogl_texture to a gdk pixbuf, pixbuf is corrupted. Its like three
> splits of the thumbnail in grey scale.

Indeed you are right, the clutter sink now uploads the YUV frames to
separate texture units and produce the final fragments using a fragment
shader that do the YUV to RGB transformation.
This is done to offload the costly colorspacing operation from the CPU
to the GPU.

> When I checked the pixel format of the cogl texture it returned 8
> (COGL_PIXEL_FORMAT_G_8) and the rowstride was equal to the width of
> the texture. 
> But COGL documentation shows  COGL_PIXEL_FORMAT_G_8 as FIXME.

The texture unit 0 has the Y frame, ie a Grey scale image with 8 bits
per pixel.
 
> The same thing used to work with the clutter 0.8. when used with
> clutter 0.8 the pixel format was COGL_PIXEL_FORMAT_24 and the
> rowstride was three times the width of the texture.

Right, that was because the sink was not using shaders and thus the
colospacing was done by the CPU and a RGB frame was uploaded.

> Pls help

Several solutions here, not sure what is your exact use case (how often
do you want to create pixbuf? is this for generating thumbnails? do you
want to play the video while generating screenshots?) so blindly
guessing you want to generate thumbnails.

Clutter-Gst is not designed to extract thumbnails you should use
GStreamer API to do so. As this is a FAQ GStreamer developers have
written a small example that uses ffmpegcolorspace and appsink to
retrieve a buffer, create a GdkPixbuf from and write a png to the disk.
You can find this example at:
http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/tests/examples/snapshot/snapshot.c

HTH,

-- 
Damien

-- 
To unsubscribe send a mail to [email protected]

Reply via email to