diff mbox series

[FFmpeg-devel,v5,4/7] avcodec/v4l2_context: set resolution change if decoded format changed

Message ID 20220104090836.31660-4-ming.qian@nxp.com
State New
Headers show
Series [FFmpeg-devel,v5,1/7] avcodec/v4l2_context: don't reinit output queue when dynamic resolution change | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Ming Qian Jan. 4, 2022, 9:08 a.m. UTC
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@nxp.com>
---
 libavcodec/v4l2_context.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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;