summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-09-09 14:44:58 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-09-09 14:45:55 +0200
commit1e7c3e45204e102a87348830a362ae682a4037b4 (patch)
tree2666090d78c6a4e41b8aed74c4db4799f2e3dd0a /sys
parent78adf28a61f6dd14bc5bf921cd57acc38e383241 (diff)
v4l2bufferpool: Also fix strides for other semi-planar video formats
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l2/gstv4l2bufferpool.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index 348cabf80..e14716579 100644
--- a/sys/v4l2/gstv4l2bufferpool.c
+++ b/sys/v4l2/gstv4l2bufferpool.c
@@ -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 +=