diff options
author | Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> | 2017-10-06 10:51:43 +0300 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2017-10-07 01:36:21 +0300 |
commit | 2a31ad7d60632cca0f43986b6a5b135848088b14 (patch) | |
tree | 1b16bd84966603056f0a95076c1f8f4939b77735 /libavcodec/v4l2_buffers.c | |
parent | 7d141e2cacb42a25df0c32a6deb5256fdbec4425 (diff) |
avcodec/v4l2: fix single plane decoding
Diffstat (limited to 'libavcodec/v4l2_buffers.c')
-rw-r--r-- | libavcodec/v4l2_buffers.c | 14 |
1 files 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; } |