[maemo-developers] raw image buffer and gstv4l2camsrc
From: Nicolai Hess nicolaihess at web.deDate: Wed Mar 9 15:37:11 EET 2011
- Previous message: Cross-compiling Ruby 1.9.2
- Next message: raw image buffer and gstv4l2camsrc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I hope someone can help me or points me to someone else how knows something about the gstv4l2camsrc. I have got a question regarding raw-image buffers in gstv4l2camsrc.c (in gstreamer0.10-plugins-camera- 0.79 for Fremantle). I am interested in this method: gst_v4l2camsrc_send_raw_frame (GstV4l2CamSrc *v4l2camsrc, GstBuffer *buf). I know the method can copy the raw-image buffer end send this over the GstBus. This would be a good way to make raw-images with the N900 camera. But sadly not the full image data is copied. Here are my observations: The cameradriver somewhere decides(I couldn't find out where or how) the biggest image resolution would be 2576x1960 pixels with 2 bytes per pixel, so the image data would be 10097920 bytes. In the method: gst_v4l2camsrc_send_raw_frame (GstV4l2CamSrc *v4l2camsrc, GstBuffer *buf) are two GstBuffer, the argument of this method "buf" which holds the image data from the camera driver and the new copy of this buffer "raw_buffer". buf buffer is copied with: raw_buffer = gst_buffer_copy (buf); The amount of bytes copied are based on the size of the source buffer (10097920 bytes). Now the raw_buffer size attribute is changed based on the raw_caps from the camera driver: /* calculate raw_size from raw_caps */ raw_s = gst_caps_get_structure (raw_caps, 0); gst_structure_get_int (raw_s, "width", &raw_width); gst_structure_get_int (raw_s, "height", &raw_height); raw_size = raw_width * raw_height * 2; But the raw_buffer size isn't 10097920, the actual size is computed based on the bayer-raw BA10 format with a 2952x1968 resolution with 2 bytes per pixel. That means the buffer copy send over GstBus has the size 10202112, but the last 104192 are mostly garbage because the call raw_buffer = gst_buffer_copy (buf); only wrote bytes of "buf" data (10097920). Of course, I could change my application to store only a raw-image of 2576x1960. But what bothers me is, the source buffer (buf) actually has the full 2592x1968x2 data! I made a quick and dirty change to the above mentioned method to write out the full buffer, and it indeed contains valid image data. So, my questions are, is it a bug, that the source buffer thinks its size is 10097920, whereas it actually holds 10202112 bytes of image data? And where is this 2576x1960 resolution setting? When I request the supported resolutions (v4l2camsrc->formats) I don't get 2576x1960 but 2592x1968 instead. regards Nicolai -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.maemo.org/pipermail/maemo-developers/attachments/20110309/fec6c219/attachment.htm>
- Previous message: Cross-compiling Ruby 1.9.2
- Next message: raw image buffer and gstv4l2camsrc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]