1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/mov: don't abort on duplicate Mastering Display Metadata boxes

The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a
mdvc one. If both are present, just ignore one of them.
This is in line with clli and CoLL boxes.

Fixes ticket #10711.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 189c32f536)
This commit is contained in:
James Almer 2024-03-26 21:11:20 -03:00
parent 01fc3034ee
commit c2f678c307

View File

@ -5464,8 +5464,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version);
return 0;
}
if (sc->mastering)
return AVERROR_INVALIDDATA;
if (sc->mastering) {
av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n");
return 0;
}
avio_skip(pb, 3); /* flags */
@ -5502,11 +5504,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data;
if (atom.size < 24 || sc->mastering) {
if (atom.size < 24) {
av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n");
return AVERROR_INVALIDDATA;
}
if (sc->mastering) {
av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n");
return 0;
}
sc->mastering = av_mastering_display_metadata_alloc();
if (!sc->mastering)
return AVERROR(ENOMEM);