aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvectronic <hello.vectronic@gmail.com>2019-09-23 21:43:04 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2020-03-10 15:10:40 +0000
commit472e044587d5fe43bbc84713ca824fd8350924b8 (patch)
treea91b7396ffa71fdcb8b3e7bfbadd22ccec20e4f1
parent05d27f342be28cf92f3c9470e701834c416cad89 (diff)
downloadffmpeg-472e044587d5fe43bbc84713ca824fd8350924b8.tar.gz
avformat/mov: add ICC profile support for colr atom
Signed-off-by: vectronic <hello.vectronic@gmail.com>
-rw-r--r--libavformat/mov.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index ff1e534489..79544da127 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1546,6 +1546,7 @@ static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
+ uint8_t *icc_profile;
char color_parameter_type[5] = { 0 };
uint16_t color_primaries, color_trc, color_matrix;
int ret;
@@ -1558,12 +1559,22 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (ret < 0)
return ret;
if (strncmp(color_parameter_type, "nclx", 4) &&
- strncmp(color_parameter_type, "nclc", 4)) {
+ strncmp(color_parameter_type, "nclc", 4) &&
+ strncmp(color_parameter_type, "prof", 4)) {
av_log(c->fc, AV_LOG_WARNING, "unsupported color_parameter_type %s\n",
color_parameter_type);
return 0;
}
+ if (!strncmp(color_parameter_type, "prof", 4)) {
+ icc_profile = av_stream_new_side_data(st, AV_PKT_DATA_ICC_PROFILE, atom.size - 4);
+ if (!icc_profile)
+ return AVERROR(ENOMEM);
+ ret = ffio_read_size(pb, icc_profile, atom.size - 4);
+ if (ret < 0)
+ return ret;
+ }
+ else {
color_primaries = avio_rb16(pb);
color_trc = avio_rb16(pb);
color_matrix = avio_rb16(pb);
@@ -1592,7 +1603,7 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
st->codecpar->color_trc = color_trc;
st->codecpar->color_space = color_matrix;
av_log(c->fc, AV_LOG_TRACE, "\n");
-
+ }
return 0;
}