diff options
author | Dave Stevenson <dave.stevenson@raspberrypi.org> | 2018-03-22 16:01:35 +0000 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2019-09-10 18:56:40 -0700 |
commit | d61cf1b1ebc2477749d7d7825a072400ed24af9f (patch) | |
tree | 8a92b2ee6173af43017c9b4aadcf3cdb053821e5 | |
parent | 7bb6898b16f3c5b1cd5c4c15ca96278df569ccd2 (diff) | |
download | ffmpeg-d61cf1b1ebc2477749d7d7825a072400ed24af9f.tar.gz |
avcodec/v4l2_buffers: Add handling for NV21 and YUV420P
The single planar support was for NV12 only.
Add NV21 and YUV420P support.
Signed-off-by: Aman Gupta <aman@tmm1.net>
-rw-r--r-- | libavcodec/v4l2_buffers.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c index 51b0d25cad..de72b7f80c 100644 --- a/libavcodec/v4l2_buffers.c +++ b/libavcodec/v4l2_buffers.c @@ -321,11 +321,20 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) /* 1.1 fixup special cases */ switch (avbuf->context->av_pix_fmt) { case AV_PIX_FMT_NV12: + case AV_PIX_FMT_NV21: if (avbuf->num_planes > 1) break; frame->linesize[1] = avbuf->plane_info[0].bytesperline; frame->data[1] = frame->buf[0]->data + avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height; break; + case AV_PIX_FMT_YUV420P: + if (avbuf->num_planes > 1) + break; + frame->linesize[1] = avbuf->plane_info[0].bytesperline >> 1; + frame->linesize[2] = avbuf->plane_info[0].bytesperline >> 1; + frame->data[1] = frame->buf[0]->data + avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height; + frame->data[2] = frame->data[1] + ((avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height) >> 2); + break; default: break; } |