summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriele Mondada <gmondada@recolive.com>2021-08-30 10:11:18 +0200
committerGitHub <noreply@github.com>2021-08-30 13:41:18 +0530
commit16e53564ae6c2689387479c04770f492075d5b7b (patch)
tree55f4d601e1651e9b110dfed97f7cc9547e99274e
parenta0476060ed1acc70f532c43a6f0193de97210c5e (diff)
fix not fully implemented kXMPFiles_OpenOnlyXMP flag (#24)
-rw-r--r--XMPFiles/source/FileHandlers/MPEG4_Handler.cpp66
1 files changed, 34 insertions, 32 deletions
diff --git a/XMPFiles/source/FileHandlers/MPEG4_Handler.cpp b/XMPFiles/source/FileHandlers/MPEG4_Handler.cpp
index 2d48a45..7374d45 100644
--- a/XMPFiles/source/FileHandlers/MPEG4_Handler.cpp
+++ b/XMPFiles/source/FileHandlers/MPEG4_Handler.cpp
@@ -2105,46 +2105,48 @@ void MPEG4_MetaHandler::ProcessXMP()
// Import the non-XMP items. Do the imports in reverse priority order, last import wins!
- MOOV_Manager::BoxInfo mvhdInfo;
- MOOV_Manager::BoxRef mvhdRef = this->moovMgr.GetBox ( "moov/mvhd", &mvhdInfo );
- bool mvhdFound = ((mvhdRef != 0) && (mvhdInfo.contentSize != 0));
+ if ( !xmpOnly ) {
+ MOOV_Manager::BoxInfo mvhdInfo;
+ MOOV_Manager::BoxRef mvhdRef = this->moovMgr.GetBox ( "moov/mvhd", &mvhdInfo );
+ bool mvhdFound = ((mvhdRef != 0) && (mvhdInfo.contentSize != 0));
+
+ MOOV_Manager::BoxInfo udtaInfo;
+ MOOV_Manager::BoxRef udtaRef = this->moovMgr.GetBox ( "moov/udta", &udtaInfo );
+ std::vector<MOOV_Manager::BoxInfo> cprtBoxes;
+ if ( udtaRef != 0 ) {
+ for ( XMP_Uns32 i = 0; i < udtaInfo.childCount; ++i ) {
+ MOOV_Manager::BoxInfo currInfo;
+ MOOV_Manager::BoxRef currRef = this->moovMgr.GetNthChild ( udtaRef, i, &currInfo );
+ if ( currRef == 0 ) break; // Sanity check, should not happen.
+ if ( currInfo.boxType != ISOMedia::k_cprt ) continue;
+ cprtBoxes.push_back ( currInfo );
+ }
+ }
+ bool cprtFound = (! cprtBoxes.empty());
- MOOV_Manager::BoxInfo udtaInfo;
- MOOV_Manager::BoxRef udtaRef = this->moovMgr.GetBox ( "moov/udta", &udtaInfo );
- std::vector<MOOV_Manager::BoxInfo> cprtBoxes;
- if ( udtaRef != 0 ) {
- for ( XMP_Uns32 i = 0; i < udtaInfo.childCount; ++i ) {
- MOOV_Manager::BoxInfo currInfo;
- MOOV_Manager::BoxRef currRef = this->moovMgr.GetNthChild ( udtaRef, i, &currInfo );
- if ( currRef == 0 ) break; // Sanity check, should not happen.
- if ( currInfo.boxType != ISOMedia::k_cprt ) continue;
- cprtBoxes.push_back ( currInfo );
- }
- }
- bool cprtFound = (! cprtBoxes.empty());
-
- bool tradQTFound = this->tradQTMgr.ParseCachedBoxes ( this->moovMgr );
+ bool tradQTFound = this->tradQTMgr.ParseCachedBoxes ( this->moovMgr );
- bool tmcdFound = this->ParseTimecodeTrack();
+ bool tmcdFound = this->ParseTimecodeTrack();
- if ( this->fileMode == MOOV_Manager::kFileIsNormalISO ) {
+ if ( this->fileMode == MOOV_Manager::kFileIsNormalISO ) {
- if ( mvhdFound ) this->containsXMP |= ImportMVHDItems ( mvhdInfo, &this->xmpObj );
- if ( cprtFound ) this->containsXMP |= ImportISOCopyrights ( cprtBoxes, &this->xmpObj );
- if ( tmcdFound ) this->containsXMP |= ImportTimecodeItems ( this->tmcdInfo, this->tradQTMgr, &this->xmpObj );
- } else { // This is a QuickTime file, either traditional or modern.
+ if ( mvhdFound ) this->containsXMP |= ImportMVHDItems ( mvhdInfo, &this->xmpObj );
+ if ( cprtFound ) this->containsXMP |= ImportISOCopyrights ( cprtBoxes, &this->xmpObj );
+ if ( tmcdFound ) this->containsXMP |= ImportTimecodeItems ( this->tmcdInfo, this->tradQTMgr, &this->xmpObj );
+ } else { // This is a QuickTime file, either traditional or modern.
- if ( mvhdFound ) this->containsXMP |= ImportMVHDItems ( mvhdInfo, &this->xmpObj );
- if ( cprtFound ) this->containsXMP |= ImportISOCopyrights ( cprtBoxes, &this->xmpObj );
- if ( tmcdFound | tradQTFound ) {
- // Some of the timecode items are in the .../udta/... set but handled by ImportTimecodeItems.
- this->containsXMP |= ImportTimecodeItems ( this->tmcdInfo, this->tradQTMgr, &this->xmpObj );
- }
+ if ( mvhdFound ) this->containsXMP |= ImportMVHDItems ( mvhdInfo, &this->xmpObj );
+ if ( cprtFound ) this->containsXMP |= ImportISOCopyrights ( cprtBoxes, &this->xmpObj );
+ if ( tmcdFound | tradQTFound ) {
+ // Some of the timecode items are in the .../udta/... set but handled by ImportTimecodeItems.
+ this->containsXMP |= ImportTimecodeItems ( this->tmcdInfo, this->tradQTMgr, &this->xmpObj );
+ }
- this->containsXMP |= ImportCr8rItems ( this->moovMgr, &this->xmpObj );
+ this->containsXMP |= ImportCr8rItems ( this->moovMgr, &this->xmpObj );
+ }
}
-
+
} // MPEG4_MetaHandler::ProcessXMP
// =================================================================================================