External Libraries: Update getID3 to version 1.9.22.

This updates the getID3 library from version `1.9.21` to `1.9.22`, which contains a number of bug fixes and improvements to PHP 8.1 support.

A full list of changes can be found on GitHub: https://github.com/JamesHeinrich/getID3/compare/v1.9.21...v1.9.22.

Props jrf, desrosj.
Fixes #56692.

git-svn-id: https://develop.svn.wordpress.org/trunk@54376 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2022-10-04 02:06:29 +00:00
parent 34af75d549
commit c87b90fa7b
8 changed files with 276 additions and 43 deletions
@@ -61,12 +61,16 @@ class getid3_quicktime extends getid3_handler
$this->fseek($offset);
$AtomHeader = $this->fread(8);
// https://github.com/JamesHeinrich/getID3/issues/382
// Atom sizes are stored as 32-bit number in most cases, but sometimes (notably for "mdat")
// a 64-bit value is required, in which case the normal 32-bit size field is set to 0x00000001
// and the 64-bit "real" size value is the next 8 bytes.
$atom_size_extended_bytes = 0;
$atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4));
$atomname = substr($AtomHeader, 4, 4);
// 64-bit MOV patch by jlegateØktnc*com
if ($atomsize == 1) {
$atomsize = getid3_lib::BigEndian2Int($this->fread(8));
$atom_size_extended_bytes = 8;
$atomsize = getid3_lib::BigEndian2Int($this->fread($atom_size_extended_bytes));
}
if (($offset + $atomsize) > $info['avdataend']) {
@@ -85,12 +89,14 @@ class getid3_quicktime extends getid3_handler
$info['quicktime'][$atomname]['offset'] = $offset;
break;
}
$atomHierarchy = array();
$parsedAtomData = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
$parsedAtomData = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize - $atom_size_extended_bytes, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
$parsedAtomData['name'] = $atomname;
$parsedAtomData['size'] = $atomsize;
$parsedAtomData['offset'] = $offset;
if ($atom_size_extended_bytes) {
$parsedAtomData['xsize_bytes'] = $atom_size_extended_bytes;
}
if (in_array($atomname, array('uuid'))) {
@$info['quicktime'][$atomname][] = $parsedAtomData;
} else {
@@ -108,7 +114,7 @@ class getid3_quicktime extends getid3_handler
unset($info['avdataend_tmp']);
}
if (!empty($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) {
if (isset($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) {
$durations = $this->quicktime_time_to_sample_table($info);
for ($i = 0; $i < count($info['quicktime']['comments']['chapters']); $i++) {
$bookmark = array();
@@ -259,7 +265,9 @@ class getid3_quicktime extends getid3_handler
} else {
switch ($atomname) {
case 'moov': // MOVie container atom
case 'moof': // MOvie Fragment box
case 'trak': // TRAcK container atom
case 'traf': // TRAck Fragment box
case 'clip': // CLIPping container atom
case 'matt': // track MATTe container atom
case 'edts': // EDiTS container atom
@@ -843,6 +851,7 @@ $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in
case 'dvcp':
case 'gif ':
case 'h263':
case 'hvc1':
case 'jpeg':
case 'kpcd':
case 'mjpa':
@@ -1541,6 +1550,21 @@ $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in
unset($mdat_offset, $chapter_string_length, $chapter_matches);
break;
case 'ID32': // ID3v2
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
$getid3_temp = new getID3();
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
$getid3_id3v2 = new getid3_id3v2($getid3_temp);
$getid3_id3v2->StartingOffset = $atom_structure['offset'] + 14; // framelength(4)+framename(4)+flags(4)+??(2)
if ($atom_structure['valid'] = $getid3_id3v2->Analyze()) {
$atom_structure['id3v2'] = $getid3_temp->info['id3v2'];
} else {
$this->warning('ID32 frame at offset '.$atom_structure['offset'].' did not parse');
}
unset($getid3_temp, $getid3_id3v2);
break;
case 'free': // FREE space atom
case 'skip': // SKIP atom
case 'wide': // 64-bit expansion placeholder atom
@@ -1700,7 +1724,8 @@ $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in
$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'] = @$info['quicktime']['temp_meta_key_names'][$metaDATAkey++];
$atom_structure['key_name'] = (isset($info['quicktime']['temp_meta_key_names'][$metaDATAkey]) ? $info['quicktime']['temp_meta_key_names'][$metaDATAkey] : '');
$metaDATAkey++;
if ($atom_structure['key_name'] && $atom_structure['data']) {
@$info['quicktime']['comments'][str_replace('com.apple.quicktime.', '', $atom_structure['key_name'])][] = $atom_structure['data'];
@@ -2075,6 +2100,28 @@ $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in
$atom_structure['track_number'] = getid3_lib::BigEndian2Int($atom_data);
break;
// AVIF-related - https://docs.rs/avif-parse/0.13.2/src/avif_parse/boxes.rs.html
case 'pitm': // Primary ITeM
case 'iloc': // Item LOCation
case 'iinf': // Item INFo
case 'iref': // Image REFerence
case 'iprp': // Image PRoPerties
$this->error('AVIF files not currently supported');
$atom_structure['data'] = $atom_data;
break;
case 'tfdt': // Track Fragment base media Decode Time box
case 'tfhd': // Track Fragment HeaDer box
case 'mfhd': // Movie Fragment HeaDer box
case 'trun': // Track fragment RUN box
$this->error('fragmented mp4 files not currently supported');
$atom_structure['data'] = $atom_data;
break;
case 'mvex': // MoVie EXtends box
case 'pssh': // Protection System Specific Header box
case 'sidx': // Segment InDeX box
default:
$this->warning('Unknown QuickTime atom type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" ('.trim(getid3_lib::PrintHexBytes($atomname)).'), '.$atomsize.' bytes at offset '.$baseoffset);
$atom_structure['data'] = $atom_data;
@@ -2323,6 +2370,7 @@ $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in
$QuicktimeVideoCodecLookup['gif '] = 'GIF';
$QuicktimeVideoCodecLookup['h261'] = 'H261';
$QuicktimeVideoCodecLookup['h263'] = 'H263';
$QuicktimeVideoCodecLookup['hvc1'] = 'H.265/HEVC';
$QuicktimeVideoCodecLookup['IV41'] = 'Indeo4';
$QuicktimeVideoCodecLookup['jpeg'] = 'JPEG';
$QuicktimeVideoCodecLookup['kpcd'] = 'PhotoCD';