getid3_matroska
- Source
wp-includes/ID3/module.audio-video.matroska.php:232
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 · 8
$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$scan_modeprivate
Methods · 23
- Analyze()
- parseEBML()
- EnsureBufferHasEnoughData()
- readEBMLint()
- readEBMLelementData()
- getEBMLelement()
- unhandledElement()
- ExtractCommentsSimpleTag()
- HandleEMBLSimpleTag()
- HandleEMBLClusterBlock()
- EBML2Int()
- EBMLdate2unix()
- TargetTypeValue()
- BlockLacingType()
- CodecIDtoCommonName()
- EBMLidName()
- displayUnit()
- getDefaultStreamInfo()
- playtimeFromMetadata()
- resetParserBuffer()
- scanStartEndForClusters()Scan start and end of file for cluster information when Duration is missing Only use this if no Duration was found in the Info element and we are not in parse_whole_file mode
- getTimecodeScale()Fetch TimecodeScale from Info element
- calculatePlaytimeFromClusters()Calculate duration from scanned cluster timecodes
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); private $scan_mode = MATROSKA_SCAN_HEADER; /** * @return bool */ public function Analyze() { $info = &$this->getid3->info; $this->scan_mode = $this->parse_whole_file ? MATROSKA_SCAN_WHOLE_FILE : MATROSKA_SCAN_HEADER; // parse container try { $this->parseEBML($info); } catch (Exception $e) { $this->error('EBML parser: '.$e->getMessage()); } $this->playtimeFromMetadata($info); // If there was no duration metadata, this might be an incomplete file or a streaming file // We need Cluster information so we can use their timecodes to estimate playtime. if (!isset($info['playtime_seconds']) && !$this->parse_whole_file) { // Scan the start and end of file for Clusters to estimate duration $this->scanStartEndForClusters($info); } if (isset($info['matroska']['cluster']) && is_array($info['matroska']['cluster'])) { if (!isset($info['playtime_seconds']) && !empty($info['matroska']['cluster'])) { // estimate playtime using clusters if not yet known $this->calculatePlaytimeFromClusters($info); } // Remove cluster information from output if hide_clusters is true // These could have been set during scanStartEndForClusters() if ($this->hide_clusters) { unset($info['matroska']['cluster']); } } // 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']; }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 7.1.0 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.