]> git.sesse.net Git - ffmpeg/commit
avcodec/v4l2_m2m_enc: Check encoder pix_fmt matches pix_fmt on device
authorAndriy Gelman <andriy.gelman@gmail.com>
Fri, 27 Dec 2019 23:38:35 +0000 (18:38 -0500)
committerMark Thompson <sw@jkqxz.net>
Fri, 27 Dec 2019 23:42:57 +0000 (23:42 +0000)
commitfc3760a66dc7622e1b507e322e63411bd8c13369
treed82706ab2267d81fc20b2f5f9dd3b652276ed117
parenta619787a9ca87e0c4566cf124d52d23974a440d9
avcodec/v4l2_m2m_enc: Check encoder pix_fmt matches pix_fmt on device

Fixes #8079

During initialization of a v4l2m2m device, the configured pix_fmt can be
different to the pix_fmt of the encoder (i.e. avctx->pix_fmt).

For example on the Odroid XU4:
./ffmpeg -f lavfi -i yuvtestsrc -codec:v h264_v4l2m2m out.h264

will configure the v4l2 encoder to pix_fmt nv21, whereas the input
frames will be yuv444p.

This commit checks that the configured v4l2 pix_fmt on device is the
same as avctx->pix_fmt. If they are different the initialization fails
and an error is returned. Tested on RPI4 and Odroid XU4.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
libavcodec/v4l2_m2m_enc.c