From a8b1d152a4b5eb9912658fd438f3465a836a2cf4 Mon Sep 17 00:00:00 2001 From: lucabe Date: Tue, 21 Oct 2008 07:59:41 +0000 Subject: [PATCH] The v4l2 driver can silently change the pixel format in the VIDIOC_S_FMT ioctl(). In this case, device_init() should fail so that a different pixel format is tried. Patch by Jens Rosenboom (jens DOT rosenboom AT eu DOT panasonic DOT com) git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15660 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- libavdevice/v4l2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 699a982ac..d8d58f06b 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -193,6 +193,11 @@ static int device_init(AVFormatContext *ctx, int *width, int *height, int pix_fm *height = fmt.fmt.pix.height; } + if (pix_fmt != fmt.fmt.pix.pixelformat) { + av_log(ctx, AV_LOG_DEBUG, "The V4L2 driver changed the pixel format from 0x%08X to 0x%08X\n", pix_fmt, fmt.fmt.pix.pixelformat); + res = -1; + } + return res; } -- 2.11.4.GIT