[FFmpeg-cvslog] avcodec/v4l2: fix single plane decoding

Jorge Ramirez-Ortiz git at videolan.org
Sat Oct 7 01:48:14 EEST 2017


ffmpeg | branch: master | Jorge Ramirez-Ortiz <jorge.ramirez-ortiz at linaro.org> | Fri Oct  6 09:51:43 2017 +0200| [2a31ad7d60632cca0f43986b6a5b135848088b14] | committer: Mark Thompson

avcodec/v4l2: fix single plane decoding

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a31ad7d60632cca0f43986b6a5b135848088b14
---

 libavcodec/v4l2_buffers.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index ef7d040032..ba70c5d14b 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -244,13 +244,23 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf)
 
 static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, AVBufferRef* bref)
 {
+    unsigned int bytesused, length;
+
     if (plane >= out->num_planes)
         return AVERROR(EINVAL);
 
+    bytesused = FFMIN(size, out->plane_info[plane].length);
+    length = out->plane_info[plane].length;
+
     memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length));
 
-    out->planes[plane].bytesused = FFMIN(size, out->plane_info[plane].length);
-    out->planes[plane].length = out->plane_info[plane].length;
+    if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) {
+        out->planes[plane].bytesused = bytesused;
+        out->planes[plane].length = length;
+    } else {
+        out->buf.bytesused = bytesused;
+        out->buf.length = length;
+    }
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list