Skip to content

Commit

Permalink
Rpi Support - Add handling for NV21 and YUV420P
Browse files Browse the repository at this point in the history
  • Loading branch information
Artiume authored Mar 8, 2020
1 parent 4ea47bf commit 480bd11
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libavcodec/v4l2_buffers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 480bd11

Please sign in to comment.