It's used to signal an item is an auxiliary image. Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/isom.h | 1 + libavformat/mov.c | 47 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/libavformat/isom.h b/libavformat/isom.h index 4723397048..5076bc5da7 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -285,6 +285,7 @@ typedef struct HEIFItem { int height; int type; int is_idat_relative; + char *aux_type; } HEIFItem; typedef struct HEIFGrid { diff --git a/libavformat/mov.c b/libavformat/mov.c index a2333ac1fd..bd502d489a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8929,6 +8929,43 @@ static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static int mov_read_auxc(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ + AVBPrint bp; + int64_t size = atom.size; + char *aux_type; + int ret; + + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + size -= 4; + + av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); + ret = ff_read_string_to_bprint_overwrite(pb, &bp, size); + if (ret < 0) { + av_bprint_finalize(&bp, NULL); + return ret; + } + + size -= ret + 1; + if (size > 0) + avio_skip(pb, size); + + if (ret) + av_bprint_finalize(&bp, &aux_type); + + av_log(c->fc, AV_LOG_TRACE, "auxC: aux_type %s\n", aux_type); + + for (int i = 0; i < c->nb_heif_item; i++) { + if (c->heif_item[i].item_id == c->cur_item_id) { + c->heif_item[i].aux_type = aux_type; + break; + } + } + + return 0; +} + static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) { typedef struct MOVAtoms { @@ -9157,6 +9194,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('i','s','p','e'), mov_read_ispe }, { MKTAG('i','p','r','p'), mov_read_iprp }, { MKTAG('i','i','n','f'), mov_read_iinf }, +{ MKTAG('a','u','x','C'), mov_read_auxc }, { MKTAG('a','m','v','e'), mov_read_amve }, /* ambient viewing environment box */ { MKTAG('l','h','v','C'), mov_read_lhvc }, { MKTAG('l','v','c','C'), mov_read_glbl }, @@ -9677,8 +9715,10 @@ static int mov_read_close(AVFormatContext *s) av_freep(&mov->aes_decrypt); av_freep(&mov->chapter_tracks); - for (i = 0; i < mov->nb_heif_item; i++) + for (i = 0; i < mov->nb_heif_item; i++) { av_freep(&mov->heif_item[i].name); + av_freep(&mov->heif_item[i].aux_type); + } av_freep(&mov->heif_item); for (i = 0; i < mov->nb_heif_grid; i++) { av_freep(&mov->heif_grid[i].tile_id_list); @@ -10149,6 +10189,11 @@ static int mov_read_header(AVFormatContext *s) if (item->item_id == mov->primary_item_id) st->disposition |= AV_DISPOSITION_DEFAULT; + if (item->aux_type && + !memcmp(item->aux_type, "urn:com:apple:photo:2020:aux:hdrgainmap", + strlen(item->aux_type))) + st->disposition |= (AV_DISPOSITION_GAINMAP | AV_DISPOSITION_DEPENDENT); + mov_build_index(mov, st); } -- 2.46.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".