Hi,<br>I hope someone can help me or points me to someone else how knows<br>something about the gstv4l2camsrc.<br><br>I have got a question regarding raw-image buffers in gstv4l2camsrc.c<br>(in gstreamer0.10-plugins-camera-<div id=":18a">
0.79 for Fremantle).<br>
<br>I am interested in this method:<br>gst_v4l2camsrc_send_raw_frame (GstV4l2CamSrc *v4l2camsrc, GstBuffer *buf).<br>I know the method can copy the raw-image buffer end send this over the GstBus.<br>This would be a good way to make raw-images with the N900 camera.<br>
<br>But sadly not the full image data is copied. Here are my observations:<br><br>The cameradriver somewhere decides(I couldn't find out where or how) the biggest<br>image resolution would be 2576x1960 pixels with 2 bytes per pixel, so the image data would<br>
be 10097920 bytes.<br>In the method: <br>gst_v4l2camsrc_send_raw_frame (GstV4l2CamSrc *v4l2camsrc, GstBuffer *buf)<br>are two GstBuffer, <br>the argument of this method "buf" which holds the image data from the camera driver<br>
and the new copy of this buffer "raw_buffer".<br><br>buf buffer is copied with:<br> raw_buffer = gst_buffer_copy (buf);<br><br>The amount of bytes copied are based on the size of the source buffer (10097920 bytes).<br>
Now the raw_buffer size attribute is changed based on the raw_caps from the camera driver:<br> /* calculate raw_size from raw_caps */ <br> raw_s = gst_caps_get_structure (raw_caps, 0);<br>
gst_structure_get_int (raw_s, "width", &raw_width);<br> gst_structure_get_int (raw_s, "height", &raw_height);<br> raw_size = raw_width * raw_height * 2;<br><br>But the raw_buffer size isn't 10097920, the actual size is computed based<br>
on the bayer-raw BA10 format with a 2952x1968 resolution with 2 bytes per pixel. <br><br>That means the buffer copy send over GstBus has the size 10202112, but the last<br>
104192 are mostly garbage because the call <br> raw_buffer = gst_buffer_copy (buf);<br>only wrote bytes of "buf" data (10097920).<br><br>Of course, I could change my application to store only a raw-image of 2576x1960.<br>
But what bothers me is, the source buffer (buf) actually has the full 2592x1968x2 data!<br>
I made a quick and dirty change to the above mentioned method to write out the<br>full buffer, and it indeed contains valid image data.<br><br>So, my questions are, is it a bug, that the source buffer thinks its size is 10097920,<br>
whereas it actually holds 10202112 bytes of image data?<br>
And where is this 2576x1960 resolution setting? When I request the supported<br>resolutions (v4l2camsrc->formats) I don't get 2576x1960 but 2592x1968 instead.<br><br>regards<br>Nicolai<br></div>