Assign buffer num_planes value and align width 51/279051/2 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.062750 accepted/tizen/7.0/unified/hotfix/20221116.105502 accepted/tizen/unified/20220803.011422 submit/tizen/20220802.062705 tizen_7.0_m2_release
authorKwanghoon Son <k.son@samsung.com>
Mon, 1 Aug 2022 07:15:25 +0000 (03:15 -0400)
committerKwanghoon Son <k.son@samsung.com>
Tue, 2 Aug 2022 00:25:14 +0000 (20:25 -0400)
[Version] 0.0.6
[Issue Type] Bug fix

Set num_planes value (it was always 0)

Change-Id: I0e9e05ee499b612931b8c3fde0582424476506a2
Signed-off-by: Kwanghoon Son <k.son@samsung.com>
packaging/vision-source-v4l2.spec
src/vision_source_v4l2.c

index 9b5fd3c4ca70c5a59ca082b31f4a9e66a67bcc9c..d65b3f4209ec4b0edf739eb8a995de477b36c314 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:        vision-source-v4l2
 Summary:     vision source-v4l2
-Version:     0.0.5
+Version:     0.0.6
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0
index b5bb70e5ecb2579d5e46a1e3a6ea8375a994070a..d86ab9b0feac0b33815f31162bfc399db93176e6 100644 (file)
@@ -545,6 +545,12 @@ static int __vision_source_set_stream(vision_source_v4l2_s *handle,
                                 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);
        }
@@ -658,7 +664,6 @@ __vision_source_start_stream(vision_source_v4l2_s *handle,
        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);
@@ -686,7 +691,7 @@ __vision_source_start_stream(vision_source_v4l2_s *handle,
                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);
@@ -699,9 +704,14 @@ __vision_source_start_stream(vision_source_v4l2_s *handle,
                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);