Make WordPress Core

Changeset 54376


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.

Location:
trunk/src/wp-includes/ID3
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ID3/getid3.lib.php

    r52254 r54376  
    1212/////////////////////////////////////////////////////////////////
    1313
     14if(!defined('GETID3_LIBXML_OPTIONS') && defined('LIBXML_VERSION')) {
     15        if(LIBXML_VERSION >= 20621) {
     16                define('GETID3_LIBXML_OPTIONS', LIBXML_NOENT | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_COMPACT);
     17        } else {
     18                define('GETID3_LIBXML_OPTIONS', LIBXML_NOENT | LIBXML_NONET | LIBXML_NOWARNING);
     19        }
     20}
    1421
    1522class getid3_lib
    … …  
    304311                } elseif (($exponent == 0) && ($fraction == 0)) {
    305312                        if ($signbit == '1') {
    306                                 $floatvalue = -0;
     313                                $floatvalue = -0.0;
    307314                        } else {
    308                                 $floatvalue = 0;
    309                         }
    310                         $floatvalue = ($signbit ? 0 : -0);
     315                                $floatvalue = 0.0;
     316                        }
    311317                } elseif (($exponent == 0) && ($fraction != 0)) {
    312318                        // These are 'unnormalized' values
    … …  
    733739                        // disabled by default, but is still needed when LIBXML_NOENT is used.
    734740                        $loader = @libxml_disable_entity_loader(true);
    735                         $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', LIBXML_NOENT);
     741                        $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', GETID3_LIBXML_OPTIONS);
    736742                        $return = self::SimpleXMLelement2array($XMLobject);
    737743                        @libxml_disable_entity_loader($loader);
  • trunk/src/wp-includes/ID3/getid3.php

    r52254 r54376  
    183183
    184184        /**
    185          * Use MD5 of source file if availble - only FLAC and OptimFROG
     185         * Use MD5 of source file if available - only FLAC and OptimFROG
    186186         *
    187187         * @var bool
    … …  
    388388        protected $startup_warning = '';
    389389
    390         const VERSION           = '1.9.21-202109171300';
     390        const VERSION           = '1.9.22-202207161647';
    391391        const FREAD_BUFFER_SIZE = 32768;
    392392
    … …  
    394394        const ATTACHMENTS_INLINE = true;
    395395
     396        /**
     397         * @throws getid3_exception
     398         */
    396399        public function __construct() {
    397400
    … …  
    570573
    571574                        // remote files not supported
    572                         if (preg_match('#^(ht|f)tp://#', $filename)) {
     575                        if (preg_match('#^(ht|f)tps?://#', $filename)) {
    573576                                throw new getid3_exception('Remote files are not supported - please copy the file locally first');
    574577                        }
    … …  
    10561059                                                ),
    10571060
    1058 // has been known to produce false matches in random files (e.g. JPEGs), leave out until more precise matching available
    1059 //                              // MOD  - audio       - MODule (assorted sub-formats)
    1060 //                              'mod'  => array(
    1061 //                                                      'pattern'   => '^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)',
    1062 //                                                      'group'     => 'audio',
    1063 //                                                      'module'    => 'mod',
    1064 //                                                      'option'    => 'mod',
    1065 //                                                      'mime_type' => 'audio/mod',
    1066 //                                              ),
     1061
     1062                                // MOD  - audio       - MODule (SoundTracker)
     1063                                'mod'  => array(
     1064                                                        //'pattern'   => '^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)', // has been known to produce false matches in random files (e.g. JPEGs), leave out until more precise matching available
     1065                                                        'pattern'   => '^.{1080}(M\\.K\\.)',
     1066                                                        'group'     => 'audio',
     1067                                                        'module'    => 'mod',
     1068                                                        'option'    => 'mod',
     1069                                                        'mime_type' => 'audio/mod',
     1070                                                ),
    10671071
    10681072                                // MOD  - audio       - MODule (Impulse Tracker)
    … …  
    10951099                                // MPC  - audio       - Musepack / MPEGplus
    10961100                                'mpc'  => array(
    1097                                                         'pattern'   => '^(MPCK|MP\\+|[\\x00\\x01\\x10\\x11\\x40\\x41\\x50\\x51\\x80\\x81\\x90\\x91\\xC0\\xC1\\xD0\\xD1][\\x20-\\x37][\\x00\\x20\\x40\\x60\\x80\\xA0\\xC0\\xE0])',
     1101                                                        'pattern'   => '^(MPCK|MP\\+)',
    10981102                                                        'group'     => 'audio',
    10991103                                                        'module'    => 'mpc',
    … …  
    15501554                        $GetFileFormatArray = $this->GetFileFormatArray();
    15511555                        $info = $GetFileFormatArray['mp3'];
     1556                        $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
     1557                        return $info;
     1558                } elseif (preg_match('#\\.mp[cp\\+]$#i', $filename) && preg_match('#[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0]#s', $filedata)) {
     1559                        // old-format (SV4-SV6) Musepack header that has a very loose pattern match and could falsely match other data (e.g. corrupt mp3)
     1560                        // only enable this pattern check if the filename ends in .mpc/mpp/mp+
     1561                        $GetFileFormatArray = $this->GetFileFormatArray();
     1562                        $info = $GetFileFormatArray['mpc'];
    15521563                        $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
    15531564                        return $info;
    … …  
    21992210                        return substr($this->data_string, $this->data_string_position - $bytes, $bytes);
    22002211                }
     2212                if ($bytes == 0) {
     2213                        return '';
     2214                } elseif ($bytes < 0) {
     2215                        throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().')', 10);
     2216                }
    22012217                $pos = $this->ftell() + $bytes;
    22022218                if (!getid3_lib::intValueSupported($pos)) {
  • trunk/src/wp-includes/ID3/module.audio-video.asf.php

    r52254 r54376  
    2121class getid3_asf extends getid3_handler
    2222{
     23        protected static $ASFIndexParametersObjectIndexSpecifiersIndexTypes = array(
     24                1 => 'Nearest Past Data Packet',
     25                2 => 'Nearest Past Media Object',
     26                3 => 'Nearest Past Cleanpoint'
     27        );
     28
     29        protected static $ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes = array(
     30                1 => 'Nearest Past Data Packet',
     31                2 => 'Nearest Past Media Object',
     32                3 => 'Nearest Past Cleanpoint',
     33                0xFF => 'Frame Number Offset'
     34        );
     35
     36        protected static $ASFTimecodeIndexParametersObjectIndexSpecifiersIndexTypes = array(
     37                2 => 'Nearest Past Media Object',
     38                3 => 'Nearest Past Cleanpoint'
     39        );
     40
    2341        /**
    2442         * @param getID3 $getid3
    … …  
    318336                                        // shortcut
    319337                                        $thisfile_asf['codec_list_object'] = array();
     338                                        /** @var mixed[] $thisfile_asf_codeclistobject */
    320339                                        $thisfile_asf_codeclistobject      = &$thisfile_asf['codec_list_object'];
    321340
    … …  
    333352                                        }
    334353                                        $thisfile_asf_codeclistobject['codec_entries_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
     354                                        if ($thisfile_asf_codeclistobject['codec_entries_count'] > 0) {
     355                                                $thisfile_asf_codeclistobject['codec_entries'] = array();
     356                                        }
    335357                                        $offset += 4;
    336358                                        for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) {
    … …  
    529551                                        $thisfile_asf_markerobject['reserved_guid']        = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']);
    530552                                        if ($thisfile_asf_markerobject['reserved'] != $this->GUIDtoBytestring('4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) {
    531                                                 $this->warning('marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved_1']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}');
     553                                                $this->warning('marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}');
    532554                                                break;
    533555                                        }
    … …  
    649671
    650672                                                default:
    651                                                         $this->warning('error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject['reserved']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or  "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}');
     673                                                        $this->warning('error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject['error_correction_type']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or  "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}');
    652674                                                        //return false;
    653675                                                        break;
    … …  
    14431465                        }
    14441466                }
    1445                 $info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0);
     1467                $info['bitrate'] = 0 + (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0);
    14461468
    14471469                if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) {
    … …  
    15781600                        'GETID3_ASF_Media_Object_Index_Object'           => 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C',
    15791601                        'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' => 'FF889EF1-ADEE-40DA-9E71-98704BB928CE',
    1580                         'GETID3_ASF_Index_Placeholder_Object'            => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html
    1581                         'GETID3_ASF_Compatibility_Object'                => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html
     1602                        'GETID3_ASF_Index_Placeholder_Object'            => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', // https://metacpan.org/dist/Audio-WMA/source/WMA.pm
     1603                        'GETID3_ASF_Compatibility_Object'                => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', // https://metacpan.org/dist/Audio-WMA/source/WMA.pm
     1604                        'GETID3_ASF_Media_Object_Index_Parameters_Object'=> '6B203BAD-3F11-48E4-ACA8-D7613DE2CFA7',
    15821605                );
    15831606                return $GUIDarray;
    … …  
    17421765         */
    17431766        public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
    1744                 // http://msdn.microsoft.com/en-us/library/bb643323.aspx
     1767                // https://web.archive.org/web/20140419205228/http://msdn.microsoft.com/en-us/library/bb643323.aspx
    17451768
    17461769                $offset = 0;
    … …  
    18061829                                        $offset += 2;
    18071830
    1808                                         $thisObject['average_time_per_frame']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
    1809                                         $offset += 4;
     1831                                        $thisObject['average_time_per_frame']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
     1832                                        $offset += 8;
    18101833
    18111834                                        $thisObject['stream_name_count']                 = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
    … …  
    18241847                                                $offset += 2;
    18251848
    1826                                                 $streamName['stream_name']                   = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  $streamName['stream_name_length']));
     1849                                                $streamName['stream_name']                   =                              substr($asf_header_extension_object_data, $offset,  $streamName['stream_name_length']);
    18271850                                                $offset += $streamName['stream_name_length'];
    18281851
    … …  
    18461869                                                $offset += 4;
    18471870
    1848                                                 $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  $payloadExtensionSystem['extension_system_info_length']));
     1871                                                $payloadExtensionSystem['extension_system_info'] = substr($asf_header_extension_object_data, $offset,  $payloadExtensionSystem['extension_system_info_length']);
    18491872                                                $offset += $payloadExtensionSystem['extension_system_info_length'];
    18501873
    18511874                                                $thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem;
     1875                                        }
     1876
     1877                                        break;
     1878
     1879                                case GETID3_ASF_Advanced_Mutual_Exclusion_Object:
     1880                                        $thisObject['exclusion_type']       = substr($asf_header_extension_object_data, $offset, 16);
     1881                                        $offset += 16;
     1882                                        $thisObject['exclusion_type_text']  = $this->BytestringToGUID($thisObject['exclusion_type']);
     1883
     1884                                        $thisObject['stream_numbers_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
     1885                                        $offset += 2;
     1886
     1887                                        for ($i = 0; $i < $thisObject['stream_numbers_count']; $i++) {
     1888                                                $thisObject['stream_numbers'][$i] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
     1889                                                $offset += 2;
     1890                                        }
     1891
     1892                                        break;
     1893
     1894                                case GETID3_ASF_Stream_Prioritization_Object:
     1895                                        $thisObject['priority_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
     1896                                        $offset += 2;
     1897
     1898                                        for ($i = 0; $i < $thisObject['priority_records_count']; $i++) {
     1899                                                $priorityRecord = array();
     1900
     1901                                                $priorityRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
     1902                                                $offset += 2;
     1903
     1904                                                $priorityRecord['flags_raw']     = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     1905                                                $offset += 2;
     1906                                                $priorityRecord['flags']['mandatory'] = (bool) $priorityRecord['flags_raw'] & 0x00000001;
     1907
     1908                                                $thisObject['priority_records'][$i] = $priorityRecord;
    18521909                                        }
    18531910
    … …  
    19692026                                                $thisObject['description_record'][$i] = $descriptionRecord;
    19702027                                        }
     2028                                        break;
     2029
     2030                                case GETID3_ASF_Index_Parameters_Object:
     2031                                        $thisObject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
     2032                                        $offset += 4;
     2033
     2034                                        $thisObject['index_specifiers_count']    = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2035                                        $offset += 2;
     2036
     2037                                        for ($i = 0; $i < $thisObject['index_specifiers_count']; $i++) {
     2038                                                $indexSpecifier = array();
     2039
     2040                                                $indexSpecifier['stream_number']   = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2041                                                $offset += 2;
     2042
     2043                                                $indexSpecifier['index_type']      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2044                                                $offset += 2;
     2045                                                $indexSpecifier['index_type_text'] = isset(static::$ASFIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']])
     2046                                                        ? static::$ASFIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']]
     2047                                                        : 'invalid'
     2048                                                ;
     2049
     2050                                                $thisObject['index_specifiers'][$i] = $indexSpecifier;
     2051                                        }
     2052
     2053                                        break;
     2054
     2055                                case GETID3_ASF_Media_Object_Index_Parameters_Object:
     2056                                        $thisObject['index_entry_count_interval'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
     2057                                        $offset += 4;
     2058
     2059                                        $thisObject['index_specifiers_count']     = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2060                                        $offset += 2;
     2061
     2062                                        for ($i = 0; $i < $thisObject['index_specifiers_count']; $i++) {
     2063                                                $indexSpecifier = array();
     2064
     2065                                                $indexSpecifier['stream_number']   = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2066                                                $offset += 2;
     2067
     2068                                                $indexSpecifier['index_type']      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2069                                                $offset += 2;
     2070                                                $indexSpecifier['index_type_text'] = isset(static::$ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']])
     2071                                                        ? static::$ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']]
     2072                                                        : 'invalid'
     2073                                                ;
     2074
     2075                                                $thisObject['index_specifiers'][$i] = $indexSpecifier;
     2076                                        }
     2077
     2078                                        break;
     2079
     2080                                case GETID3_ASF_Timecode_Index_Parameters_Object:
     2081                                        // 4.11 Timecode Index Parameters Object (mandatory only if TIMECODE index is present in file, 0 or 1)
     2082                                        // Field name                     Field type   Size (bits)
     2083                                        // Object ID                      GUID         128             // GUID for the Timecode Index Parameters Object - ASF_Timecode_Index_Parameters_Object
     2084                                        // Object Size                    QWORD        64              // Specifies the size, in bytes, of the Timecode Index Parameters Object. Valid values are at least 34 bytes.
     2085                                        // Index Entry Count Interval     DWORD        32              // This value is ignored for the Timecode Index Parameters Object.
     2086                                        // Index Specifiers Count         WORD         16              // Specifies the number of entries in the Index Specifiers list. Valid values are 1 and greater.
     2087                                        // Index Specifiers               array of:    varies          //
     2088                                        // * Stream Number                WORD         16              // Specifies the stream number that the Index Specifiers refer to. Valid values are between 1 and 127.
     2089                                        // * Index Type                   WORD         16              // Specifies the type of index. Values are defined as follows (1 is not a valid value):
     2090                                                                                                       // 2 = Nearest Past Media Object - indexes point to the closest data packet containing an entire video frame or the first fragment of a video frame
     2091                                                                                                       // 3 = Nearest Past Cleanpoint - indexes point to the closest data packet containing an entire video frame (or first fragment of a video frame) that is a key frame.
     2092                                                                                                       // Nearest Past Media Object is the most common value
     2093
     2094                                        $thisObject['index_entry_count_interval'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
     2095                                        $offset += 4;
     2096
     2097                                        $thisObject['index_specifiers_count']     = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2098                                        $offset += 2;
     2099
     2100                                        for ($i = 0; $i < $thisObject['index_specifiers_count']; $i++) {
     2101                                                $indexSpecifier = array();
     2102
     2103                                                $indexSpecifier['stream_number']   = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2104                                                $offset += 2;
     2105
     2106                                                $indexSpecifier['index_type']      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
     2107                                                $offset += 2;
     2108                                                $indexSpecifier['index_type_text'] = isset(static::$ASFTimecodeIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']])
     2109                                                        ? static::$ASFTimecodeIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']]
     2110                                                        : 'invalid'
     2111                                                ;
     2112
     2113                                                $thisObject['index_specifiers'][$i] = $indexSpecifier;
     2114                                        }
     2115
     2116                                        break;
     2117
     2118                                case GETID3_ASF_Compatibility_Object:
     2119                                        $thisObject['profile'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1));
     2120                                        $offset += 1;
     2121
     2122                                        $thisObject['mode']    = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1));
     2123                                        $offset += 1;
     2124
    19712125                                        break;
    19722126
  • 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';
  • trunk/src/wp-includes/ID3/module.audio-video.riff.php

    r52254 r54376  
    809809                                                                        $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'];
    810810
     811                                                                        if (!isset($thisfile_riff_raw['strf'][$strhfccType][$streamindex])) {
     812                                                                                $thisfile_riff_raw['strf'][$strhfccType][$streamindex] = null;
     813                                                                        }
    811814                                                                        // shortcut
    812815                                                                        $thisfile_riff_raw_strf_strhfccType_streamindex = &$thisfile_riff_raw['strf'][$strhfccType][$streamindex];
    … …  
    13541357                        $info['playtime_seconds'] = 0;
    13551358                }
    1356                 if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) {
     1359                if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { // @phpstan-ignore-line
    13571360                        // needed for >2GB AVIs where 'avih' chunk only lists number of frames in that chunk, not entire movie
    13581361                        $info['playtime_seconds'] = $thisfile_riff_raw['strh'][0]['dwLength'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
    1359                 } elseif (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) {
     1362                } elseif (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { // @phpstan-ignore-line
    13601363                        $info['playtime_seconds'] = $thisfile_riff_raw['avih']['dwTotalFrames'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
    13611364                }
    … …  
    15801583                $info = &$this->getid3->info;
    15811584
    1582                 $RIFFchunk = false;
     1585                $RIFFchunk = array();
    15831586                $FoundAllChunksWeNeed = false;
    15841587                $LISTchunkParent = null;
    … …  
    19351938                }
    19361939
    1937                 return $RIFFchunk;
     1940                return !empty($RIFFchunk) ? $RIFFchunk : false;
    19381941        }
    19391942
  • trunk/src/wp-includes/ID3/module.audio.mp3.php

    r52254 r54376  
    316316                }
    317317
     318                if (isset($thisfile_mpeg_audio['bitrate']) && $thisfile_mpeg_audio['bitrate'] === 'free') {
     319                        $encoder_options .= ' --freeformat';
     320                }
     321
    318322                if (!empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || !empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) {
    319323                        $encoder_options .= ' --nogap';
    … …  
    751755
    752756                                                        // It the LAME tag was only introduced in LAME v3.90
    753                                                         // http://www.hydrogenaudio.org/?act=ST&f=15&t=9933
     757                                                        // https://wiki.hydrogenaud.io/index.php/LAME#VBR_header_and_LAME_tag
     758                                                        // https://hydrogenaud.io/index.php?topic=9933
    754759
    755760                                                        // Offsets of various bytes in http://gabriel.mp3-tech.org/mp3infotag.html
    … …  
    787792
    788793                                                        // bytes $A7-$AE  Replay Gain
    789                                                         // http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html
     794                                                        // https://web.archive.org/web/20021015212753/http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html
    790795                                                        // bytes $A7-$AA : 32 bit floating point "Peak signal amplitude"
    791796                                                        if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.94b') {
    … …  
    915920
    916921                                                        // LAME CBR
    917                                                         if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) {
     922                                                        if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1 && $thisfile_mpeg_audio['bitrate'] !== 'free') {
    918923
    919924                                                                $thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
    … …  
    11701175                        $nextframetestarray = array('error' => array(), 'warning' => array(), 'avdataend' => $info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
    11711176                        if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) {
     1177                                /** @phpstan-ignore-next-line */
    11721178                                getid3_lib::safe_inc($info['mp3_validity_check_bitrates'][$nextframetestarray['mpeg']['audio']['bitrate']]);
    11731179                                if ($ScanAsCBR) {
  • trunk/src/wp-includes/ID3/module.audio.ogg.php

    r52254 r54376  
    187187                                $info['video']['pixel_aspect_ratio'] = (float) $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] / $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'];
    188188                        }
    189                         $this->warning('Ogg Theora (v3) not fully supported in this version of getID3 ['.$this->getid3->version().'] -- bitrate, playtime and all audio data are currently unavailable');
     189$this->warning('Ogg Theora (v3) not fully supported in this version of getID3 ['.$this->getid3->version().'] -- bitrate, playtime and all audio data are currently unavailable');
    190190
    191191
  • trunk/src/wp-includes/ID3/module.tag.id3v2.php

    r52254 r54376  
    20652065                                                        break;
    20662066                                                case 'WXXX':
    2067                                                         list($subframe['chapter_url_description'], $subframe['chapter_url']) = explode("\x00", $encoding_converted_text, 2);
     2067                                                        @list($subframe['chapter_url_description'], $subframe['chapter_url']) = explode("\x00", $encoding_converted_text, 2);
    20682068                                                        $parsedFrame['chapter_url'][$subframe['chapter_url_description']] = $subframe['chapter_url'];
    20692069                                                        $parsedFrame['subframes'][] = $subframe;
Note: See TracChangeset for help on using the changeset viewer.