getid3_matroska
- Source
wp-includes/ID3/module.audio-video.matroska.php:219
Compatibility
- WordPress
- core
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 7
$hide_clustersboolpublic- If true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE].
$parse_whole_fileboolpublic- True to parse the whole file, not only header [default: FALSE].
$EBMLbufferprivate$EBMLbuffer_offsetprivate$EBMLbuffer_lengthprivate$current_offsetprivate$unuseful_elementsprivate
Methods · 18
- Analyze()
- parseEBML()
- EnsureBufferHasEnoughData()
- readEBMLint()
- readEBMLelementData()
- getEBMLelement()
- unhandledElement()
- ExtractCommentsSimpleTag()
- HandleEMBLSimpleTag()
- HandleEMBLClusterBlock()
- EBML2Int()
- EBMLdate2unix()
- TargetTypeValue()
- BlockLacingType()
- CodecIDtoCommonName()
- EBMLidName()
- displayUnit()
- getDefaultStreamInfo()
Source code
class getid3_matroska extends getid3_handler{ /** * If true, do not return information about CLUSTER chunks, since there's a lot of them * and they're not usually useful [default: TRUE]. * * @var bool */ public $hide_clusters = true; /** * True to parse the whole file, not only header [default: FALSE]. * * @var bool */ public $parse_whole_file = false; /* * Private parser settings/placeholders. */ private $EBMLbuffer = ''; private $EBMLbuffer_offset = 0; private $EBMLbuffer_length = 0; private $current_offset = 0; private $unuseful_elements = array(EBML_ID_CRC32, EBML_ID_VOID); /** * @return bool */ public function Analyze() { $info = &$this->getid3->info; // parse container try { $this->parseEBML($info); } catch (Exception $e) { $this->error('EBML parser: '.$e->getMessage()); } // calculate playtime if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) { foreach ($info['matroska']['info'] as $key => $infoarray) { if (isset($infoarray['Duration'])) { // TimecodeScale is how many nanoseconds each Duration unit is $info['playtime_seconds'] = $infoarray['Duration'] * ((isset($infoarray['TimecodeScale']) ? $infoarray['TimecodeScale'] : 1000000) / 1000000000); break; } } } // extract tags if (isset($info['matroska']['tags']) && is_array($info['matroska']['tags'])) { foreach ($info['matroska']['tags'] as $key => $infoarray) { $this->ExtractCommentsSimpleTag($infoarray); } } // process tracks if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { foreach ($info['matroska']['tracks']['tracks'] as $key => $trackarray) { $track_info = array(); $track_info['dataformat'] = self::CodecIDtoCommonName($trackarray['CodecID']); $track_info['default'] = (isset($trackarray['FlagDefault']) ? $trackarray['FlagDefault'] : true); if (isset($trackarray['Name'])) { $track_info['name'] = $trackarray['Name']; } switch ($trackarray['TrackType']) { case 1: // Video $track_info['resolution_x'] = $trackarray['PixelWidth']; $track_info['resolution_y'] = $trackarray['PixelHeight']; $track_info['display_unit'] = self::displayUnit(isset($trackarray['DisplayUnit']) ? $trackarray['DisplayUnit'] : 0); $track_info['display_x'] = (isset($trackarray['DisplayWidth']) ? $trackarray['DisplayWidth'] : $trackarray['PixelWidth']); $track_info['display_y'] = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']); if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; } if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; }Changelog
5 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
7.0.4
Method
playtimeFromMetadata() added.verified against source7.0.4
Method
resetParserBuffer() added.verified against source7.0.4
Method
scanStartEndForClusters() added.verified against source7.0.4
Method
getTimecodeScale() added.verified against source7.0.4
Method
calculatePlaytimeFromClusters() added.verified against sourceAbout this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/ID3/module.audio-video.matroska.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.