Skip to content

Commit

Permalink
heic: Recognize HEIC files only if they have gainmap
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 699276870
  • Loading branch information
vigneshvg authored and copybara-github committed Nov 22, 2024
1 parent 182098f commit 94ae638
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/parser/mp4box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 94ae638

Please sign in to comment.