From b217754e5a14b69085d947e6e938f1fd66919e12 Mon Sep 17 00:00:00 2001 From: Vignesh Venkatasubramanian Date: Wed, 21 Sep 2022 11:32:08 -0700 Subject: [PATCH] Check that auxiliary tracks have 'auxv' as the handler_type According to the HEIF specification, auxiliary tracks should have 'auxv' as the handler_type. Update the existing findAuxlTracks logic to check for that and then perform the 'auxi' check only on those tracks which have the handler_type as 'auxi'. Fixes issue #38. --- src/specs/heif/heif.cpp | 7 ++++++- src/specs/miaf/miaf.cpp | 2 +- tests/avif/invalid-avis-pict.ref | 12 +++++++++++- tests/heif/invalid-auxl-auxi.ref | 3 ++- tests/heif/invalid-brand-msf1.asm | 2 +- tests/heif/valid-auxl-auxi.asm | 2 +- tests/heif/valid-brand-msf1.asm | 2 +- tests/heif/valid-multiple-extents.asm | 2 +- tests/miaf/invalid-alpha-track-composition-times.asm | 2 +- tests/miaf/invalid-pixi-displayable.asm | 2 +- tests/miaf/valid-alpha-track-composition-times.asm | 2 +- 11 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/specs/heif/heif.cpp b/src/specs/heif/heif.cpp index d95d2bc..1a787a4 100644 --- a/src/specs/heif/heif.cpp +++ b/src/specs/heif/heif.cpp @@ -199,8 +199,13 @@ static const SpecDesc specHeif = trackId = (uint32_t)sym.value; } - if(handlerType == FOURCC("pict") && trackId) + if(trackId) { + if(handlerType != FOURCC("auxv")) + { + out->error("Found 'auxl' track (trackId: %u) with unexpected handler_type=\"%s\". Must be 'auxv'.", trackId, toString(handlerType).c_str()); + } + auto id = findTrackId(moovChild); if(id) diff --git a/src/specs/miaf/miaf.cpp b/src/specs/miaf/miaf.cpp index 08dce9e..ac7f728 100644 --- a/src/specs/miaf/miaf.cpp +++ b/src/specs/miaf/miaf.cpp @@ -1391,7 +1391,7 @@ std::initializer_list rulesMiafGeneral = trackId = (uint32_t)sym.value; } - if(handlerType == FOURCC("pict") && trackId) + if(handlerType == FOURCC("auxv") && trackId) { auto id = findTrackId(moovChild); diff --git a/tests/avif/invalid-avis-pict.ref b/tests/avif/invalid-avis-pict.ref index 77b70d4..24e1019 100644 --- a/tests/avif/invalid-avis-pict.ref +++ b/tests/avif/invalid-avis-pict.ref @@ -66,15 +66,21 @@ displayable (not hidden) Specification description: HEIF - ISO/IEC 23008-12 - 2nd Edition N18310 +[heif][Rule #1] Error: Found 'auxl' track (trackId: 1) with unexpected handler_type="pico". Must be 'auxv'. [heif][Rule #3] Error: The handler type for the MetaBox shall be 'pict' [heif][Rule #32] Error: 'mif1' brand: this file shall conform to HEIF section 6, check the other errors for details +[heif][Rule #33] Error: 'msf1' brand: this file shall conform to HEIF section 7, check the other errors for details ======================================== -[heif] 2 error(s), 0 warning(s). +[heif] 4 error(s), 0 warning(s). ======================================== ===== Involved rules descriptions: +[heif][Rule #1] Section 7.5.3.1 +The nature of the auxiliary track is announced by the AuxiliaryTypeInfoBox that +shall be included in the sample entry of the auxiliary track. + [heif][Rule #3] Section 6.2 The handler type for the MetaBox shall be 'pict'. @@ -82,6 +88,10 @@ The handler type for the MetaBox shall be 'pict'. when a brand specified in 10.2 is among the compatible brands of a file, the requirements specified in Clause 6 shall be obeyed +[heif][Rule #33] Section 10.3 +when a brand specified in 10.3 is among the compatible brands of a file, +the requirements specified in Clause 7 shall be obeyed + +--------------------------------------+ | isobmff validation | +--------------------------------------+ diff --git a/tests/heif/invalid-auxl-auxi.ref b/tests/heif/invalid-auxl-auxi.ref index b383054..a5198e3 100644 --- a/tests/heif/invalid-auxl-auxi.ref +++ b/tests/heif/invalid-auxl-auxi.ref @@ -4,11 +4,12 @@ Specification description: HEIF - ISO/IEC 23008-12 - 2nd Edition N18310 +[heif][Rule #1] Error: Found 'auxl' track (trackId: 1) with unexpected handler_type="pict". Must be 'auxv'. [heif][Rule #1] Error: AuxiliaryTypeInfoBox ('auxi') is absent (trackIDs: video=1, aux=2) [heif][Rule #33] Error: 'msf1' brand: this file shall conform to HEIF section 7, check the other errors for details ======================================== -[heif] 2 error(s), 0 warning(s). +[heif] 3 error(s), 0 warning(s). ======================================== ===== Involved rules descriptions: diff --git a/tests/heif/invalid-brand-msf1.asm b/tests/heif/invalid-brand-msf1.asm index 4703af7..638052e 100644 --- a/tests/heif/invalid-brand-msf1.asm +++ b/tests/heif/invalid-brand-msf1.asm @@ -504,7 +504,7 @@ moov_start: db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)" - db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict') + db 0x61, 0x75, 0x78, 0x76 ; "handler_type(32)" ('auxv') db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)" diff --git a/tests/heif/valid-auxl-auxi.asm b/tests/heif/valid-auxl-auxi.asm index bca9a5c..b7806ab 100644 --- a/tests/heif/valid-auxl-auxi.asm +++ b/tests/heif/valid-auxl-auxi.asm @@ -503,7 +503,7 @@ moov_start: db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)" - db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict') + db 0x61, 0x75, 0x78, 0x76 ; "handler_type(32)" ('auxv') db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)" diff --git a/tests/heif/valid-brand-msf1.asm b/tests/heif/valid-brand-msf1.asm index 81cff81..2e34a87 100644 --- a/tests/heif/valid-brand-msf1.asm +++ b/tests/heif/valid-brand-msf1.asm @@ -504,7 +504,7 @@ moov_start: db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)" - db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict') + db 0x61, 0x75, 0x78, 0x76 ; "handler_type(32)" ('auxv') db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)" diff --git a/tests/heif/valid-multiple-extents.asm b/tests/heif/valid-multiple-extents.asm index 81cff81..2e34a87 100644 --- a/tests/heif/valid-multiple-extents.asm +++ b/tests/heif/valid-multiple-extents.asm @@ -504,7 +504,7 @@ moov_start: db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)" - db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict') + db 0x61, 0x75, 0x78, 0x76 ; "handler_type(32)" ('auxv') db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)" diff --git a/tests/miaf/invalid-alpha-track-composition-times.asm b/tests/miaf/invalid-alpha-track-composition-times.asm index 074c392..c67e95e 100644 --- a/tests/miaf/invalid-alpha-track-composition-times.asm +++ b/tests/miaf/invalid-alpha-track-composition-times.asm @@ -511,7 +511,7 @@ moov_start: db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)" - db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict') + db 0x61, 0x75, 0x78, 0x76 ; "handler_type(32)" ('auxv') db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)" diff --git a/tests/miaf/invalid-pixi-displayable.asm b/tests/miaf/invalid-pixi-displayable.asm index 3719da1..973baa9 100644 --- a/tests/miaf/invalid-pixi-displayable.asm +++ b/tests/miaf/invalid-pixi-displayable.asm @@ -503,7 +503,7 @@ moov_start: db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)" - db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict') + db 0x61, 0x75, 0x78, 0x76 ; "handler_type(32)" ('pict') db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)" diff --git a/tests/miaf/valid-alpha-track-composition-times.asm b/tests/miaf/valid-alpha-track-composition-times.asm index bca9a5c..b7806ab 100644 --- a/tests/miaf/valid-alpha-track-composition-times.asm +++ b/tests/miaf/valid-alpha-track-composition-times.asm @@ -503,7 +503,7 @@ moov_start: db 0x00 ; "version(8)" db 0x00, 0x00, 0x00 ; "flags(24)" db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)" - db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict') + db 0x61, 0x75, 0x78, 0x76 ; "handler_type(32)" ('auxv') db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)" db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)"