Skip to content

Commit 08a8614

Browse files
committed
Quicktime add "sgpd", "sbgp" atoms
1 parent 164c78b commit 08a8614

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
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-202510150944';
390+
const VERSION = '1.9.24-202510150953';
391391
const FREAD_BUFFER_SIZE = 32768;
392392

393393
const ATTACHMENTS_NONE = false;

getid3/module.audio-video.quicktime.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,34 @@ public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset
22342234
$esds_offset += $atom_structure['ES_SLConfigDescrTagSize'];
22352235
break;
22362236

2237+
case 'sgpd': // https://developer.apple.com/documentation/quicktime-file-format/sample_group_description_atom
2238+
$atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); // hardcoded: 0x00
2239+
$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x000000
2240+
$sgpd_offset = 4;
2241+
2242+
$atom_structure['grouping_type'] = getid3_lib::BigEndian2Int(substr($atom_data, $sgpd_offset, 4));
2243+
$sgpd_offset += 4;
2244+
$atom_structure['default_length'] = getid3_lib::BigEndian2Int(substr($atom_data, $sgpd_offset, 4));
2245+
$sgpd_offset += 4;
2246+
$atom_structure['entry_count'] = getid3_lib::BigEndian2Int(substr($atom_data, $sgpd_offset, 4));
2247+
$sgpd_offset += 4;
2248+
$atom_structure['payload_data_raw'] = substr($atom_data, $sgpd_offset);
2249+
break;
2250+
2251+
case 'sbgp': // https://developer.apple.com/documentation/quicktime-file-format/sample-to-group_atom
2252+
$atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); // hardcoded: 0x00
2253+
$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x000000
2254+
$sbgp_offset = 4;
2255+
2256+
$atom_structure['grouping_type'] = getid3_lib::BigEndian2Int(substr($atom_data, $sbgp_offset, 4));
2257+
$sbgp_offset += 4;
2258+
$atom_structure['default_length'] = getid3_lib::BigEndian2Int(substr($atom_data, $sbgp_offset, 4));
2259+
$sbgp_offset += 4;
2260+
$atom_structure['entry_count'] = getid3_lib::BigEndian2Int(substr($atom_data, $sbgp_offset, 4));
2261+
$sbgp_offset += 4;
2262+
$atom_structure['table_data_raw'] = substr($atom_data, $sbgp_offset);
2263+
break;
2264+
22372265
// AVIF-related - https://docs.rs/avif-parse/0.13.2/src/avif_parse/boxes.rs.html
22382266
case 'pitm': // Primary ITeM
22392267
case 'iloc': // Item LOCation

0 commit comments

Comments
 (0)