Commit 03405b27ff for ffmpeg
commit 03405b27ff9404c800a3f5ddf172c8e60f6a955e
Author: James Almer <jamrial@gmail.com>
Date: Tue Oct 13 19:29:59 2026 -0300
avformat/mov: remove auxl references from gain maps already applied with a tmap derived image
Signed-off-by: James Almer <jamrial@gmail.com>
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 90decf17f5..4870070cbf 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -11682,6 +11682,22 @@ static int mov_parse_heif_layered_video_tmap(AVFormatContext *s, const HEIFGroup
}
gain = NULL;
+ for (int k = 0; k < item->nb_iref_to_list; k++) {
+ HEIFItem *ref = get_heif_item(mov, item->iref_to_list[k].item_id);
+
+ av_assert0(ref);
+ // Remove auxl reference so we don't create the same group we made with
+ // this tmap using it. Strictly speaking, the chances for Apple style
+ // Exif values being present on a base item referenced by a tmap item
+ // are very low, but better safe than sorry.
+ if (item->iref_to_list[k].type == MKTAG('a','u','x','l') &&
+ (ref == tmap->item_list[!j])) {
+ if (k != (item->nb_iref_to_list - 1))
+ item->iref_to_list[k] = item->iref_to_list[item->nb_iref_to_list - 1];
+ --item->nb_iref_to_list;
+ break;
+ }
+ }
break;
}
av_free(gain);