--- a/wp/wp-includes/ID3/module.audio.dts.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/ID3/module.audio.dts.php Tue Dec 15 13:49:49 2020 +0100
@@ -1,11 +1,11 @@
<?php
+
/////////////////////////////////////////////////////////////////
/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-// also https://github.com/JamesHeinrich/getID3 //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
+// available at https://github.com/JamesHeinrich/getID3 //
+// or https://www.getid3.org //
+// or http://getid3.sourceforge.net //
+// see readme.txt for more details //
/////////////////////////////////////////////////////////////////
// //
// module.audio.dts.php //
@@ -14,6 +14,9 @@
// //
/////////////////////////////////////////////////////////////////
+if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers
+ exit;
+}
/**
* @tutorial http://wiki.multimedia.cx/index.php?title=DTS
@@ -21,21 +24,27 @@
class getid3_dts extends getid3_handler
{
/**
- * Default DTS syncword used in native .cpt or .dts formats
- */
- const syncword = "\x7F\xFE\x80\x01";
+ * Default DTS syncword used in native .cpt or .dts formats.
+ */
+ const syncword = "\x7F\xFE\x80\x01";
+ /**
+ * @var int
+ */
private $readBinDataOffset = 0;
- /**
- * Possible syncwords indicating bitstream encoding
- */
- public static $syncwords = array(
- 0 => "\x7F\xFE\x80\x01", // raw big-endian
- 1 => "\xFE\x7F\x01\x80", // raw little-endian
- 2 => "\x1F\xFF\xE8\x00", // 14-bit big-endian
- 3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian
+ /**
+ * Possible syncwords indicating bitstream encoding.
+ */
+ public static $syncwords = array(
+ 0 => "\x7F\xFE\x80\x01", // raw big-endian
+ 1 => "\xFE\x7F\x01\x80", // raw little-endian
+ 2 => "\x1F\xFF\xE8\x00", // 14-bit big-endian
+ 3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian
+ /**
+ * @return bool
+ */
public function Analyze() {
$info = &$this->getid3->info;
$info['fileformat'] = 'dts';
@@ -45,18 +54,18 @@
// check syncword
$sync = substr($DTSheader, 0, 4);
- if (($encoding = array_search($sync, self::$syncwords)) !== false) {
+ if (($encoding = array_search($sync, self::$syncwords)) !== false) {
- $info['dts']['raw']['magic'] = $sync;
+ $info['dts']['raw']['magic'] = $sync;
$this->readBinDataOffset = 32;
- } elseif ($this->isDependencyFor('matroska')) {
+ } elseif ($this->isDependencyFor('matroska')) {
// Matroska contains DTS without syncword encoded as raw big-endian format
$encoding = 0;
$this->readBinDataOffset = 0;
- } else {
+ } else {
unset($info['fileformat']);
return $this->error('Expecting "'.implode('| ', array_map('getid3_lib::PrintHexBytes', self::$syncwords)).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($sync).'"');
@@ -139,6 +148,12 @@
return true;
}
+ /**
+ * @param string $bin
+ * @param int $length
+ *
+ * @return int
+ */
private function readBinData($bin, $length) {
$data = substr($bin, $this->readBinDataOffset, $length);
$this->readBinDataOffset += $length;
@@ -146,6 +161,11 @@
return bindec($data);
}
+ /**
+ * @param int $index
+ *
+ * @return int|string|false
+ */
public static function bitrateLookup($index) {
static $lookup = array(
0 => 32000,
@@ -184,6 +204,11 @@
return (isset($lookup[$index]) ? $lookup[$index] : false);
}
+ /**
+ * @param int $index
+ *
+ * @return int|string|false
+ */
public static function sampleRateLookup($index) {
static $lookup = array(
0 => 'invalid',
@@ -206,6 +231,11 @@
return (isset($lookup[$index]) ? $lookup[$index] : false);
}
+ /**
+ * @param int $index
+ *
+ * @return int|false
+ */
public static function bitPerSampleLookup($index) {
static $lookup = array(
0 => 16,
@@ -216,44 +246,46 @@
return (isset($lookup[$index]) ? $lookup[$index] : false);
}
+ /**
+ * @param int $index
+ *
+ * @return int|false
+ */
public static function numChannelsLookup($index) {
switch ($index) {
case 0:
return 1;
- break;
case 1:
case 2:
case 3:
case 4:
return 2;
- break;
case 5:
case 6:
return 3;
- break;
case 7:
case 8:
return 4;
- break;
case 9:
return 5;
- break;
case 10:
case 11:
case 12:
return 6;
- break;
case 13:
return 7;
- break;
case 14:
case 15:
return 8;
- break;
}
return false;
}
+ /**
+ * @param int $index
+ *
+ * @return string
+ */
public static function channelArrangementLookup($index) {
static $lookup = array(
0 => 'A',
@@ -276,14 +308,18 @@
return (isset($lookup[$index]) ? $lookup[$index] : 'user-defined');
}
+ /**
+ * @param int $index
+ * @param int $version
+ *
+ * @return int|false
+ */
public static function dialogNormalization($index, $version) {
switch ($version) {
case 7:
return 0 - $index;
- break;
case 6:
return 0 - 16 - $index;
- break;
}
return false;
}