Make WordPress Core


Ignore:
Timestamp:
10/04/2022 02:06:29 AM (3 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.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
Note: See TracChangeset for help on using the changeset viewer.