v4l2_fmt.fmt.pix_mp.plane_fmt[i].sizeimage);
}
} else {
+ for (int i = 0; i < request_buffer_count; i++) {
+ handle->vision_source_buffers[i].planes[0].align_width =
+ v4l2_fmt.fmt.pix.bytesperline;
+ handle->vision_source_buffers[i].planes[0].size =
+ v4l2_fmt.fmt.pix.sizeimage;
+ }
LOGD("stride %d, sizeimage %d", v4l2_fmt.fmt.pix.bytesperline,
v4l2_fmt.fmt.pix.sizeimage);
}
vision_source_buffer_s *buffer = NULL;
struct v4l2_buffer v4l2_buf;
struct v4l2_plane v4l2_planes[V4L2_PLANES_MAX];
- guint32 plane_num = 0;
int ret = __vision_source_set_stream(handle, pixel_format, resolution, fps,
request_buffer_count);
v4l2_buf.memory = V4L2_MEMORY_MMAP;
v4l2_buf.index = i;
v4l2_buf.m.planes = v4l2_planes;
- v4l2_buf.length = plane_num;
+ v4l2_buf.length = 0;
if (v4l2_ioctl(handle->device_fd, VIDIOC_QUERYBUF, &v4l2_buf) < 0) {
LOGE("[%d] query buf failed. errno %d", i, errno);
buffer->pixel_format = pixel_format;
buffer->resolution.width = resolution->width;
buffer->resolution.height = resolution->height;
- buffer->total_size = v4l2_buf.length;
- buffer->num_planes = plane_num;
- buffer->planes[0].size = v4l2_buf.length;
+
+ if (V4L2_TYPE_IS_MULTIPLANAR(handle->buffer_type)) {
+ buffer->num_planes = v4l2_buf.length;
+ } else {
+ buffer->num_planes = 1;
+ buffer->planes[0].size = buffer->total_size = v4l2_buf.length;
+ }
+
buffer->planes[0].data =
v4l2_mmap(0, v4l2_buf.length, PROT_READ | PROT_WRITE,
MAP_SHARED, handle->device_fd, v4l2_buf.m.offset);