[PR] avcodec/v4l2_m2m: add WMV3 decoder and fix VC1 pixel format mapping (PR #23636)

ganqiuye via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178271911588.59.4796622864177030181@29965ddac10e>
PR #23636 opened by ganqiuye
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23636
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23636.patch

WMV3 (Simple/Main profile) bitstreams use V4L2_PIX_FMT_VC1_ANNEX_G, while VC-1 Advanced Profile uses V4L2_PIX_FMT_VC1_ANNEX_L.
The existing mapping incorrectly associated AV_CODEC_ID_VC1 with VC1_ANNEX_G.

Add wmv3_v4l2m2m_decoder and map WMV3 to VC1_ANNEX_G and VC1 to VC1_ANNEX_L in v4l2_fmt.c.

Signed-off-by: ganqiuye <[email protected]>

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 3bbf8f0ab2c6659e290a95c1e36a9ed56d3f7714 Mon Sep 17 00:00:00 2001
From: ganqiuye <[email protected]>
Date: Mon, 29 Jun 2026 15:15:35 +0800
Subject: [PATCH] avcodec/v4l2_m2m: add WMV3 decoder and fix VC1 pixel format
 mapping

WMV3 (Simple/Main profile) bitstreams use V4L2_PIX_FMT_VC1_ANNEX_G, while VC-1 Advanced Profile uses V4L2_PIX_FMT_VC1_ANNEX_L.
The existing mapping incorrectly associated AV_CODEC_ID_VC1 with VC1_ANNEX_G.

Add wmv3_v4l2m2m_decoder and map WMV3 to VC1_ANNEX_G and VC1 to VC1_ANNEX_L in v4l2_fmt.c.

Signed-off-by: ganqiuye <[email protected]>
---
 configure                 | 1 +
 libavcodec/Makefile       | 1 +
 libavcodec/allcodecs.c    | 1 +
 libavcodec/v4l2_fmt.c     | 5 ++++-
 libavcodec/v4l2_m2m_dec.c | 1 +
 5 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 785e23fb16..b46330b22b 100755
--- a/configure
+++ b/configure
@@ -3711,6 +3711,7 @@ vc1_cuvid_decoder_deps="cuvid"
 vc1_mmal_decoder_deps="mmal"
 vc1_qsv_decoder_select="qsvdec"
 vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
+wmv3_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
 vp8_cuvid_decoder_deps="cuvid"
 vp8_mediacodec_decoder_deps="mediacodec"
 vp8_mediacodec_encoder_deps="mediacodec"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 95ba308504..6fe6eb0c9d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -790,6 +790,7 @@ OBJS-$(CONFIG_VC1_CUVID_DECODER)       += cuviddec.o
 OBJS-$(CONFIG_VC1_MMAL_DECODER)        += mmaldec.o
 OBJS-$(CONFIG_VC1_QSV_DECODER)         += qsvdec.o
 OBJS-$(CONFIG_VC1_V4L2M2M_DECODER)     += v4l2_m2m_dec.o
+OBJS-$(CONFIG_WMV3_V4L2M2M_DECODER)    += v4l2_m2m_dec.o
 OBJS-$(CONFIG_VC2_ENCODER)             += vc2enc.o vc2enc_dwt.o diractab.o
 OBJS-$(CONFIG_VCR1_DECODER)            += vcr1.o
 OBJS-$(CONFIG_VMDAUDIO_DECODER)        += vmdaudio.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 47eded261f..75552f9525 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -395,6 +395,7 @@ extern const FFCodec ff_wmv2_encoder;
 extern const FFCodec ff_wmv2_decoder;
 extern const FFCodec ff_wmv3_decoder;
 extern const FFCodec ff_wmv3image_decoder;
+extern const FFCodec ff_wmv3_v4l2m2m_decoder;
 extern const FFCodec ff_wnv1_decoder;
 extern const FFCodec ff_xan_wc3_decoder;
 extern const FFCodec ff_xan_wc4_decoder;
diff --git a/libavcodec/v4l2_fmt.c b/libavcodec/v4l2_fmt.c
index 6df47e3f5a..d8c1494a0d 100644
--- a/libavcodec/v4l2_fmt.c
+++ b/libavcodec/v4l2_fmt.c
@@ -105,7 +105,10 @@ static const struct fmt_conversion {
     { AV_FMT(NONE),        AV_CODEC(HEVC),        V4L2_FMT(HEVC) },
 #endif
 #ifdef V4L2_PIX_FMT_VC1_ANNEX_G
-    { AV_FMT(NONE),        AV_CODEC(VC1),         V4L2_FMT(VC1_ANNEX_G) },
+    { AV_FMT(NONE),        AV_CODEC(WMV3),        V4L2_FMT(VC1_ANNEX_G) },
+#endif
+#ifdef V4L2_PIX_FMT_VC1_ANNEX_L
+    { AV_FMT(NONE),        AV_CODEC(VC1),         V4L2_FMT(VC1_ANNEX_L) },
 #endif
 };
 
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index ba1fe769e0..cde8135162 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -264,5 +264,6 @@ M2MDEC(mpeg2, "MPEG2", AV_CODEC_ID_MPEG2VIDEO, NULL);
 M2MDEC(mpeg4, "MPEG4", AV_CODEC_ID_MPEG4,      NULL);
 M2MDEC(h263,  "H.263", AV_CODEC_ID_H263,       NULL);
 M2MDEC(vc1 ,  "VC1",   AV_CODEC_ID_VC1,        NULL);
+M2MDEC(wmv3,  "WMV3",  AV_CODEC_ID_WMV3,       NULL);
 M2MDEC(vp8,   "VP8",   AV_CODEC_ID_VP8,        NULL);
 M2MDEC(vp9,   "VP9",   AV_CODEC_ID_VP9,        NULL);
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.