Make WordPress Core


Ignore:
Timestamp:
07/02/2020 03:46:17 PM (6 years ago)
Author:
desrosj
Message:

External Libraries: Update getID3 to version 1.9.20.

A full list of changes in this update can be found on GitHub: https://github.com/JamesHeinrich/getID3/compare/v1.9.19...v1.9.20.

Props hareesh-pillai, desrosj.
Previously [47601-47604].
Fixes #49945.

File:
1 edited

Legend:

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

    r46586 r48278  
    1515/////////////////////////////////////////////////////////////////
    1616
     17if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers
     18    exit;
     19}
    1720
    1821define('EBML_ID_CHAPTERS',                  0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation.
     
    330333                        }
    331334
    332                         $info['video']['streams'][] = $track_info;
     335                        $info['video']['streams'][$trackarray['TrackUID']] = $track_info;
    333336                        break;
    334337
     
    363366                                $getid3_temp = new getID3();
    364367                                if ($track_info['dataformat'] != 'flac') {
    365                                     $getid3_temp->openfile($this->getid3->filename);
     368                                    $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
    366369                                }
    367370                                $getid3_temp->info['avdataoffset'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'];
     
    479482                        }
    480483
    481                         $info['audio']['streams'][] = $track_info;
     484                        $info['audio']['streams'][$trackarray['TrackUID']] = $track_info;
    482485                        break;
    483486                }
     
    508511        } elseif (isset($info['mime_type'])) {
    509512            unset($info['mime_type']);
     513        }
     514
     515        // use _STATISTICS_TAGS if available to set audio/video bitrates
     516        if (!empty($info['matroska']['tags'])) {
     517            $_STATISTICS_byTrackUID = array();
     518            foreach ($info['matroska']['tags'] as $key1 => $value1) {
     519                if (!empty($value1['Targets']['TagTrackUID'][0]) && !empty($value1['SimpleTag'])) {
     520                    foreach ($value1['SimpleTag'] as $key2 => $value2) {
     521                        if (!empty($value2['TagName']) && isset($value2['TagString'])) {
     522                            $_STATISTICS_byTrackUID[$value1['Targets']['TagTrackUID'][0]][$value2['TagName']] = $value2['TagString'];
     523                        }
     524                    }
     525                }
     526            }
     527            foreach (array('audio','video') as $avtype) {
     528                if (!empty($info[$avtype]['streams'])) {
     529                    foreach ($info[$avtype]['streams'] as $trackUID => $trackdata) {
     530                        if (!isset($trackdata['bitrate']) && !empty($_STATISTICS_byTrackUID[$trackUID]['BPS'])) {
     531                            $info[$avtype]['streams'][$trackUID]['bitrate'] = (int) $_STATISTICS_byTrackUID[$trackUID]['BPS'];
     532                            @$info[$avtype]['bitrate'] += $info[$avtype]['streams'][$trackUID]['bitrate'];
     533                        }
     534                    }
     535                }
     536            }
    510537        }
    511538
     
    615642                                                switch ($subelement['id']) {
    616643
     644                                                    case EBML_ID_TRACKUID:
     645                                                        $track_entry[$subelement['id_name']] = getid3_lib::PrintHexBytes($subelement['data'], true, false);
     646                                                        break;
    617647                                                    case EBML_ID_TRACKNUMBER:
    618                                                     case EBML_ID_TRACKUID:
    619648                                                    case EBML_ID_TRACKTYPE:
    620649                                                    case EBML_ID_MINCACHE:
     
    964993                                                                case EBML_ID_TAGCHAPTERUID:
    965994                                                                case EBML_ID_TAGATTACHMENTUID:
    966                                                                     $targets_entry[$sub_sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
     995                                                                    $targets_entry[$sub_sub_subelement['id_name']][] = getid3_lib::PrintHexBytes($sub_sub_subelement['data'], true, false);
    967996                                                                    break;
    968997
Note: See TracChangeset for help on using the changeset viewer.