Commit b058062a45 for ffmpeg
commit b058062a45033427063e88b112af2a5387917592
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date: Fri Oct 16 19:01:08 2026 +0200
avformat/mov: report reserved vpcC colour tags as unspecified
The vpcC colour primaries, transfer characteristics and matrix were only
checked for having a name, and 0 and 3 have one ("reserved").
The swscale frame checks reject reserved values, so scaling such a stream fails
with ENOTSUP. h2645_vui.c reports them as unspecified since c80002aa81
("avcodec/h2645_vui: Ensure color primaries/trc/space isn't reserved value"),
do the same here. Valid values are untouched.
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 16ef5ce1ae..0c2f592e7f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6918,11 +6918,17 @@ static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (avio_rb16(pb)) /* codecIntializationDataSize */
return AVERROR_INVALIDDATA;
- if (!av_color_primaries_name(color_primaries))
+ // Reserved and unassigned values carry no colour information
+ if (color_primaries == AVCOL_PRI_RESERVED0 ||
+ color_primaries == AVCOL_PRI_RESERVED ||
+ !av_color_primaries_name(color_primaries))
color_primaries = AVCOL_PRI_UNSPECIFIED;
- if (!av_color_transfer_name(color_trc))
+ if (color_trc == AVCOL_TRC_RESERVED0 ||
+ color_trc == AVCOL_TRC_RESERVED ||
+ !av_color_transfer_name(color_trc))
color_trc = AVCOL_TRC_UNSPECIFIED;
- if (!av_color_space_name(color_space))
+ if (color_space == AVCOL_SPC_RESERVED ||
+ !av_color_space_name(color_space))
color_space = AVCOL_SPC_UNSPECIFIED;
st->codecpar->color_range = (color_range & 1) ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
diff --git a/tests/ref/fate/mov-vpcc-reserved-color-tags b/tests/ref/fate/mov-vpcc-reserved-color-tags
index b9422ea102..8e06c4bec5 100644
--- a/tests/ref/fate/mov-vpcc-reserved-color-tags
+++ b/tests/ref/fate/mov-vpcc-reserved-color-tags
@@ -1,3 +1,3 @@
-color_space=reserved
-color_transfer=reserved
-color_primaries=reserved
+color_space=unknown
+color_transfer=unknown
+color_primaries=unknown