mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-12 10:15:22 +00:00
mov: Rely on box type rather than file type for colr atom
Although it's not allowed to use only allows 'nclc' in ISOM files, there are samples that do not always respect this rule. This change prevents atom overread and a spurious color range initialization. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
parent
f8fd0c29ce
commit
be089af38f
@ -992,7 +992,7 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
av_dlog(c->fc, "%s: pri %"PRIu16" trc %"PRIu16" matrix %"PRIu16"",
|
av_dlog(c->fc, "%s: pri %"PRIu16" trc %"PRIu16" matrix %"PRIu16"",
|
||||||
color_parameter_type, color_primaries, color_trc, color_matrix);
|
color_parameter_type, color_primaries, color_trc, color_matrix);
|
||||||
|
|
||||||
if (c->isom) {
|
if (!strncmp(color_parameter_type, "nclx", 4)) {
|
||||||
uint8_t color_range = avio_r8(pb) >> 7;
|
uint8_t color_range = avio_r8(pb) >> 7;
|
||||||
av_dlog(c->fc, " full %"PRIu8"", color_range);
|
av_dlog(c->fc, " full %"PRIu8"", color_range);
|
||||||
if (color_range)
|
if (color_range)
|
||||||
@ -1012,7 +1012,7 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
st->codec->color_primaries = color_primaries;
|
st->codec->color_primaries = color_primaries;
|
||||||
st->codec->color_trc = color_trc;
|
st->codec->color_trc = color_trc;
|
||||||
st->codec->colorspace = color_matrix;
|
st->codec->colorspace = color_matrix;
|
||||||
} else {
|
} else if (!strncmp(color_parameter_type, "nclc", 4)) {
|
||||||
/* color primaries, Table 4-4 */
|
/* color primaries, Table 4-4 */
|
||||||
switch (color_primaries) {
|
switch (color_primaries) {
|
||||||
case 1: st->codec->color_primaries = AVCOL_PRI_BT709; break;
|
case 1: st->codec->color_primaries = AVCOL_PRI_BT709; break;
|
||||||
|
Loading…
Reference in New Issue
Block a user