Make WordPress Core


Ignore:
Timestamp:
10/04/2022 02:06:29 AM (4 years ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ID3/module.audio-video.quicktime.php

    r52254 r54376  
    6262                        $AtomHeader = $this->fread(8);
    6363
     64                        // https://github.com/JamesHeinrich/getID3/issues/382
     65                        // Atom sizes are stored as 32-bit number in most cases, but sometimes (notably for "mdat")
     66                        // a 64-bit value is required, in which case the normal 32-bit size field is set to 0x00000001
     67                        // and the 64-bit "real" size value is the next 8 bytes.
     68                        $atom_size_extended_bytes = 0;
    6469                        $atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4));
    6570                        $atomname = substr($AtomHeader, 4, 4);
    66 
    67                         // 64-bit MOV patch by jlegateØktnc*com
    6871                        if ($atomsize == 1) {
    69                                 $atomsize = getid3_lib::BigEndian2Int($this->fread(8));
     72                                $atom_size_extended_bytes = 8;
     73                                $atomsize = getid3_lib::BigEndian2Int($this->fread($atom_size_extended_bytes));
    7074                        }
    7175
     
    8690                                break;
    8791                        }
    88 
    8992                        $atomHierarchy = array();
    90                         $parsedAtomData = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
     93                        $parsedAtomData = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize - $atom_size_extended_bytes, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
    9194                        $parsedAtomData['name']   = $atomname;
    9295                        $parsedAtomData['size']   = $atomsize;
    9396                        $parsedAtomData['offset'] = $offset;
     97                        if ($atom_size_extended_bytes) {
     98                                $parsedAtomData['xsize_bytes'] = $atom_size_extended_bytes;
     99                        }
    94100                        if (in_array($atomname, array('uuid'))) {
    95101                                @$info['quicktime'][$atomname][] = $parsedAtomData;
     
    109115                }
    110116
    111                 if (!empty($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) {
     117                if (isset($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) {
    112118                        $durations = $this->quicktime_time_to_sample_table($info);
    113119                        for ($i = 0; $i < count($info['quicktime']['comments']['chapters']); $i++) {
     
    260266                        switch ($atomname) {
    261267                                case 'moov': // MOVie container atom
     268                                case 'moof': // MOvie Fragment box
    262269                                case 'trak': // TRAcK container atom
     270                                case 'traf': // TRAck Fragment box
    263271                                case 'clip': // CLIPping container atom
    264272                                case 'matt': // track MATTe container atom
     
    844852                                                                        case 'gif ':
    845853                                                                        case 'h263':
     854                                                                        case 'hvc1':
    846855                                                                        case 'jpeg':
    847856                                                                        case 'kpcd':
     
    15421551                                        break;
    15431552
     1553                                case 'ID32': // ID3v2
     1554                                        getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
     1555
     1556                                        $getid3_temp = new getID3();
     1557                                        $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
     1558                                        $getid3_id3v2 = new getid3_id3v2($getid3_temp);
     1559                                        $getid3_id3v2->StartingOffset = $atom_structure['offset'] + 14; // framelength(4)+framename(4)+flags(4)+??(2)
     1560                                        if ($atom_structure['valid'] = $getid3_id3v2->Analyze()) {
     1561                                                $atom_structure['id3v2'] = $getid3_temp->info['id3v2'];
     1562                                        } else {
     1563                                                $this->warning('ID32 frame at offset '.$atom_structure['offset'].' did not parse');
     1564                                        }
     1565                                        unset($getid3_temp, $getid3_id3v2);
     1566                                        break;
     1567
    15441568                                case 'free': // FREE space atom
    15451569                                case 'skip': // SKIP atom
     
    17011725                                        $atom_structure['unknown']  = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2));
    17021726                                        $atom_structure['data']     =                           substr($atom_data, 4 + 4);
    1703                                         $atom_structure['key_name'] = @$info['quicktime']['temp_meta_key_names'][$metaDATAkey++];
     1727                                        $atom_structure['key_name'] = (isset($info['quicktime']['temp_meta_key_names'][$metaDATAkey]) ? $info['quicktime']['temp_meta_key_names'][$metaDATAkey] : '');
     1728                                        $metaDATAkey++;
    17041729
    17051730                                        if ($atom_structure['key_name'] && $atom_structure['data']) {
     
    20762101                                        break;
    20772102
     2103
     2104// AVIF-related - https://docs.rs/avif-parse/0.13.2/src/avif_parse/boxes.rs.html
     2105                                case 'pitm': // Primary ITeM
     2106                                case 'iloc': // Item LOCation
     2107                                case 'iinf': // Item INFo
     2108                                case 'iref': // Image REFerence
     2109                                case 'iprp': // Image PRoPerties
     2110$this->error('AVIF files not currently supported');
     2111                                        $atom_structure['data'] = $atom_data;
     2112                                        break;
     2113
     2114                                case 'tfdt': // Track Fragment base media Decode Time box
     2115                                case 'tfhd': // Track Fragment HeaDer box
     2116                                case 'mfhd': // Movie Fragment HeaDer box
     2117                                case 'trun': // Track fragment RUN box
     2118$this->error('fragmented mp4 files not currently supported');
     2119                                        $atom_structure['data'] = $atom_data;
     2120                                        break;
     2121
     2122                                case 'mvex': // MoVie EXtends box
     2123                                case 'pssh': // Protection System Specific Header box
     2124                                case 'sidx': // Segment InDeX box
    20782125                                default:
    20792126                                        $this->warning('Unknown QuickTime atom type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" ('.trim(getid3_lib::PrintHexBytes($atomname)).'), '.$atomsize.' bytes at offset '.$baseoffset);
     
    23242371                        $QuicktimeVideoCodecLookup['h261'] = 'H261';
    23252372                        $QuicktimeVideoCodecLookup['h263'] = 'H263';
     2373                        $QuicktimeVideoCodecLookup['hvc1'] = 'H.265/HEVC';
    23262374                        $QuicktimeVideoCodecLookup['IV41'] = 'Indeo4';
    23272375                        $QuicktimeVideoCodecLookup['jpeg'] = 'JPEG';
Note: See TracChangeset for help on using the changeset viewer.