From a3008444b66fbbc2494f5b1e18784f4c674c48fd Mon Sep 17 00:00:00 2001 From: James Heinrich Date: Sat, 4 Nov 2023 15:59:40 -0400 Subject: [PATCH] Quicktime missing tags on second scan https://github.com/JamesHeinrich/getID3/issues/214 --- getid3/getid3.php | 2 +- getid3/module.audio-video.quicktime.php | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/getid3/getid3.php b/getid3/getid3.php index 41ef6408..580d0972 100644 --- a/getid3/getid3.php +++ b/getid3/getid3.php @@ -387,7 +387,7 @@ class getID3 */ protected $startup_warning = ''; - const VERSION = '1.9.23-202310190849'; + const VERSION = '1.9.23-202311041554'; const FREAD_BUFFER_SIZE = 32768; const ATTACHMENTS_NONE = false; diff --git a/getid3/module.audio-video.quicktime.php b/getid3/module.audio-video.quicktime.php index c058bbc1..7824acde 100644 --- a/getid3/module.audio-video.quicktime.php +++ b/getid3/module.audio-video.quicktime.php @@ -38,12 +38,21 @@ class getid3_quicktime extends getid3_handler */ public $ParseAllPossibleAtoms = false; + /** + * real ugly, but so is the QuickTime structure that stores keys and values in different multi-nested locations that are hard to relate to each other + * https://github.com/JamesHeinrich/getID3/issues/214 + * + * @var int + */ + private $metaDATAkey = 1; + /** * @return bool */ public function Analyze() { $info = &$this->getid3->info; + $this->metaDATAkey = 1; $info['fileformat'] = 'quicktime'; $info['quicktime']['hinting'] = false; $info['quicktime']['controller'] = 'standard'; // may be overridden if 'ctyp' atom is present @@ -1721,13 +1730,12 @@ public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset break; case 'data': // metaDATA atom - static $metaDATAkey = 1; // real ugly, but so is the QuickTime structure that stores keys and values in different multinested locations that are hard to relate to each other // seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data $atom_structure['language'] = substr($atom_data, 4 + 0, 2); $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); $atom_structure['data'] = substr($atom_data, 4 + 4); - $atom_structure['key_name'] = (isset($info['quicktime']['temp_meta_key_names'][$metaDATAkey]) ? $info['quicktime']['temp_meta_key_names'][$metaDATAkey] : ''); - $metaDATAkey++; + $atom_structure['key_name'] = (isset($info['quicktime']['temp_meta_key_names'][$this->metaDATAkey]) ? $info['quicktime']['temp_meta_key_names'][$this->metaDATAkey] : ''); + $this->metaDATAkey++; if ($atom_structure['key_name'] && $atom_structure['data']) { @$info['quicktime']['comments'][str_replace('com.apple.quicktime.', '', $atom_structure['key_name'])][] = $atom_structure['data'];