[FFmpeg-devel] [PATCH v5 4/7] avcodec/v4l2_context: set resolution change if decoded format changed
Ming Qian
ming.qian at nxp.com
Tue Jan 4 11:08:33 EET 2022
The dynamic resoltuion change occurs when he decoder detects a coded
frame with one or more of the following parameters different from those
previously established (and reflected by corresponding queries):
1. coded resolution (OUTPUT width and height)
2. visible resolution (selection rectangles)
3. the minimum number of buffers needed for decoding
4. bit-depth of the bitstream has been changed
when the bit-depth is changed, the pixel format will be changed,
so the format is changed after a source change event,
we should handle it and reinit the capture queue.
Signed-off-by: Ming Qian <ming.qian at nxp.com>
---
libavcodec/v4l2_context.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index a181f884d2a6..0a0f5b226960 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -85,9 +85,11 @@ static inline unsigned int v4l2_resolution_changed(V4L2Context *ctx, struct v4l2
{
struct v4l2_format *fmt1 = &ctx->format;
int ret = V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ?
+ fmt1->fmt.pix_mp.pixelformat != fmt2->fmt.pix_mp.pixelformat ||
fmt1->fmt.pix_mp.width != fmt2->fmt.pix_mp.width ||
fmt1->fmt.pix_mp.height != fmt2->fmt.pix_mp.height
:
+ fmt1->fmt.pix.pixelformat != fmt2->fmt.pix.pixelformat ||
fmt1->fmt.pix.width != fmt2->fmt.pix.width ||
fmt1->fmt.pix.height != fmt2->fmt.pix.height;
--
2.33.0
More information about the ffmpeg-devel
mailing list