diff --git a/src/parser/mp4box.rs b/src/parser/mp4box.rs index 9ab506f..fa1f2b0 100644 --- a/src/parser/mp4box.rs +++ b/src/parser/mp4box.rs @@ -70,12 +70,18 @@ impl FileTypeBox { pub fn is_avif(&self) -> bool { // "avio" also exists but does not identify the file as AVIF on its own. See // https://aomediacodec.github.io/av1-avif/v1.1.0.html#image-and-image-collection-brand - self.has_brand_any(&[ - "avif", - "avis", - #[cfg(feature = "heic")] - "heic", - ]) + if self.has_brand_any(&["avif", "avis"]) { + return true; + } + match (cfg!(feature = "heic"), cfg!(android_soong)) { + (false, _) => false, + (true, false) => self.has_brand("heic"), + (true, true) => { + // This is temporary. For the Android Framework, recognize HEIC files only if they + // also contain a gainmap. + self.has_brand("heic") && self.has_tmap() + } + } } pub fn needs_meta(&self) -> bool {