Skip to content

Commit

Permalink
Quicktime missing tags on second scan
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHeinrich committed Nov 4, 2023
1 parent 06c7482 commit a300844
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion getid3/getid3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 11 additions & 3 deletions getid3/module.audio-video.quicktime.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'];
Expand Down

0 comments on commit a300844

Please sign in to comment.