[FFmpeg-devel] [PATCH]Accept YV12 from v4l2
Carl Eugen Hoyos
cehoyos at ag.or.at
Sun Feb 5 20:10:55 CET 2012
On Friday 03 February 2012 12:28:25 am Carl Eugen Hoyos wrote:
> Hi!
>
> Attached is a non-intrusive patch that allows to decode YV12
> from a v4l2 device.
Applied, I cannot test the following so I will not apply them,
if somebody can test, I will happily provide patches:
V4L2_PIX_FMT_RGB332:
Can either be PIX_FMT_BGR8 or PIX_FMT_RGB8
V4L2_PIX_FMT_Y16:
PIX_FMT_GRAY16 or PIX_FMT_GRAY16BE or PIX_FMT_GRAY16LE
V4L2_PIX_FMT_NV21 should be PIX_FMT_NV21
Attached crashes the drivers here (as does using V4L2_PIX_FMT_YUV410), perhaps
it works for somebody?
Carl Eugen
-------------- next part --------------
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 642df1d..6300939 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -114,6 +114,7 @@ static struct fmt_map fmt_conversion_table[] = {
{ PIX_FMT_UYVY422, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY },
{ PIX_FMT_YUV411P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P },
{ PIX_FMT_YUV410P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410 },
+ { PIX_FMT_YUV410P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YVU410 },
{ PIX_FMT_RGB555LE,CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555 },
{ PIX_FMT_RGB555BE,CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555X },
{ PIX_FMT_RGB565LE,CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565 },
@@ -796,6 +797,8 @@ static int v4l2_read_header(AVFormatContext *s1)
avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
if (desired_format == V4L2_PIX_FMT_YVU420)
st->codec->codec_tag = MKTAG('Y', 'V', '1', '2');
+ if (desired_format == V4L2_PIX_FMT_YVU410)
+ st->codec->codec_tag = MKTAG('Y', 'V', 'U', '9');
st->codec->width = s->width;
st->codec->height = s->height;
st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;
More information about the ffmpeg-devel
mailing list