Repository navigation
fix(heif): detect HEIC and AVIF motion photos without libheif - #8
Merged
Merged
Conversation
DichenZhang1
force-pushed
the
fix/heif-motion-photo-detection
branch
from
October 6, 2026 19:29
20a1015 to
f10dbca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors Google3
cl/990031203(fixesb/567336720): enables the Java API (MetadataEngine.parseMetadata,parseMetadataFd,isMotionPhoto), Android builds, and C++ParseMotionPhotoFrom*(..., nullptr)to detect HEIC and AVIF motion photos without requiringlibheif.Root Causes Addressed
FileType::kJpeg;ParseMetadataFromFdnow sniffs theftypbox header viaSniffFileType().MetadataEngine::Parsepreviously had no container splitter for HEIF, producing an emptyMetadataCollection.ParseMotionPhotoFrom*previously detected HEIF only viaMotionPhotoHeifInfoBuilderwhenout_metadata != nullptr(and only when compiled withlibheif, which is disabled on Android).Changes
container_splitter.h/jpeg_container_splitter.cc/heif_container_splitter.cc/metadata_engine.cc:CreateContainerSplitter()injpeg_container_splitter.cctoCreateJpegContainerSplitter().CreateHeifContainerSplitter()inheif_container_splitter.cc, which reads the ISO BMFF item boxes of themetabox directly (pitm,iinf,iref,iloc,idat) and emits the primary image's XMP item as astandard.xmpblock when a valid top-levelmpvdbox is present.CreateJpegContainerSplitter()vsCreateHeifContainerSplitter()inMetadataEngine::Parse().motion_photo_jni.cc: AddsSniffFileType()and uses it inParseMetadataFromFdand AGTM entry points.heif_container_splitter_test.cc/libmotionphoto_api_test.cc/MetadataEngineTest.java/lib/core/CMakeLists.txt: Adds unit tests forHeifContainerSplitter,ParseMotionPhotoFrom*(..., nullptr), and JavaMetadataEngineHEIC detection.