v4l2bufferpool: Also fix strides for other semi-planar video formats
authorSebastian Dröge <slomo@circular-chaos.org>
Mon, 9 Sep 2013 12:44:58 +0000 (14:44 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Mon, 9 Sep 2013 12:45:55 +0000 (14:45 +0200)
sys/v4l2/gstv4l2bufferpool.c

index 348cabf80615f5efffeba9af7fc9724066ee8d0f..e14716579099f9d3e44b3e35b35c2b5f5742c5e9 100644 (file)
@@ -247,14 +247,21 @@ gst_v4l2_buffer_pool_alloc_buffer (GstBufferPool * bpool, GstBuffer ** buffer,
         offs = 0;
         for (i = 0; i < n_planes; i++) {
           offset[i] = offs;
-          if (info->finfo->format == GST_VIDEO_FORMAT_NV12
-              || info->finfo->format == GST_VIDEO_FORMAT_NV21) {
-            stride[i] =
-                (i == 0) ? GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, i,
-                obj->bytesperline) : stride[0];
-          } else {
-            stride[i] =
-                GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, i, obj->bytesperline);
+
+          switch (info->finfo->format) {
+            case GST_VIDEO_FORMAT_NV12:
+            case GST_VIDEO_FORMAT_NV21:
+            case GST_VIDEO_FORMAT_NV16:
+            case GST_VIDEO_FORMAT_NV24:
+              stride[i] =
+                  2 * GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, i,
+                  obj->bytesperline);
+              break;
+            default:
+              stride[i] =
+                  GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, i,
+                  obj->bytesperline);
+              break;
           }
 
           offs +=