Skip to content

Commit 164c78b

Browse files
committed
#452 Quicktime incorrect "keys" mapping
#452
1 parent 1e11b9b commit 164c78b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

getid3/getid3.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class getID3
387387
*/
388388
protected $startup_warning = '';
389389

390-
const VERSION = '1.9.24-202509040923';
390+
const VERSION = '1.9.24-202510150944';
391391
const FREAD_BUFFER_SIZE = 32768;
392392

393393
const ATTACHMENTS_NONE = false;

getid3/module.audio-video.quicktime.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ public function Analyze() {
190190
}
191191
if ($ISO6709parsed['latitude'] === false) {
192192
$this->warning('location.ISO6709 string not parsed correctly: "'.$ISO6709string.'", please submit as a bug');
193+
unset($info['quicktime']['comments']['location.ISO6709']);
193194
}
194195
break;
195196
}
@@ -1753,7 +1754,7 @@ public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset
17531754
break;
17541755

17551756
case 'data': // metaDATA atom
1756-
// seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data
1757+
// seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in one sample I have; 0x15C7 in another), remainder is useful data
17571758
$atom_structure['language'] = substr($atom_data, 4 + 0, 2);
17581759
$atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2));
17591760
$atom_structure['data'] = substr($atom_data, 4 + 4);
@@ -1779,13 +1780,15 @@ public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset
17791780
$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3));
17801781
$atom_structure['entry_count'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
17811782
$keys_atom_offset = 8;
1783+
1784+
$keys_index_base = (!empty($info['quicktime']['temp_meta_key_names']) ? count($info['quicktime']['temp_meta_key_names']) : 0); // file may contain multiple "keys" entries, starting index should be culmulative not reset to 1 on each set; https://github.com/JamesHeinrich/getID3/issues/452
17821785
for ($i = 1; $i <= $atom_structure['entry_count']; $i++) {
1783-
$atom_structure['keys'][$i]['key_size'] = getid3_lib::BigEndian2Int(substr($atom_data, $keys_atom_offset + 0, 4));
1784-
$atom_structure['keys'][$i]['key_namespace'] = substr($atom_data, $keys_atom_offset + 4, 4);
1785-
$atom_structure['keys'][$i]['key_value'] = substr($atom_data, $keys_atom_offset + 8, $atom_structure['keys'][$i]['key_size'] - 8);
1786-
$keys_atom_offset += $atom_structure['keys'][$i]['key_size']; // key_size includes the 4+4 bytes for key_size and key_namespace
1786+
$atom_structure['keys'][($keys_index_base + $i)]['key_size'] = getid3_lib::BigEndian2Int(substr($atom_data, $keys_atom_offset + 0, 4));
1787+
$atom_structure['keys'][($keys_index_base + $i)]['key_namespace'] = substr($atom_data, $keys_atom_offset + 4, 4);
1788+
$atom_structure['keys'][($keys_index_base + $i)]['key_value'] = substr($atom_data, $keys_atom_offset + 8, $atom_structure['keys'][($keys_index_base + $i)]['key_size'] - 8);
1789+
$keys_atom_offset += $atom_structure['keys'][($keys_index_base + $i)]['key_size']; // key_size includes the 4+4 bytes for key_size and key_namespace
17871790

1788-
$info['quicktime']['temp_meta_key_names'][$i] = $atom_structure['keys'][$i]['key_value'];
1791+
$info['quicktime']['temp_meta_key_names'][($keys_index_base + $i)] = $atom_structure['keys'][($keys_index_base + $i)]['key_value'];
17891792
}
17901793
break;
17911794

0 commit comments

Comments
 (0)