<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[29734] trunk/src/wp-includes/ID3: Update getID3 library to 1.9.8.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29734">29734</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-09-11 19:06:33 +0000 (Thu, 11 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update getID3 library to 1.9.8.
Changes:
https://github.com/JamesHeinrich/getID3/compare/1.9.7...v1.9.8
Fixes <a href="http://core.trac.wordpress.org/ticket/29627">#29627</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesID3getid3libphp">trunk/src/wp-includes/ID3/getid3.lib.php</a></li>
<li><a href="#trunksrcwpincludesID3getid3php">trunk/src/wp-includes/ID3/getid3.php</a></li>
<li><a href="#trunksrcwpincludesID3licensecommercialtxt">trunk/src/wp-includes/ID3/license.commercial.txt</a></li>
<li><a href="#trunksrcwpincludesID3licensetxt">trunk/src/wp-includes/ID3/license.txt</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudiovideoasfphp">trunk/src/wp-includes/ID3/module.audio-video.asf.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudiovideoflvphp">trunk/src/wp-includes/ID3/module.audio-video.flv.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudiovideomatroskaphp">trunk/src/wp-includes/ID3/module.audio-video.matroska.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudiovideoquicktimephp">trunk/src/wp-includes/ID3/module.audio-video.quicktime.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudiovideoriffphp">trunk/src/wp-includes/ID3/module.audio-video.riff.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudioac3php">trunk/src/wp-includes/ID3/module.audio.ac3.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudiodtsphp">trunk/src/wp-includes/ID3/module.audio.dts.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudioflacphp">trunk/src/wp-includes/ID3/module.audio.flac.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudiomp3php">trunk/src/wp-includes/ID3/module.audio.mp3.php</a></li>
<li><a href="#trunksrcwpincludesID3moduleaudiooggphp">trunk/src/wp-includes/ID3/module.audio.ogg.php</a></li>
<li><a href="#trunksrcwpincludesID3moduletagapetagphp">trunk/src/wp-includes/ID3/module.tag.apetag.php</a></li>
<li><a href="#trunksrcwpincludesID3moduletagid3v1php">trunk/src/wp-includes/ID3/module.tag.id3v1.php</a></li>
<li><a href="#trunksrcwpincludesID3moduletagid3v2php">trunk/src/wp-includes/ID3/module.tag.id3v2.php</a></li>
<li><a href="#trunksrcwpincludesID3moduletaglyrics3php">trunk/src/wp-includes/ID3/module.tag.lyrics3.php</a></li>
<li><a href="#trunksrcwpincludesID3readmetxt">trunk/src/wp-includes/ID3/readme.txt</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesID3getid3libphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/getid3.lib.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/getid3.lib.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/getid3.lib.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // //
</span><span class="cx"> // getid3.lib.php - part of getID3() //
</span><span class="lines">@@ -282,7 +283,6 @@
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in self::BigEndian2Int()');
</span><del>- break;
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> return self::CastAsInt($intvalue);
</span><span class="lines">@@ -635,7 +635,7 @@
</span><span class="cx"> }
</span><span class="cx"> if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) {
</span><span class="cx"> if (($fp_dest = fopen($filename_dest, 'wb'))) {
</span><del>- if (fseek($fp_src, $offset, SEEK_SET) == 0) {
</del><ins>+ if (fseek($fp_src, $offset) == 0) {
</ins><span class="cx"> $byteslefttowrite = $length;
</span><span class="cx"> while (($byteslefttowrite > 0) && ($buffer = fread($fp_src, min($byteslefttowrite, getID3::FREAD_BUFFER_SIZE)))) {
</span><span class="cx"> $byteswritten = fwrite($fp_dest, $buffer, $byteslefttowrite);
</span><span class="lines">@@ -986,6 +986,19 @@
</span><span class="cx"> throw new Exception('PHP does not have iconv() support - cannot convert from '.$in_charset.' to '.$out_charset);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ public static function recursiveMultiByteCharString2HTML($data, $charset='ISO-8859-1') {
+ if (is_string($data)) {
+ return self::MultiByteCharString2HTML($data, $charset);
+ } elseif (is_array($data)) {
+ $return_data = array();
+ foreach ($data as $key => $value) {
+ $return_data[$key] = self::recursiveMultiByteCharString2HTML($value, $charset);
+ }
+ return $return_data;
+ }
+ // integer, float, objects, resources, etc
+ return $data;
+ }
</ins><span class="cx">
</span><span class="cx"> public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') {
</span><span class="cx"> $string = (string) $string; // in case trying to pass a numeric (float, int) string, would otherwise return an empty string
</span><span class="lines">@@ -1210,16 +1223,21 @@
</span><span class="cx"> $newvaluelength = strlen(trim($value));
</span><span class="cx"> foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
</span><span class="cx"> $oldvaluelength = strlen(trim($existingvalue));
</span><del>- if (($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {
</del><ins>+ if ((strlen($existingvalue) > 10) && ($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {
</ins><span class="cx"> $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value);
</span><del>- break 2;
</del><ins>+ //break 2;
+ break;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx"> if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) {
</span><span class="cx"> $value = (is_string($value) ? trim($value) : $value);
</span><del>- $ThisFileInfo['comments'][$tagname][] = $value;
</del><ins>+ if (!is_numeric($key)) {
+ $ThisFileInfo['comments'][$tagname][$key] = $value;
+ } else {
+ $ThisFileInfo['comments'][$tagname][] = $value;
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1227,20 +1245,23 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Copy to ['comments_html']
</span><del>- foreach ($ThisFileInfo['comments'] as $field => $values) {
- if ($field == 'picture') {
- // pictures can take up a lot of space, and we don't need multiple copies of them
- // let there be a single copy in [comments][picture], and not elsewhere
- continue;
- }
- foreach ($values as $index => $value) {
- if (is_array($value)) {
- $ThisFileInfo['comments_html'][$field][$index] = $value;
- } else {
- $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding']));
</del><ins>+ if (!empty($ThisFileInfo['comments'])) {
+ foreach ($ThisFileInfo['comments'] as $field => $values) {
+ if ($field == 'picture') {
+ // pictures can take up a lot of space, and we don't need multiple copies of them
+ // let there be a single copy in [comments][picture], and not elsewhere
+ continue;
</ins><span class="cx"> }
</span><ins>+ foreach ($values as $index => $value) {
+ if (is_array($value)) {
+ $ThisFileInfo['comments_html'][$field][$index] = $value;
+ } else {
+ $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding']));
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -1339,4 +1360,17 @@
</span><span class="cx"> }
</span><span class="cx"> return $filesize;
</span><span class="cx"> }
</span><ins>+
+
+ /**
+ * Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268)
+ * @param string $path A path.
+ * @param string $suffix If the name component ends in suffix this will also be cut off.
+ * @return string
+ */
+ public static function mb_basename($path, $suffix = null) {
+ $splited = preg_split('#/#', rtrim($path, '/ '));
+ return substr(basename('X'.$splited[count($splited) - 1], $suffix), 1);
+ }
+
</ins><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3getid3php"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/getid3.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/getid3.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/getid3.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // //
</span><span class="cx"> // Please see readme.txt for more information //
</span><span class="lines">@@ -17,18 +18,21 @@
</span><span class="cx"> if (!defined('GETID3_INCLUDEPATH')) {
</span><span class="cx"> define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
</span><span class="cx"> }
</span><ins>+// Workaround Bug #39923 (https://bugs.php.net/bug.php?id=39923)
+if (!defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) {
+ define('IMG_JPG', IMAGETYPE_JPEG);
+}
</ins><span class="cx">
</span><span class="cx"> // attempt to define temp dir as something flexible but reliable
</span><span class="cx"> $temp_dir = ini_get('upload_tmp_dir');
</span><span class="cx"> if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) {
</span><span class="cx"> $temp_dir = '';
</span><span class="cx"> }
</span><del>-if (!$temp_dir && function_exists('sys_get_temp_dir')) {
- // PHP v5.2.1+
</del><ins>+if (!$temp_dir) {
</ins><span class="cx"> // sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts
</span><span class="cx"> $temp_dir = sys_get_temp_dir();
</span><span class="cx"> }
</span><del>-$temp_dir = realpath($temp_dir);
</del><ins>+$temp_dir = @realpath($temp_dir); // see https://github.com/JamesHeinrich/getID3/pull/10
</ins><span class="cx"> $open_basedir = ini_get('open_basedir');
</span><span class="cx"> if ($open_basedir) {
</span><span class="cx"> // e.g. "/var/www/vhosts/getid3.org/httpdocs/:/tmp/"
</span><span class="lines">@@ -57,7 +61,9 @@
</span><span class="cx"> $temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir
</span><span class="cx"> }
</span><span class="cx"> // $temp_dir = '/something/else/'; // feel free to override temp dir here if it works better for your system
</span><del>-define('GETID3_TEMP_DIR', $temp_dir);
</del><ins>+if (!defined('GETID3_TEMP_DIR')) {
+ define('GETID3_TEMP_DIR', $temp_dir);
+}
</ins><span class="cx"> unset($open_basedir, $temp_dir);
</span><span class="cx">
</span><span class="cx"> // End: Defines
</span><span class="lines">@@ -97,13 +103,13 @@
</span><span class="cx"> public $fp; // Filepointer to file being analysed.
</span><span class="cx"> public $info; // Result array.
</span><span class="cx"> public $tempdir = GETID3_TEMP_DIR;
</span><ins>+ public $memory_limit = 0;
</ins><span class="cx">
</span><span class="cx"> // Protected variables
</span><span class="cx"> protected $startup_error = '';
</span><span class="cx"> protected $startup_warning = '';
</span><del>- protected $memory_limit = 0;
</del><span class="cx">
</span><del>- const VERSION = '1.9.7-20130705';
</del><ins>+ const VERSION = '1.9.8-20140511';
</ins><span class="cx"> const FREAD_BUFFER_SIZE = 32768;
</span><span class="cx">
</span><span class="cx"> const ATTACHMENTS_NONE = false;
</span><span class="lines">@@ -112,13 +118,6 @@
</span><span class="cx"> // public: constructor
</span><span class="cx"> public function __construct() {
</span><span class="cx">
</span><del>- // Check for PHP version
- $required_php_version = '5.0.5';
- if (version_compare(PHP_VERSION, $required_php_version, '<')) {
- $this->startup_error .= 'getID3() requires PHP v'.$required_php_version.' or higher - you are running v'.PHP_VERSION;
- return false;
- }
-
</del><span class="cx"> // Check memory
</span><span class="cx"> $this->memory_limit = ini_get('memory_limit');
</span><span class="cx"> if (preg_match('#([0-9]+)M#i', $this->memory_limit, $matches)) {
</span><span class="lines">@@ -261,16 +260,32 @@
</span><span class="cx"> $filename = preg_replace('#(.+)'.preg_quote(DIRECTORY_SEPARATOR).'{2,}#U', '\1'.DIRECTORY_SEPARATOR, $filename);
</span><span class="cx">
</span><span class="cx"> // open local file
</span><del>- if (is_readable($filename) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) {
</del><ins>+ //if (is_readable($filename) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) { // see http://www.getid3.org/phpBB3/viewtopic.php?t=1720
+ if ((is_readable($filename) || file_exists($filename)) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) {
</ins><span class="cx"> // great
</span><span class="cx"> } else {
</span><del>- throw new getid3_exception('Could not open "'.$filename.'" (does not exist, or is not a file)');
</del><ins>+ $errormessagelist = array();
+ if (!is_readable($filename)) {
+ $errormessagelist[] = '!is_readable';
+ }
+ if (!is_file($filename)) {
+ $errormessagelist[] = '!is_file';
+ }
+ if (!file_exists($filename)) {
+ $errormessagelist[] = '!file_exists';
+ }
+ if (empty($errormessagelist)) {
+ $errormessagelist[] = 'fopen failed';
+ }
+ throw new getid3_exception('Could not open "'.$filename.'" ('.implode('; ', $errormessagelist).')');
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $this->info['filesize'] = filesize($filename);
</span><span class="cx"> // set redundant parameters - might be needed in some include file
</span><del>- $this->info['filename'] = basename($filename);
</del><ins>+ // filenames / filepaths in getID3 are always expressed with forward slashes (unix-style) for both Windows and other to try and minimize confusion
+ $filename = str_replace('\\', '/', $filename);
</ins><span class="cx"> $this->info['filepath'] = str_replace('\\', '/', realpath(dirname($filename)));
</span><ins>+ $this->info['filename'] = getid3_lib::mb_basename($filename);
</ins><span class="cx"> $this->info['filenamepath'] = $this->info['filepath'].'/'.$this->info['filename'];
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -352,7 +367,7 @@
</span><span class="cx">
</span><span class="cx"> // ID3v2 detection (NOT parsing), even if ($this->option_tag_id3v2 == false) done to make fileformat easier
</span><span class="cx"> if (!$this->option_tag_id3v2) {
</span><del>- fseek($this->fp, 0, SEEK_SET);
</del><ins>+ fseek($this->fp, 0);
</ins><span class="cx"> $header = fread($this->fp, 10);
</span><span class="cx"> if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) {
</span><span class="cx"> $this->info['id3v2']['header'] = true;
</span><span class="lines">@@ -363,7 +378,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // read 32 kb file data
</span><del>- fseek($this->fp, $this->info['avdataoffset'], SEEK_SET);
</del><ins>+ fseek($this->fp, $this->info['avdataoffset']);
</ins><span class="cx"> $formattest = fread($this->fp, 32774);
</span><span class="cx">
</span><span class="cx"> // determine format
</span><span class="lines">@@ -588,6 +603,14 @@
</span><span class="cx"> 'mime_type' => 'audio/basic',
</span><span class="cx"> ),
</span><span class="cx">
</span><ins>+ // AMR - audio - Adaptive Multi Rate
+ 'amr' => array(
+ 'pattern' => '^\x23\x21AMR\x0A', // #!AMR[0A]
+ 'group' => 'audio',
+ 'module' => 'amr',
+ 'mime_type' => 'audio/amr',
+ ),
+
</ins><span class="cx"> // AVR - audio - Audio Visual Research
</span><span class="cx"> 'avr' => array(
</span><span class="cx"> 'pattern' => '^2BIT',
</span><span class="lines">@@ -1161,6 +1184,7 @@
</span><span class="cx"> 'matroska' => array('matroska' , 'UTF-8'),
</span><span class="cx"> 'flac' => array('vorbiscomment' , 'UTF-8'),
</span><span class="cx"> 'divxtag' => array('divx' , 'ISO-8859-1'),
</span><ins>+ 'iptc' => array('iptc' , 'ISO-8859-1'),
</ins><span class="cx"> );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1181,7 +1205,11 @@
</span><span class="cx"> $value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed!
</span><span class="cx"> }
</span><span class="cx"> if ($value) {
</span><del>- $this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value;
</del><ins>+ if (!is_numeric($key)) {
+ $this->info['tags'][trim($tag_name)][trim($tag_key)][$key] = $value;
+ } else {
+ $this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value;
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if ($tag_key == 'picture') {
</span><span class="lines">@@ -1196,14 +1224,7 @@
</span><span class="cx">
</span><span class="cx"> if ($this->option_tags_html) {
</span><span class="cx"> foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) {
</span><del>- foreach ($valuearray as $key => $value) {
- if (is_string($value)) {
- //$this->info['tags_html'][$tag_name][$tag_key][$key] = getid3_lib::MultiByteCharString2HTML($value, $encoding);
- $this->info['tags_html'][$tag_name][$tag_key][$key] = str_replace('�', '', trim(getid3_lib::MultiByteCharString2HTML($value, $encoding)));
- } else {
- $this->info['tags_html'][$tag_name][$tag_key][$key] = $value;
- }
- }
</del><ins>+ $this->info['tags_html'][$tag_name][$tag_key] = getid3_lib::recursiveMultiByteCharString2HTML($valuearray, $encoding);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1259,7 +1280,6 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><span class="cx"> public function getHashdata($algorithm) {
</span><span class="cx"> switch ($algorithm) {
</span><span class="cx"> case 'md5':
</span><span class="lines">@@ -1565,8 +1585,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-abstract class getid3_handler
-{
</del><ins>+abstract class getid3_handler {
+
+ /**
+ * @var getID3
+ */
</ins><span class="cx"> protected $getid3; // pointer
</span><span class="cx">
</span><span class="cx"> protected $data_string_flag = false; // analyzing filepointer or string
</span><span class="lines">@@ -1593,7 +1616,7 @@
</span><span class="cx"> // Analyze from string instead
</span><span class="cx"> public function AnalyzeString($string) {
</span><span class="cx"> // Enter string mode
</span><del>- $this->setStringMode($string);
</del><ins>+ $this->setStringMode($string);
</ins><span class="cx">
</span><span class="cx"> // Save info
</span><span class="cx"> $saved_avdataoffset = $this->getid3->info['avdataoffset'];
</span><span class="lines">@@ -1634,10 +1657,10 @@
</span><span class="cx"> $this->data_string_position += $bytes;
</span><span class="cx"> return substr($this->data_string, $this->data_string_position - $bytes, $bytes);
</span><span class="cx"> }
</span><del>- $pos = $this->ftell() + $bytes;
- if (!getid3_lib::intValueSupported($pos)) {
</del><ins>+ $pos = $this->ftell() + $bytes;
+ if (!getid3_lib::intValueSupported($pos)) {
</ins><span class="cx"> throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') because beyond PHP filesystem limit', 10);
</span><del>- }
</del><ins>+ }
</ins><span class="cx"> return fread($this->getid3->fp, $bytes);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1657,14 +1680,14 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> return 0;
</span><del>- } else {
- $pos = $bytes;
- if ($whence == SEEK_CUR) {
</del><ins>+ } else {
+ $pos = $bytes;
+ if ($whence == SEEK_CUR) {
</ins><span class="cx"> $pos = $this->ftell() + $bytes;
</span><del>- } elseif ($whence == SEEK_END) {
- $pos = $this->info['filesize'] + $bytes;
- }
- if (!getid3_lib::intValueSupported($pos)) {
</del><ins>+ } elseif ($whence == SEEK_END) {
+ $pos = $this->getid3->info['filesize'] + $bytes;
+ }
+ if (!getid3_lib::intValueSupported($pos)) {
</ins><span class="cx"> throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1682,20 +1705,17 @@
</span><span class="cx"> return $this->dependency_to == $module;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- protected function error($text)
- {
</del><ins>+ protected function error($text) {
</ins><span class="cx"> $this->getid3->info['error'][] = $text;
</span><span class="cx">
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- protected function warning($text)
- {
</del><ins>+ protected function warning($text) {
</ins><span class="cx"> return $this->getid3->warning($text);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- protected function notice($text)
- {
</del><ins>+ protected function notice($text) {
</ins><span class="cx"> // does nothing for now
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunksrcwpincludesID3licensecommercialtxt"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/license.commercial.txt (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/license.commercial.txt 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/license.commercial.txt 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -24,4 +24,4 @@
</span><span class="cx"> The licensee may not sub-license getID3() itself, meaning that any
</span><span class="cx"> commercially released product containing all or parts of getID3() must
</span><span class="cx"> have added functionality beyond what is available in getID3();
</span><del>-getID3() itself may not be re-licensed by the licensee.
</del><ins>+getID3() itself may not be re-licensed by the licensee.
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3licensetxt"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/license.txt (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/license.txt 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/license.txt 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -2,6 +2,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx">
</span><span class="cx"> *****************************************************************
</span><span class="lines">@@ -25,4 +26,4 @@
</span><span class="cx"> *****************************************************************
</span><span class="cx">
</span><span class="cx"> Copies of each of the above licenses are included in the 'licenses'
</span><del>-directory of the getID3 distribution.
</del><ins>+directory of the getID3 distribution.
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudiovideoasfphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio-video.asf.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio-video.asf.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio-video.asf.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -15,8 +16,7 @@
</span><span class="cx">
</span><span class="cx"> getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
</span><span class="cx">
</span><del>-class getid3_asf extends getid3_handler
-{
</del><ins>+class getid3_asf extends getid3_handler {
</ins><span class="cx">
</span><span class="cx"> public function __construct(getID3 $getid3) {
</span><span class="cx"> parent::__construct($getid3); // extends getid3_handler::__construct()
</span><span class="lines">@@ -66,25 +66,22 @@
</span><span class="cx">
</span><span class="cx"> $info['fileformat'] = 'asf';
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $HeaderObjectData = fread($this->getid3->fp, 30);
</del><ins>+ $this->fseek($info['avdataoffset']);
+ $HeaderObjectData = $this->fread(30);
</ins><span class="cx">
</span><span class="cx"> $thisfile_asf_headerobject['objectid'] = substr($HeaderObjectData, 0, 16);
</span><span class="cx"> $thisfile_asf_headerobject['objectid_guid'] = $this->BytestringToGUID($thisfile_asf_headerobject['objectid']);
</span><span class="cx"> if ($thisfile_asf_headerobject['objectid'] != GETID3_ASF_Header_Object) {
</span><del>- $info['warning'][] = 'ASF header GUID {'.$this->BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->BytestringToGUID(GETID3_ASF_Header_Object).'}';
- unset($info['fileformat']);
- unset($info['asf']);
- return false;
- break;
</del><ins>+ unset($info['fileformat'], $info['asf']);
+ return $this->error('ASF header GUID {'.$this->BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->BytestringToGUID(GETID3_ASF_Header_Object).'}');
</ins><span class="cx"> }
</span><span class="cx"> $thisfile_asf_headerobject['objectsize'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 16, 8));
</span><span class="cx"> $thisfile_asf_headerobject['headerobjects'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 24, 4));
</span><span class="cx"> $thisfile_asf_headerobject['reserved1'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 28, 1));
</span><span class="cx"> $thisfile_asf_headerobject['reserved2'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 29, 1));
</span><span class="cx">
</span><del>- $NextObjectOffset = ftell($this->getid3->fp);
- $ASFHeaderData = fread($this->getid3->fp, $thisfile_asf_headerobject['objectsize'] - 30);
</del><ins>+ $NextObjectOffset = $this->ftell();
+ $ASFHeaderData = $this->fread($thisfile_asf_headerobject['objectsize'] - 30);
</ins><span class="cx"> $offset = 0;
</span><span class="cx">
</span><span class="cx"> for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) {
</span><span class="lines">@@ -284,7 +281,7 @@
</span><span class="cx"> $offset += 4;
</span><span class="cx"> $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']);
</span><span class="cx"> $unhandled_sections = 0;
</span><del>- $thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->ASF_HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections);
</del><ins>+ $thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections);
</ins><span class="cx"> if ($unhandled_sections === 0) {
</span><span class="cx"> unset($thisfile_asf_headerextensionobject['extension_data']);
</span><span class="cx"> }
</span><span class="lines">@@ -332,7 +329,7 @@
</span><span class="cx">
</span><span class="cx"> $thisfile_asf_codeclistobject_codecentries_current['type_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
</span><span class="cx"> $offset += 2;
</span><del>- $thisfile_asf_codeclistobject_codecentries_current['type'] = $this->ASFCodecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current['type_raw']);
</del><ins>+ $thisfile_asf_codeclistobject_codecentries_current['type'] = self::codecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current['type_raw']);
</ins><span class="cx">
</span><span class="cx"> $CodecNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
</span><span class="cx"> $offset += 2;
</span><span class="lines">@@ -826,22 +823,14 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case 'id3':
</span><del>- // id3v2 module might not be loaded
- if (class_exists('getid3_id3v2')) {
- $tempfile = tempnam(GETID3_TEMP_DIR, 'getID3');
- $tempfilehandle = fopen($tempfile, 'wb');
- $tempThisfileInfo = array('encoding'=>$info['encoding']);
- fwrite($tempfilehandle, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
- fclose($tempfilehandle);
</del><ins>+ $this->getid3->include_module('tag.id3v2');
</ins><span class="cx">
</span><del>- $getid3_temp = new getID3();
- $getid3_temp->openfile($tempfile);
- $getid3_id3v2 = new getid3_id3v2($getid3_temp);
- $getid3_id3v2->Analyze();
- $info['id3v2'] = $getid3_temp->info['id3v2'];
- unset($getid3_temp, $getid3_id3v2);
</del><ins>+ $getid3_id3v2 = new getid3_id3v2($this->getid3);
+ $getid3_id3v2->AnalyzeString($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
+ unset($getid3_id3v2);
</ins><span class="cx">
</span><del>- unlink($tempfile);
</del><ins>+ if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] > 1024) {
+ $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = '<value too large to display>';
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -860,7 +849,7 @@
</span><span class="cx"> $wm_picture_offset = 0;
</span><span class="cx"> $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 1));
</span><span class="cx"> $wm_picture_offset += 1;
</span><del>- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type'] = $this->WMpictureTypeLookup($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id']);
</del><ins>+ $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type'] = self::WMpictureTypeLookup($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id']);
</ins><span class="cx"> $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 4));
</span><span class="cx"> $wm_picture_offset += 4;
</span><span class="cx">
</span><span class="lines">@@ -1156,8 +1145,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- while (ftell($this->getid3->fp) < $info['avdataend']) {
- $NextObjectDataHeader = fread($this->getid3->fp, 24);
</del><ins>+ while ($this->ftell() < $info['avdataend']) {
+ $NextObjectDataHeader = $this->fread(24);
</ins><span class="cx"> $offset = 0;
</span><span class="cx"> $NextObjectGUID = substr($NextObjectDataHeader, 0, 16);
</span><span class="cx"> $offset += 16;
</span><span class="lines">@@ -1179,7 +1168,7 @@
</span><span class="cx"> $thisfile_asf['data_object'] = array();
</span><span class="cx"> $thisfile_asf_dataobject = &$thisfile_asf['data_object'];
</span><span class="cx">
</span><del>- $DataObjectData = $NextObjectDataHeader.fread($this->getid3->fp, 50 - 24);
</del><ins>+ $DataObjectData = $NextObjectDataHeader.$this->fread(50 - 24);
</ins><span class="cx"> $offset = 24;
</span><span class="cx">
</span><span class="cx"> $thisfile_asf_dataobject['objectid'] = $NextObjectGUID;
</span><span class="lines">@@ -1207,9 +1196,9 @@
</span><span class="cx"> // * * Error Correction Present bits 1 // If set, use Opaque Data Packet structure, else use Payload structure
</span><span class="cx"> // * Error Correction Data
</span><span class="cx">
</span><del>- $info['avdataoffset'] = ftell($this->getid3->fp);
- fseek($this->getid3->fp, ($thisfile_asf_dataobject['objectsize'] - 50), SEEK_CUR); // skip actual audio/video data
- $info['avdataend'] = ftell($this->getid3->fp);
</del><ins>+ $info['avdataoffset'] = $this->ftell();
+ $this->fseek(($thisfile_asf_dataobject['objectsize'] - 50), SEEK_CUR); // skip actual audio/video data
+ $info['avdataend'] = $this->ftell();
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case GETID3_ASF_Simple_Index_Object:
</span><span class="lines">@@ -1229,7 +1218,7 @@
</span><span class="cx"> $thisfile_asf['simple_index_object'] = array();
</span><span class="cx"> $thisfile_asf_simpleindexobject = &$thisfile_asf['simple_index_object'];
</span><span class="cx">
</span><del>- $SimpleIndexObjectData = $NextObjectDataHeader.fread($this->getid3->fp, 56 - 24);
</del><ins>+ $SimpleIndexObjectData = $NextObjectDataHeader.$this->fread(56 - 24);
</ins><span class="cx"> $offset = 24;
</span><span class="cx">
</span><span class="cx"> $thisfile_asf_simpleindexobject['objectid'] = $NextObjectGUID;
</span><span class="lines">@@ -1246,7 +1235,7 @@
</span><span class="cx"> $thisfile_asf_simpleindexobject['index_entries_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4));
</span><span class="cx"> $offset += 4;
</span><span class="cx">
</span><del>- $IndexEntriesData = $SimpleIndexObjectData.fread($this->getid3->fp, 6 * $thisfile_asf_simpleindexobject['index_entries_count']);
</del><ins>+ $IndexEntriesData = $SimpleIndexObjectData.$this->fread(6 * $thisfile_asf_simpleindexobject['index_entries_count']);
</ins><span class="cx"> for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $thisfile_asf_simpleindexobject['index_entries_count']; $IndexEntriesCounter++) {
</span><span class="cx"> $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_number'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4));
</span><span class="cx"> $offset += 4;
</span><span class="lines">@@ -1283,7 +1272,7 @@
</span><span class="cx"> $thisfile_asf['asf_index_object'] = array();
</span><span class="cx"> $thisfile_asf_asfindexobject = &$thisfile_asf['asf_index_object'];
</span><span class="cx">
</span><del>- $ASFIndexObjectData = $NextObjectDataHeader.fread($this->getid3->fp, 34 - 24);
</del><ins>+ $ASFIndexObjectData = $NextObjectDataHeader.$this->fread(34 - 24);
</ins><span class="cx"> $offset = 24;
</span><span class="cx">
</span><span class="cx"> $thisfile_asf_asfindexobject['objectid'] = $NextObjectGUID;
</span><span class="lines">@@ -1297,7 +1286,7 @@
</span><span class="cx"> $thisfile_asf_asfindexobject['index_blocks_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
</span><span class="cx"> $offset += 4;
</span><span class="cx">
</span><del>- $ASFIndexObjectData .= fread($this->getid3->fp, 4 * $thisfile_asf_asfindexobject['index_specifiers_count']);
</del><ins>+ $ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count']);
</ins><span class="cx"> for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
</span><span class="cx"> $IndexSpecifierStreamNumber = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2));
</span><span class="cx"> $offset += 2;
</span><span class="lines">@@ -1307,17 +1296,17 @@
</span><span class="cx"> $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type_text'] = $this->ASFIndexObjectIndexTypeLookup($thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type']);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $ASFIndexObjectData .= fread($this->getid3->fp, 4);
</del><ins>+ $ASFIndexObjectData .= $this->fread(4);
</ins><span class="cx"> $thisfile_asf_asfindexobject['index_entry_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
</span><span class="cx"> $offset += 4;
</span><span class="cx">
</span><del>- $ASFIndexObjectData .= fread($this->getid3->fp, 8 * $thisfile_asf_asfindexobject['index_specifiers_count']);
</del><ins>+ $ASFIndexObjectData .= $this->fread(8 * $thisfile_asf_asfindexobject['index_specifiers_count']);
</ins><span class="cx"> for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
</span><span class="cx"> $thisfile_asf_asfindexobject['block_positions'][$IndexSpecifiersCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 8));
</span><span class="cx"> $offset += 8;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $ASFIndexObjectData .= fread($this->getid3->fp, 4 * $thisfile_asf_asfindexobject['index_specifiers_count'] * $thisfile_asf_asfindexobject['index_entry_count']);
</del><ins>+ $ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count'] * $thisfile_asf_asfindexobject['index_entry_count']);
</ins><span class="cx"> for ($IndexEntryCounter = 0; $IndexEntryCounter < $thisfile_asf_asfindexobject['index_entry_count']; $IndexEntryCounter++) {
</span><span class="cx"> for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
</span><span class="cx"> $thisfile_asf_asfindexobject['offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
</span><span class="lines">@@ -1332,9 +1321,9 @@
</span><span class="cx"> if ($this->GUIDname($NextObjectGUIDtext)) {
</span><span class="cx"> $info['warning'][] = 'unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF body at offset '.($offset - 16 - 8);
</span><span class="cx"> } else {
</span><del>- $info['warning'][] = 'unknown GUID {'.$NextObjectGUIDtext.'} in ASF body at offset '.(ftell($this->getid3->fp) - 16 - 8);
</del><ins>+ $info['warning'][] = 'unknown GUID {'.$NextObjectGUIDtext.'} in ASF body at offset '.($this->ftell() - 16 - 8);
</ins><span class="cx"> }
</span><del>- fseek($this->getid3->fp, ($NextObjectSize - 16 - 8), SEEK_CUR);
</del><ins>+ $this->fseek(($NextObjectSize - 16 - 8), SEEK_CUR);
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1433,10 +1422,10 @@
</span><span class="cx"> $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf');
</span><span class="cx"> }
</span><span class="cx"> if (!empty($thisfile_video['streams'])) {
</span><del>- $thisfile_video['streams']['resolution_x'] = 0;
- $thisfile_video['streams']['resolution_y'] = 0;
</del><ins>+ $thisfile_video['resolution_x'] = 0;
+ $thisfile_video['resolution_y'] = 0;
</ins><span class="cx"> foreach ($thisfile_video['streams'] as $key => $valuearray) {
</span><del>- if (($valuearray['resolution_x'] > $thisfile_video['streams']['resolution_x']) || ($valuearray['resolution_y'] > $thisfile_video['streams']['resolution_y'])) {
</del><ins>+ if (($valuearray['resolution_x'] > $thisfile_video['resolution_x']) || ($valuearray['resolution_y'] > $thisfile_video['resolution_y'])) {
</ins><span class="cx"> $thisfile_video['resolution_x'] = $valuearray['resolution_x'];
</span><span class="cx"> $thisfile_video['resolution_y'] = $valuearray['resolution_y'];
</span><span class="cx"> }
</span><span class="lines">@@ -1451,15 +1440,14 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- public static function ASFCodecListObjectTypeLookup($CodecListType) {
- static $ASFCodecListObjectTypeLookup = array();
- if (empty($ASFCodecListObjectTypeLookup)) {
- $ASFCodecListObjectTypeLookup[0x0001] = 'Video Codec';
- $ASFCodecListObjectTypeLookup[0x0002] = 'Audio Codec';
- $ASFCodecListObjectTypeLookup[0xFFFF] = 'Unknown Codec';
- }
</del><ins>+ public static function codecListObjectTypeLookup($CodecListType) {
+ static $lookup = array(
+ 0x0001 => 'Video Codec',
+ 0x0002 => 'Audio Codec',
+ 0xFFFF => 'Unknown Codec'
+ );
</ins><span class="cx">
</span><del>- return (isset($ASFCodecListObjectTypeLookup[$CodecListType]) ? $ASFCodecListObjectTypeLookup[$CodecListType] : 'Invalid Codec Type');
</del><ins>+ return (isset($lookup[$CodecListType]) ? $lookup[$CodecListType] : 'Invalid Codec Type');
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> public static function KnownGUIDs() {
</span><span class="lines">@@ -1666,31 +1654,37 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> public static function WMpictureTypeLookup($WMpictureType) {
</span><del>- static $WMpictureTypeLookup = array();
- if (empty($WMpictureTypeLookup)) {
- $WMpictureTypeLookup[0x03] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Front Cover');
- $WMpictureTypeLookup[0x04] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Back Cover');
- $WMpictureTypeLookup[0x00] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'User Defined');
- $WMpictureTypeLookup[0x05] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Leaflet Page');
- $WMpictureTypeLookup[0x06] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Media Label');
- $WMpictureTypeLookup[0x07] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Lead Artist');
- $WMpictureTypeLookup[0x08] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Artist');
- $WMpictureTypeLookup[0x09] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Conductor');
- $WMpictureTypeLookup[0x0A] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Band');
- $WMpictureTypeLookup[0x0B] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Composer');
- $WMpictureTypeLookup[0x0C] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Lyricist');
- $WMpictureTypeLookup[0x0D] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Recording Location');
- $WMpictureTypeLookup[0x0E] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'During Recording');
- $WMpictureTypeLookup[0x0F] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'During Performance');
- $WMpictureTypeLookup[0x10] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Video Screen Capture');
- $WMpictureTypeLookup[0x12] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Illustration');
- $WMpictureTypeLookup[0x13] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Band Logotype');
- $WMpictureTypeLookup[0x14] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Publisher Logotype');
</del><ins>+ static $lookup = null;
+ if ($lookup === null) {
+ $lookup = array(
+ 0x03 => 'Front Cover',
+ 0x04 => 'Back Cover',
+ 0x00 => 'User Defined',
+ 0x05 => 'Leaflet Page',
+ 0x06 => 'Media Label',
+ 0x07 => 'Lead Artist',
+ 0x08 => 'Artist',
+ 0x09 => 'Conductor',
+ 0x0A => 'Band',
+ 0x0B => 'Composer',
+ 0x0C => 'Lyricist',
+ 0x0D => 'Recording Location',
+ 0x0E => 'During Recording',
+ 0x0F => 'During Performance',
+ 0x10 => 'Video Screen Capture',
+ 0x12 => 'Illustration',
+ 0x13 => 'Band Logotype',
+ 0x14 => 'Publisher Logotype'
+ );
+ $lookup = array_map(function($str) {
+ return getid3_lib::iconv_fallback('UTF-8', 'UTF-16LE', $str);
+ }, $lookup);
</ins><span class="cx"> }
</span><del>- return (isset($WMpictureTypeLookup[$WMpictureType]) ? $WMpictureTypeLookup[$WMpictureType] : '');
</del><ins>+
+ return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : '');
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- public function ASF_HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
</del><ins>+ public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
</ins><span class="cx"> // http://msdn.microsoft.com/en-us/library/bb643323.aspx
</span><span class="cx">
</span><span class="cx"> $offset = 0;
</span><span class="lines">@@ -1825,7 +1819,7 @@
</span><span class="cx">
</span><span class="cx"> $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
</span><span class="cx"> $offset += 2;
</span><del>- $descriptionRecord['data_type_text'] = $this->ASFmetadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
</del><ins>+ $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
</ins><span class="cx">
</span><span class="cx"> $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
</span><span class="cx"> $offset += 4;
</span><span class="lines">@@ -1897,7 +1891,7 @@
</span><span class="cx">
</span><span class="cx"> $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
</span><span class="cx"> $offset += 2;
</span><del>- $descriptionRecord['data_type_text'] = $this->ASFmetadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
</del><ins>+ $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
</ins><span class="cx">
</span><span class="cx"> $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
</span><span class="cx"> $offset += 4;
</span><span class="lines">@@ -1937,8 +1931,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>- public static function ASFmetadataLibraryObjectDataTypeLookup($id) {
- static $ASFmetadataLibraryObjectDataTypeLookup = array(
</del><ins>+ public static function metadataLibraryObjectDataTypeLookup($id) {
+ static $lookup = array(
</ins><span class="cx"> 0x0000 => 'Unicode string', // The data consists of a sequence of Unicode characters
</span><span class="cx"> 0x0001 => 'BYTE array', // The type of the data is implementation-specific
</span><span class="cx"> 0x0002 => 'BOOL', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values
</span><span class="lines">@@ -1947,7 +1941,7 @@
</span><span class="cx"> 0x0005 => 'WORD', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer
</span><span class="cx"> 0x0006 => 'GUID', // The data is 16 bytes long and should be interpreted as a 128-bit GUID
</span><span class="cx"> );
</span><del>- return (isset($ASFmetadataLibraryObjectDataTypeLookup[$id]) ? $ASFmetadataLibraryObjectDataTypeLookup[$id] : 'invalid');
</del><ins>+ return (isset($lookup[$id]) ? $lookup[$id] : 'invalid');
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> public function ASF_WMpicture(&$data) {
</span><span class="lines">@@ -1964,7 +1958,7 @@
</span><span class="cx"> $offset = 0;
</span><span class="cx"> $WMpicture['image_type_id'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 1));
</span><span class="cx"> $offset += 1;
</span><del>- $WMpicture['image_type'] = $this->WMpictureTypeLookup($WMpicture['image_type_id']);
</del><ins>+ $WMpicture['image_type'] = self::WMpictureTypeLookup($WMpicture['image_type_id']);
</ins><span class="cx"> $WMpicture['image_size'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 4));
</span><span class="cx"> $offset += 4;
</span><span class="cx">
</span><span class="lines">@@ -2016,4 +2010,4 @@
</span><span class="cx"> return $string;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudiovideoflvphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio-video.flv.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio-video.flv.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio-video.flv.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> // //
</span><span class="cx"> // FLV module by Seth Kaufman <sethØwhirl-i-gig*com> //
</span><span class="cx"> // //
</span><span class="lines">@@ -38,6 +39,11 @@
</span><span class="cx"> // * version 0.6.1 (30 May 2011) //
</span><span class="cx"> // prevent infinite loops in expGolombUe() //
</span><span class="cx"> // //
</span><ins>+// * version 0.7.0 (16 Jul 2013) //
+// handle GETID3_FLV_VIDEO_VP6FLV_ALPHA //
+// improved AVCSequenceParameterSetReader::readData() //
+// by Xander Schouwerwou <schouwerwouØgmail*com> //
+// //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // //
</span><span class="cx"> // module.audio-video.flv.php //
</span><span class="lines">@@ -67,38 +73,38 @@
</span><span class="cx"> define('H264_PROFILE_HIGH444', 144);
</span><span class="cx"> define('H264_PROFILE_HIGH444_PREDICTIVE', 244);
</span><span class="cx">
</span><del>-class getid3_flv extends getid3_handler
-{
</del><ins>+class getid3_flv extends getid3_handler {
+
+ const magic = 'FLV';
+
</ins><span class="cx"> public $max_frames = 100000; // break out of the loop if too many frames have been scanned; only scan this many if meta frame does not contain useful duration
</span><span class="cx">
</span><span class="cx"> public function Analyze() {
</span><span class="cx"> $info = &$this->getid3->info;
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
</del><ins>+ $this->fseek($info['avdataoffset']);
</ins><span class="cx">
</span><span class="cx"> $FLVdataLength = $info['avdataend'] - $info['avdataoffset'];
</span><del>- $FLVheader = fread($this->getid3->fp, 5);
</del><ins>+ $FLVheader = $this->fread(5);
</ins><span class="cx">
</span><span class="cx"> $info['fileformat'] = 'flv';
</span><span class="cx"> $info['flv']['header']['signature'] = substr($FLVheader, 0, 3);
</span><span class="cx"> $info['flv']['header']['version'] = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1));
</span><span class="cx"> $TypeFlags = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1));
</span><span class="cx">
</span><del>- $magic = 'FLV';
- if ($info['flv']['header']['signature'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['flv']['header']['signature']).'"';
- unset($info['flv']);
- unset($info['fileformat']);
</del><ins>+ if ($info['flv']['header']['signature'] != self::magic) {
+ $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes(self::magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['flv']['header']['signature']).'"';
+ unset($info['flv'], $info['fileformat']);
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $info['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04);
</span><span class="cx"> $info['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01);
</span><span class="cx">
</span><del>- $FrameSizeDataLength = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 4));
</del><ins>+ $FrameSizeDataLength = getid3_lib::BigEndian2Int($this->fread(4));
</ins><span class="cx"> $FLVheaderFrameLength = 9;
</span><span class="cx"> if ($FrameSizeDataLength > $FLVheaderFrameLength) {
</span><del>- fseek($this->getid3->fp, $FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR);
</del><ins>+ $this->fseek($FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR);
</ins><span class="cx"> }
</span><span class="cx"> $Duration = 0;
</span><span class="cx"> $found_video = false;
</span><span class="lines">@@ -108,15 +114,15 @@
</span><span class="cx"> $tagParseCount = 0;
</span><span class="cx"> $info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0);
</span><span class="cx"> $flv_framecount = &$info['flv']['framecount'];
</span><del>- while (((ftell($this->getid3->fp) + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime)) {
- $ThisTagHeader = fread($this->getid3->fp, 16);
</del><ins>+ while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime)) {
+ $ThisTagHeader = $this->fread(16);
</ins><span class="cx">
</span><span class="cx"> $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4));
</span><span class="cx"> $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1));
</span><span class="cx"> $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3));
</span><span class="cx"> $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3));
</span><span class="cx"> $LastHeaderByte = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1));
</span><del>- $NextOffset = ftell($this->getid3->fp) - 1 + $DataLength;
</del><ins>+ $NextOffset = $this->ftell() - 1 + $DataLength;
</ins><span class="cx"> if ($Timestamp > $Duration) {
</span><span class="cx"> $Duration = $Timestamp;
</span><span class="cx"> }
</span><span class="lines">@@ -140,7 +146,7 @@
</span><span class="cx"> $found_video = true;
</span><span class="cx"> $info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07;
</span><span class="cx">
</span><del>- $FLVvideoHeader = fread($this->getid3->fp, 11);
</del><ins>+ $FLVvideoHeader = $this->fread(11);
</ins><span class="cx">
</span><span class="cx"> if ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H264) {
</span><span class="cx"> // this code block contributed by: moysevichØgmail*com
</span><span class="lines">@@ -160,7 +166,7 @@
</span><span class="cx"> //$spsSize = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 9, 2));
</span><span class="cx"> $spsSize = getid3_lib::LittleEndian2Int(substr($FLVvideoHeader, 9, 2));
</span><span class="cx"> // read the first SequenceParameterSet
</span><del>- $sps = fread($this->getid3->fp, $spsSize);
</del><ins>+ $sps = $this->fread($spsSize);
</ins><span class="cx"> if (strlen($sps) == $spsSize) { // make sure that whole SequenceParameterSet was red
</span><span class="cx"> $spsReader = new AVCSequenceParameterSetReader($sps);
</span><span class="cx"> $spsReader->readData();
</span><span class="lines">@@ -185,19 +191,15 @@
</span><span class="cx"> //$PictureSizeEnc <<= 1;
</span><span class="cx"> //$info['video']['resolution_y'] = ($PictureSizeEnc & 0xFF00) >> 8;
</span><span class="cx">
</span><del>- $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 2));
- $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2));
- $PictureSizeEnc['x'] >>= 7;
- $PictureSizeEnc['y'] >>= 7;
</del><ins>+ $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 2)) >> 7;
+ $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2)) >> 7;
</ins><span class="cx"> $info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFF;
</span><span class="cx"> $info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFF;
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case 1:
</span><del>- $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 3));
- $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 3));
- $PictureSizeEnc['x'] >>= 7;
- $PictureSizeEnc['y'] >>= 7;
</del><ins>+ $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 3)) >> 7;
+ $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 3)) >> 7;
</ins><span class="cx"> $info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFFFF;
</span><span class="cx"> $info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFFFF;
</span><span class="cx"> break;
</span><span class="lines">@@ -233,8 +235,22 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> }
</span><ins>+
+ } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_VP6FLV_ALPHA) {
+
+ /* contributed by schouwerwouØgmail*com */
+ if (!isset($info['video']['resolution_x'])) { // only when meta data isn't set
+ $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2));
+ $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 2));
+ $info['video']['resolution_x'] = ($PictureSizeEnc['x'] & 0xFF) << 3;
+ $info['video']['resolution_y'] = ($PictureSizeEnc['y'] & 0xFF) << 3;
+ }
+ /* end schouwerwouØgmail*com */
+
</ins><span class="cx"> }
</span><del>- $info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y'];
</del><ins>+ if (!empty($info['video']['resolution_x']) && !empty($info['video']['resolution_y'])) {
+ $info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y'];
+ }
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -242,8 +258,8 @@
</span><span class="cx"> case GETID3_FLV_TAG_META:
</span><span class="cx"> if (!$found_meta) {
</span><span class="cx"> $found_meta = true;
</span><del>- fseek($this->getid3->fp, -1, SEEK_CUR);
- $datachunk = fread($this->getid3->fp, $DataLength);
</del><ins>+ $this->fseek(-1, SEEK_CUR);
+ $datachunk = $this->fread($DataLength);
</ins><span class="cx"> $AMFstream = new AMFStream($datachunk);
</span><span class="cx"> $reader = new AMFReader($AMFstream);
</span><span class="cx"> $eventName = $reader->readData();
</span><span class="lines">@@ -279,7 +295,7 @@
</span><span class="cx"> // noop
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- fseek($this->getid3->fp, $NextOffset, SEEK_SET);
</del><ins>+ $this->fseek($NextOffset);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $info['playtime_seconds'] = $Duration / 1000;
</span><span class="lines">@@ -288,16 +304,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ($info['flv']['header']['hasAudio']) {
</span><del>- $info['audio']['codec'] = $this->FLVaudioFormat($info['flv']['audio']['audioFormat']);
- $info['audio']['sample_rate'] = $this->FLVaudioRate($info['flv']['audio']['audioRate']);
- $info['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($info['flv']['audio']['audioSampleSize']);
</del><ins>+ $info['audio']['codec'] = self::audioFormatLookup($info['flv']['audio']['audioFormat']);
+ $info['audio']['sample_rate'] = self::audioRateLookup($info['flv']['audio']['audioRate']);
+ $info['audio']['bits_per_sample'] = self::audioBitDepthLookup($info['flv']['audio']['audioSampleSize']);
</ins><span class="cx">
</span><span class="cx"> $info['audio']['channels'] = $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo
</span><span class="cx"> $info['audio']['lossless'] = ($info['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed
</span><span class="cx"> $info['audio']['dataformat'] = 'flv';
</span><span class="cx"> }
</span><span class="cx"> if (!empty($info['flv']['header']['hasVideo'])) {
</span><del>- $info['video']['codec'] = $this->FLVvideoCodec($info['flv']['video']['videoCodec']);
</del><ins>+ $info['video']['codec'] = self::videoCodecLookup($info['flv']['video']['videoCodec']);
</ins><span class="cx"> $info['video']['dataformat'] = 'flv';
</span><span class="cx"> $info['video']['lossless'] = false;
</span><span class="cx"> }
</span><span class="lines">@@ -308,17 +324,17 @@
</span><span class="cx"> $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
</span><span class="cx"> }
</span><span class="cx"> if (isset($info['flv']['meta']['onMetaData']['audiocodecid'])) {
</span><del>- $info['audio']['codec'] = $this->FLVaudioFormat($info['flv']['meta']['onMetaData']['audiocodecid']);
</del><ins>+ $info['audio']['codec'] = self::audioFormatLookup($info['flv']['meta']['onMetaData']['audiocodecid']);
</ins><span class="cx"> }
</span><span class="cx"> if (isset($info['flv']['meta']['onMetaData']['videocodecid'])) {
</span><del>- $info['video']['codec'] = $this->FLVvideoCodec($info['flv']['meta']['onMetaData']['videocodecid']);
</del><ins>+ $info['video']['codec'] = self::videoCodecLookup($info['flv']['meta']['onMetaData']['videocodecid']);
</ins><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>- public function FLVaudioFormat($id) {
- $FLVaudioFormat = array(
</del><ins>+ public static function audioFormatLookup($id) {
+ static $lookup = array(
</ins><span class="cx"> 0 => 'Linear PCM, platform endian',
</span><span class="cx"> 1 => 'ADPCM',
</span><span class="cx"> 2 => 'mp3',
</span><span class="lines">@@ -330,35 +346,35 @@
</span><span class="cx"> 8 => 'G.711 mu-law logarithmic PCM',
</span><span class="cx"> 9 => 'reserved',
</span><span class="cx"> 10 => 'AAC',
</span><del>- 11 => false, // unknown?
</del><ins>+ 11 => 'Speex',
</ins><span class="cx"> 12 => false, // unknown?
</span><span class="cx"> 13 => false, // unknown?
</span><span class="cx"> 14 => 'mp3 8kHz',
</span><span class="cx"> 15 => 'Device-specific sound',
</span><span class="cx"> );
</span><del>- return (isset($FLVaudioFormat[$id]) ? $FLVaudioFormat[$id] : false);
</del><ins>+ return (isset($lookup[$id]) ? $lookup[$id] : false);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- public function FLVaudioRate($id) {
- $FLVaudioRate = array(
</del><ins>+ public static function audioRateLookup($id) {
+ static $lookup = array(
</ins><span class="cx"> 0 => 5500,
</span><span class="cx"> 1 => 11025,
</span><span class="cx"> 2 => 22050,
</span><span class="cx"> 3 => 44100,
</span><span class="cx"> );
</span><del>- return (isset($FLVaudioRate[$id]) ? $FLVaudioRate[$id] : false);
</del><ins>+ return (isset($lookup[$id]) ? $lookup[$id] : false);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- public function FLVaudioBitDepth($id) {
- $FLVaudioBitDepth = array(
</del><ins>+ public static function audioBitDepthLookup($id) {
+ static $lookup = array(
</ins><span class="cx"> 0 => 8,
</span><span class="cx"> 1 => 16,
</span><span class="cx"> );
</span><del>- return (isset($FLVaudioBitDepth[$id]) ? $FLVaudioBitDepth[$id] : false);
</del><ins>+ return (isset($lookup[$id]) ? $lookup[$id] : false);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- public function FLVvideoCodec($id) {
- $FLVvideoCodec = array(
</del><ins>+ public static function videoCodecLookup($id) {
+ static $lookup = array(
</ins><span class="cx"> GETID3_FLV_VIDEO_H263 => 'Sorenson H.263',
</span><span class="cx"> GETID3_FLV_VIDEO_SCREEN => 'Screen video',
</span><span class="cx"> GETID3_FLV_VIDEO_VP6FLV => 'On2 VP6',
</span><span class="lines">@@ -366,7 +382,7 @@
</span><span class="cx"> GETID3_FLV_VIDEO_SCREENV2 => 'Screen video v2',
</span><span class="cx"> GETID3_FLV_VIDEO_H264 => 'Sorenson H.264',
</span><span class="cx"> );
</span><del>- return (isset($FLVvideoCodec[$id]) ? $FLVvideoCodec[$id] : false);
</del><ins>+ return (isset($lookup[$id]) ? $lookup[$id] : false);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -374,7 +390,7 @@
</span><span class="cx"> public $bytes;
</span><span class="cx"> public $pos;
</span><span class="cx">
</span><del>- public function AMFStream(&$bytes) {
</del><ins>+ public function __construct(&$bytes) {
</ins><span class="cx"> $this->bytes =& $bytes;
</span><span class="cx"> $this->pos = 0;
</span><span class="cx"> }
</span><span class="lines">@@ -457,7 +473,7 @@
</span><span class="cx"> class AMFReader {
</span><span class="cx"> public $stream;
</span><span class="cx">
</span><del>- public function AMFReader(&$stream) {
</del><ins>+ public function __construct(&$stream) {
</ins><span class="cx"> $this->stream =& $stream;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -619,60 +635,60 @@
</span><span class="cx"> public $width;
</span><span class="cx"> public $height;
</span><span class="cx">
</span><del>- public function AVCSequenceParameterSetReader($sps) {
</del><ins>+ public function __construct($sps) {
</ins><span class="cx"> $this->sps = $sps;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> public function readData() {
</span><span class="cx"> $this->skipBits(8);
</span><span class="cx"> $this->skipBits(8);
</span><del>- $profile = $this->getBits(8); // read profile
- $this->skipBits(16);
- $this->expGolombUe(); // read sps id
- if (in_array($profile, array(H264_PROFILE_HIGH, H264_PROFILE_HIGH10, H264_PROFILE_HIGH422, H264_PROFILE_HIGH444, H264_PROFILE_HIGH444_PREDICTIVE))) {
- if ($this->expGolombUe() == 3) {
- $this->skipBits(1);
- }
- $this->expGolombUe();
- $this->expGolombUe();
- $this->skipBits(1);
- if ($this->getBit()) {
- for ($i = 0; $i < 8; $i++) {
- if ($this->getBit()) {
- $size = $i < 6 ? 16 : 64;
- $lastScale = 8;
- $nextScale = 8;
- for ($j = 0; $j < $size; $j++) {
- if ($nextScale != 0) {
- $deltaScale = $this->expGolombUe();
- $nextScale = ($lastScale + $deltaScale + 256) % 256;
- }
- if ($nextScale != 0) {
- $lastScale = $nextScale;
- }
- }
- }
</del><ins>+ $profile = $this->getBits(8); // read profile
+ if ($profile > 0) {
+ $this->skipBits(8);
+ $level_idc = $this->getBits(8); // level_idc
+ $this->expGolombUe(); // seq_parameter_set_id // sps
+ $this->expGolombUe(); // log2_max_frame_num_minus4
+ $picOrderType = $this->expGolombUe(); // pic_order_cnt_type
+ if ($picOrderType == 0) {
+ $this->expGolombUe(); // log2_max_pic_order_cnt_lsb_minus4
+ } elseif ($picOrderType == 1) {
+ $this->skipBits(1); // delta_pic_order_always_zero_flag
+ $this->expGolombSe(); // offset_for_non_ref_pic
+ $this->expGolombSe(); // offset_for_top_to_bottom_field
+ $num_ref_frames_in_pic_order_cnt_cycle = $this->expGolombUe(); // num_ref_frames_in_pic_order_cnt_cycle
+ for ($i = 0; $i < $num_ref_frames_in_pic_order_cnt_cycle; $i++) {
+ $this->expGolombSe(); // offset_for_ref_frame[ i ]
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- }
- $this->expGolombUe();
- $pocType = $this->expGolombUe();
- if ($pocType == 0) {
- $this->expGolombUe();
- } elseif ($pocType == 1) {
- $this->skipBits(1);
- $this->expGolombSe();
- $this->expGolombSe();
- $pocCycleLength = $this->expGolombUe();
- for ($i = 0; $i < $pocCycleLength; $i++) {
- $this->expGolombSe();
</del><ins>+ $this->expGolombUe(); // num_ref_frames
+ $this->skipBits(1); // gaps_in_frame_num_value_allowed_flag
+ $pic_width_in_mbs_minus1 = $this->expGolombUe(); // pic_width_in_mbs_minus1
+ $pic_height_in_map_units_minus1 = $this->expGolombUe(); // pic_height_in_map_units_minus1
+
+ $frame_mbs_only_flag = $this->getBits(1); // frame_mbs_only_flag
+ if ($frame_mbs_only_flag == 0) {
+ $this->skipBits(1); // mb_adaptive_frame_field_flag
</ins><span class="cx"> }
</span><ins>+ $this->skipBits(1); // direct_8x8_inference_flag
+ $frame_cropping_flag = $this->getBits(1); // frame_cropping_flag
+
+ $frame_crop_left_offset = 0;
+ $frame_crop_right_offset = 0;
+ $frame_crop_top_offset = 0;
+ $frame_crop_bottom_offset = 0;
+
+ if ($frame_cropping_flag) {
+ $frame_crop_left_offset = $this->expGolombUe(); // frame_crop_left_offset
+ $frame_crop_right_offset = $this->expGolombUe(); // frame_crop_right_offset
+ $frame_crop_top_offset = $this->expGolombUe(); // frame_crop_top_offset
+ $frame_crop_bottom_offset = $this->expGolombUe(); // frame_crop_bottom_offset
+ }
+ $this->skipBits(1); // vui_parameters_present_flag
+ // etc
+
+ $this->width = (($pic_width_in_mbs_minus1 + 1) * 16) - ($frame_crop_left_offset * 2) - ($frame_crop_right_offset * 2);
+ $this->height = ((2 - $frame_mbs_only_flag) * ($pic_height_in_map_units_minus1 + 1) * 16) - ($frame_crop_top_offset * 2) - ($frame_crop_bottom_offset * 2);
</ins><span class="cx"> }
</span><del>- $this->expGolombUe();
- $this->skipBits(1);
- $this->width = ($this->expGolombUe() + 1) * 16;
- $heightMap = $this->expGolombUe() + 1;
- $this->height = (2 - $this->getBit()) * $heightMap * 16;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> public function skipBits($bits) {
</span><span class="lines">@@ -726,4 +742,4 @@
</span><span class="cx"> public function getHeight() {
</span><span class="cx"> return $this->height;
</span><span class="cx"> }
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudiovideomatroskaphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio-video.matroska.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio-video.matroska.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio-video.matroska.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -281,10 +282,8 @@
</span><span class="cx">
</span><span class="cx"> switch ($trackarray['CodecID']) {
</span><span class="cx"> case 'V_MS/VFW/FOURCC':
</span><del>- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) {
- $this->warning('Unable to parse codec private data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio-video.riff.php"');
- break;
- }
</del><ins>+ getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
+
</ins><span class="cx"> $parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']);
</span><span class="cx"> $track_info['codec'] = getid3_riff::fourccLookup($parsed['fourcc']);
</span><span class="cx"> $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
</span><span class="lines">@@ -335,10 +334,7 @@
</span><span class="cx"> case 'A_MPEG/L3':
</span><span class="cx"> case 'A_MPEG/L2':
</span><span class="cx"> case 'A_FLAC':
</span><del>- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']).'.php', __FILE__, false)) {
- $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio.'.$track_info['dataformat'].'.php"');
- break;
- }
</del><ins>+ getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']).'.php', __FILE__, true);
</ins><span class="cx">
</span><span class="cx"> if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) {
</span><span class="cx"> $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set');
</span><span class="lines">@@ -385,10 +381,6 @@
</span><span class="cx"> }
</span><span class="cx"> if (!empty($getid3_temp->info['warning'])) {
</span><span class="cx"> foreach ($getid3_temp->info['warning'] as $newerror) {
</span><del>- if ($track_info['dataformat'] == 'mp3' && preg_match('/^Probable truncated file: expecting \d+ bytes of audio data, only found \d+ \(short by \d+ bytes\)$/', $newerror)) {
- // LAME/Xing header is probably set, but audio data is chunked into Matroska file and near-impossible to verify if audio stream is complete, so ignore useless warning
- continue;
- }
</del><span class="cx"> $this->warning($class.'() says: ['.$newerror.']');
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -400,7 +392,7 @@
</span><span class="cx"> case 'A_AAC/MPEG2/LC/SBR':
</span><span class="cx"> case 'A_AAC/MPEG4/LC':
</span><span class="cx"> case 'A_AAC/MPEG4/LC/SBR':
</span><del>- $this->warning($trackarray['CodecID'].' audio data contains no header, audio/video bitrates can\'t be calculated');
</del><ins>+ $this->warning($trackarray['CodecID'].' audio data contains no header, audio/video bitrates can\'t be calculated');
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case 'A_VORBIS':
</span><span class="lines">@@ -415,10 +407,7 @@
</span><span class="cx"> }
</span><span class="cx"> $vorbis_offset -= 1;
</span><span class="cx">
</span><del>- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, false)) {
- $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio.ogg.php"');
- break;
- }
</del><ins>+ getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true);
</ins><span class="cx">
</span><span class="cx"> // create temp instance
</span><span class="cx"> $getid3_temp = new getID3();
</span><span class="lines">@@ -455,10 +444,7 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case 'A_MS/ACM':
</span><del>- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) {
- $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio-video.riff.php"');
- break;
- }
</del><ins>+ getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
</ins><span class="cx">
</span><span class="cx"> $parsed = getid3_riff::parseWAVEFORMATex($trackarray['CodecPrivate']);
</span><span class="cx"> foreach ($parsed as $key => $value) {
</span><span class="lines">@@ -515,7 +501,6 @@
</span><span class="cx"> switch ($top_element['id']) {
</span><span class="cx">
</span><span class="cx"> case EBML_ID_EBML:
</span><del>- $info['fileformat'] = 'matroska';
</del><span class="cx"> $info['matroska']['header']['offset'] = $top_element['offset'];
</span><span class="cx"> $info['matroska']['header']['length'] = $top_element['length'];
</span><span class="cx">
</span><span class="lines">@@ -534,6 +519,7 @@
</span><span class="cx"> case EBML_ID_DOCTYPE:
</span><span class="cx"> $element_data['data'] = getid3_lib::trimNullByte($element_data['data']);
</span><span class="cx"> $info['matroska']['doctype'] = $element_data['data'];
</span><ins>+ $info['fileformat'] = $element_data['data'];
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> default:
</span><span class="lines">@@ -1526,8 +1512,8 @@
</span><span class="cx"> $CodecIDlist['V_MPEG4/ISO/AVC'] = 'h264';
</span><span class="cx"> $CodecIDlist['V_MPEG4/ISO/SP'] = 'mpeg4';
</span><span class="cx"> $CodecIDlist['V_VP8'] = 'vp8';
</span><del>- $CodecIDlist['V_MS/VFW/FOURCC'] = 'riff';
- $CodecIDlist['A_MS/ACM'] = 'riff';
</del><ins>+ $CodecIDlist['V_MS/VFW/FOURCC'] = 'vcm'; // Microsoft (TM) Video Codec Manager (VCM)
+ $CodecIDlist['A_MS/ACM'] = 'acm'; // Microsoft (TM) Audio Codec Manager (ACM)
</ins><span class="cx"> }
</span><span class="cx"> return (isset($CodecIDlist[$codecid]) ? $CodecIDlist[$codecid] : $codecid);
</span><span class="cx"> }
</span><span class="lines">@@ -1762,4 +1748,4 @@
</span><span class="cx"> return $info;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudiovideoquicktimephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio-video.quicktime.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio-video.quicktime.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio-video.quicktime.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -30,7 +31,7 @@
</span><span class="cx"> $info['quicktime']['hinting'] = false;
</span><span class="cx"> $info['quicktime']['controller'] = 'standard'; // may be overridden if 'ctyp' atom is present
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
</del><ins>+ $this->fseek($info['avdataoffset']);
</ins><span class="cx">
</span><span class="cx"> $offset = 0;
</span><span class="cx"> $atomcounter = 0;
</span><span class="lines">@@ -40,15 +41,15 @@
</span><span class="cx"> $info['error'][] = 'Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- fseek($this->getid3->fp, $offset, SEEK_SET);
- $AtomHeader = fread($this->getid3->fp, 8);
</del><ins>+ $this->fseek($offset);
+ $AtomHeader = $this->fread(8);
</ins><span class="cx">
</span><span class="cx"> $atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4));
</span><span class="cx"> $atomname = substr($AtomHeader, 4, 4);
</span><span class="cx">
</span><span class="cx"> // 64-bit MOV patch by jlegateØktnc*com
</span><span class="cx"> if ($atomsize == 1) {
</span><del>- $atomsize = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 8));
</del><ins>+ $atomsize = getid3_lib::BigEndian2Int($this->fread(8));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $info['quicktime'][$atomname]['name'] = $atomname;
</span><span class="lines">@@ -66,59 +67,9 @@
</span><span class="cx"> // to read user data atoms, you should allow for the terminating 0.
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- switch ($atomname) {
- case 'mdat': // Media DATa atom
- // 'mdat' contains the actual data for the audio/video
- if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) {
</del><ins>+ $atomHierarchy = array();
+ $info['quicktime'][$atomname] = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize, round($this->getid3->memory_limit / 2))), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
</ins><span class="cx">
</span><del>- $info['avdataoffset'] = $info['quicktime'][$atomname]['offset'] + 8;
- $OldAVDataEnd = $info['avdataend'];
- $info['avdataend'] = $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size'];
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
- $getid3_temp->info['avdataend'] = $info['avdataend'];
- $getid3_mp3 = new getid3_mp3($getid3_temp);
- if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode(fread($this->getid3->fp, 4)))) {
- $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
- if (!empty($getid3_temp->info['warning'])) {
- foreach ($getid3_temp->info['warning'] as $value) {
- $info['warning'][] = $value;
- }
- }
- if (!empty($getid3_temp->info['mpeg'])) {
- $info['mpeg'] = $getid3_temp->info['mpeg'];
- if (isset($info['mpeg']['audio'])) {
- $info['audio']['dataformat'] = 'mp3';
- $info['audio']['codec'] = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3')));
- $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
- $info['audio']['channels'] = $info['mpeg']['audio']['channels'];
- $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
- $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
- $info['bitrate'] = $info['audio']['bitrate'];
- }
- }
- }
- unset($getid3_mp3, $getid3_temp);
- $info['avdataend'] = $OldAVDataEnd;
- unset($OldAVDataEnd);
-
- }
- break;
-
- case 'free': // FREE space atom
- case 'skip': // SKIP atom
- case 'wide': // 64-bit expansion placeholder atom
- // 'free', 'skip' and 'wide' are just padding, contains no useful data at all
- break;
-
- default:
- $atomHierarchy = array();
- $info['quicktime'][$atomname] = $this->QuicktimeParseAtom($atomname, $atomsize, fread($this->getid3->fp, $atomsize), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
- break;
- }
-
</del><span class="cx"> $offset += $atomsize;
</span><span class="cx"> $atomcounter++;
</span><span class="cx"> }
</span><span class="lines">@@ -172,15 +123,12 @@
</span><span class="cx">
</span><span class="cx"> $info = &$this->getid3->info;
</span><span class="cx">
</span><del>- //$atom_parent = array_pop($atomHierarchy);
- $atom_parent = end($atomHierarchy); // http://www.getid3.org/phpBB3/viewtopic.php?t=1717
</del><ins>+ $atom_parent = end($atomHierarchy); // not array_pop($atomHierarchy); see http://www.getid3.org/phpBB3/viewtopic.php?t=1717
</ins><span class="cx"> array_push($atomHierarchy, $atomname);
</span><span class="cx"> $atom_structure['hierarchy'] = implode(' ', $atomHierarchy);
</span><span class="cx"> $atom_structure['name'] = $atomname;
</span><span class="cx"> $atom_structure['size'] = $atomsize;
</span><span class="cx"> $atom_structure['offset'] = $baseoffset;
</span><del>-//echo getid3_lib::PrintHexBytes(substr($atom_data, 0, 8)).'<br>';
-//echo getid3_lib::PrintHexBytes(substr($atom_data, 0, 8), false).'<br><br>';
</del><span class="cx"> switch ($atomname) {
</span><span class="cx"> case 'moov': // MOVie container atom
</span><span class="cx"> case 'trak': // TRAcK container atom
</span><span class="lines">@@ -200,27 +148,27 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case 'ilst': // Item LiST container atom
</span><del>- $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
-
- // some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted
- $allnumericnames = true;
- foreach ($atom_structure['subatoms'] as $subatomarray) {
- if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) {
- $allnumericnames = false;
- break;
- }
- }
- if ($allnumericnames) {
- $newData = array();
</del><ins>+ if ($atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms)) {
+ // some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted
+ $allnumericnames = true;
</ins><span class="cx"> foreach ($atom_structure['subatoms'] as $subatomarray) {
</span><del>- foreach ($subatomarray['subatoms'] as $newData_subatomarray) {
- unset($newData_subatomarray['hierarchy'], $newData_subatomarray['name']);
- $newData[$subatomarray['name']] = $newData_subatomarray;
</del><ins>+ if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) {
+ $allnumericnames = false;
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- $atom_structure['data'] = $newData;
- unset($atom_structure['subatoms']);
</del><ins>+ if ($allnumericnames) {
+ $newData = array();
+ foreach ($atom_structure['subatoms'] as $subatomarray) {
+ foreach ($subatomarray['subatoms'] as $newData_subatomarray) {
+ unset($newData_subatomarray['hierarchy'], $newData_subatomarray['name']);
+ $newData[$subatomarray['name']] = $newData_subatomarray;
+ break;
+ }
+ }
+ $atom_structure['data'] = $newData;
+ unset($atom_structure['subatoms']);
+ }
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -308,46 +256,46 @@
</span><span class="cx"> case 'geID':
</span><span class="cx"> case 'plID':
</span><span class="cx"> case 'sfID': // iTunes store country
</span><del>- case '©alb': // ALBum
- case '©art': // ARTist
- case '©ART':
- case '©aut':
- case '©cmt': // CoMmenT
- case '©com': // COMposer
- case '©cpy':
- case '©day': // content created year
- case '©dir':
- case '©ed1':
- case '©ed2':
- case '©ed3':
- case '©ed4':
- case '©ed5':
- case '©ed6':
- case '©ed7':
- case '©ed8':
- case '©ed9':
- case '©enc':
- case '©fmt':
- case '©gen': // GENre
- case '©grp': // GRouPing
- case '©hst':
- case '©inf':
- case '©lyr': // LYRics
- case '©mak':
- case '©mod':
- case '©nam': // full NAMe
- case '©ope':
- case '©PRD':
- case '©prd':
- case '©prf':
- case '©req':
- case '©src':
- case '©swr':
- case '©too': // encoder
- case '©trk': // TRacK
- case '©url':
- case '©wrn':
- case '©wrt': // WRiTer
</del><ins>+ case "\xA9".'alb': // ALBum
+ case "\xA9".'art': // ARTist
+ case "\xA9".'ART':
+ case "\xA9".'aut':
+ case "\xA9".'cmt': // CoMmenT
+ case "\xA9".'com': // COMposer
+ case "\xA9".'cpy':
+ case "\xA9".'day': // content created year
+ case "\xA9".'dir':
+ case "\xA9".'ed1':
+ case "\xA9".'ed2':
+ case "\xA9".'ed3':
+ case "\xA9".'ed4':
+ case "\xA9".'ed5':
+ case "\xA9".'ed6':
+ case "\xA9".'ed7':
+ case "\xA9".'ed8':
+ case "\xA9".'ed9':
+ case "\xA9".'enc':
+ case "\xA9".'fmt':
+ case "\xA9".'gen': // GENre
+ case "\xA9".'grp': // GRouPing
+ case "\xA9".'hst':
+ case "\xA9".'inf':
+ case "\xA9".'lyr': // LYRics
+ case "\xA9".'mak':
+ case "\xA9".'mod':
+ case "\xA9".'nam': // full NAMe
+ case "\xA9".'ope':
+ case "\xA9".'PRD':
+ case "\xA9".'prd':
+ case "\xA9".'prf':
+ case "\xA9".'req':
+ case "\xA9".'src':
+ case "\xA9".'swr':
+ case "\xA9".'too': // encoder
+ case "\xA9".'trk': // TRacK
+ case "\xA9".'url':
+ case "\xA9".'wrn':
+ case "\xA9".'wrt': // WRiTer
</ins><span class="cx"> case '----': // itunes specific
</span><span class="cx"> if ($atom_parent == 'udta') {
</span><span class="cx"> // User data atom handler
</span><span class="lines">@@ -370,7 +318,7 @@
</span><span class="cx"> $boxsmalltype = substr($atom_data, $atomoffset + 2, 2);
</span><span class="cx"> $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize);
</span><span class="cx"> if ($boxsmallsize <= 1) {
</span><del>- $info['warning'][] = 'Invalid QuickTime atom smallbox size "'.$boxsmallsize.'" in atom "'.$atomname.'" at offset: '.($atom_structure['offset'] + $atomoffset);
</del><ins>+ $info['warning'][] = 'Invalid QuickTime atom smallbox size "'.$boxsmallsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset);
</ins><span class="cx"> $atom_structure['data'] = null;
</span><span class="cx"> $atomoffset = strlen($atom_data);
</span><span class="cx"> break;
</span><span class="lines">@@ -380,7 +328,7 @@
</span><span class="cx"> $atom_structure['data'] = $boxsmalldata;
</span><span class="cx"> break;
</span><span class="cx"> default:
</span><del>- $info['warning'][] = 'Unknown QuickTime smallbox type: "'.getid3_lib::PrintHexBytes($boxsmalltype).'" at offset '.$baseoffset;
</del><ins>+ $info['warning'][] = 'Unknown QuickTime smallbox type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $boxsmalltype).'" ('.trim(getid3_lib::PrintHexBytes($boxsmalltype)).') at offset '.$baseoffset;
</ins><span class="cx"> $atom_structure['data'] = $atom_data;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -392,7 +340,7 @@
</span><span class="cx"> $boxtype = substr($atom_data, $atomoffset + 4, 4);
</span><span class="cx"> $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8);
</span><span class="cx"> if ($boxsize <= 1) {
</span><del>- $info['warning'][] = 'Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.$atomname.'" at offset: '.($atom_structure['offset'] + $atomoffset);
</del><ins>+ $info['warning'][] = 'Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset);
</ins><span class="cx"> $atom_structure['data'] = null;
</span><span class="cx"> $atomoffset = strlen($atom_data);
</span><span class="cx"> break;
</span><span class="lines">@@ -409,7 +357,7 @@
</span><span class="cx"> $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1));
</span><span class="cx"> $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3));
</span><span class="cx"> switch ($atom_structure['flags_raw']) {
</span><del>- case 0: // data flag
</del><ins>+ case 0: // data flag
</ins><span class="cx"> case 21: // tmpo/cpil flag
</span><span class="cx"> switch ($atomname) {
</span><span class="cx"> case 'cpil':
</span><span class="lines">@@ -460,17 +408,27 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case 1: // text flag
</del><ins>+ case 1: // text flag
</ins><span class="cx"> case 13: // image flag
</span><span class="cx"> default:
</span><span class="cx"> $atom_structure['data'] = substr($boxdata, 8);
</span><ins>+ if ($atomname == 'covr') {
+ // not a foolproof check, but better than nothing
+ if (preg_match('#^\xFF\xD8\xFF#', $atom_structure['data'])) {
+ $atom_structure['image_mime'] = 'image/jpeg';
+ } elseif (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $atom_structure['data'])) {
+ $atom_structure['image_mime'] = 'image/png';
+ } elseif (preg_match('#^GIF#', $atom_structure['data'])) {
+ $atom_structure['image_mime'] = 'image/gif';
+ }
+ }
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> default:
</span><del>- $info['warning'][] = 'Unknown QuickTime box type: "'.getid3_lib::PrintHexBytes($boxtype).'" at offset '.$baseoffset;
</del><ins>+ $info['warning'][] = 'Unknown QuickTime box type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $boxtype).'" ('.trim(getid3_lib::PrintHexBytes($boxtype)).') at offset '.$baseoffset;
</ins><span class="cx"> $atom_structure['data'] = $atom_data;
</span><span class="cx">
</span><span class="cx"> }
</span><span class="lines">@@ -840,7 +798,12 @@
</span><span class="cx"> $sttsEntriesDataOffset = 8;
</span><span class="cx"> //$FrameRateCalculatorArray = array();
</span><span class="cx"> $frames_count = 0;
</span><del>- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
</del><ins>+
+ $max_stts_entries_to_scan = min(floor($this->getid3->memory_limit / 10000), $atom_structure['number_entries']);
+ if ($max_stts_entries_to_scan < $atom_structure['number_entries']) {
+ $info['warning'][] = 'QuickTime atom "stts" has '.$atom_structure['number_entries'].' but only scanning the first '.$max_stts_entries_to_scan.' entries due to limited PHP memory available ('.floor($this->getid3->memory_limit / 1048576).'MB).';
+ }
+ for ($i = 0; $i < $max_stts_entries_to_scan; $i++) {
</ins><span class="cx"> $atom_structure['time_to_sample_table'][$i]['sample_count'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
</span><span class="cx"> $sttsEntriesDataOffset += 4;
</span><span class="cx"> $atom_structure['time_to_sample_table'][$i]['sample_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
</span><span class="lines">@@ -1086,8 +1049,8 @@
</span><span class="cx"> case 'sync': // SYNChronization atom
</span><span class="cx"> case 'scpt': // tranSCriPT atom
</span><span class="cx"> case 'ssrc': // non-primary SouRCe atom
</span><del>- for ($i = 0; $i < (strlen($atom_data) % 4); $i++) {
- $atom_structure['track_id'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $i * 4, 4));
</del><ins>+ for ($i = 0; $i < strlen($atom_data); $i += 4) {
+ @$atom_structure['track_id'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -1260,10 +1223,76 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case 'mdat': // Media DATa atom
</span><ins>+ // 'mdat' contains the actual data for the audio/video, possibly also subtitles
+
+/* due to lack of known documentation, this is a kludge implementation. If you know of documentation on how mdat is properly structed, please send it to info@getid3.org */
+
+ // first, skip any 'wide' padding, and second 'mdat' header (with specified size of zero?)
+ $mdat_offset = 0;
+ while (true) {
+ if (substr($atom_data, $mdat_offset, 8) == "\x00\x00\x00\x08".'wide') {
+ $mdat_offset += 8;
+ } elseif (substr($atom_data, $mdat_offset, 8) == "\x00\x00\x00\x00".'mdat') {
+ $mdat_offset += 8;
+ } else {
+ break;
+ }
+ }
+
+ // check to see if it looks like chapter titles, in the form of unterminated strings with a leading 16-bit size field
+ while (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2)))
+ && ($chapter_string_length < 1000)
+ && ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2))
+ && preg_match('#^[\x20-\xFF]+$#', substr($atom_data, $mdat_offset + 2, $chapter_string_length), $chapter_matches)) {
+ $mdat_offset += (2 + $chapter_string_length);
+ @$info['quicktime']['comments']['chapters'][] = $chapter_matches[0];
+ }
+
+
+
+ if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) {
+
+ $info['avdataoffset'] = $atom_structure['offset'] + 8; // $info['quicktime'][$atomname]['offset'] + 8;
+ $OldAVDataEnd = $info['avdataend'];
+ $info['avdataend'] = $atom_structure['offset'] + $atom_structure['size']; // $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size'];
+
+ $getid3_temp = new getID3();
+ $getid3_temp->openfile($this->getid3->filename);
+ $getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
+ $getid3_temp->info['avdataend'] = $info['avdataend'];
+ $getid3_mp3 = new getid3_mp3($getid3_temp);
+ if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) {
+ $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
+ if (!empty($getid3_temp->info['warning'])) {
+ foreach ($getid3_temp->info['warning'] as $value) {
+ $info['warning'][] = $value;
+ }
+ }
+ if (!empty($getid3_temp->info['mpeg'])) {
+ $info['mpeg'] = $getid3_temp->info['mpeg'];
+ if (isset($info['mpeg']['audio'])) {
+ $info['audio']['dataformat'] = 'mp3';
+ $info['audio']['codec'] = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3')));
+ $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
+ $info['audio']['channels'] = $info['mpeg']['audio']['channels'];
+ $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
+ $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
+ $info['bitrate'] = $info['audio']['bitrate'];
+ }
+ }
+ }
+ unset($getid3_mp3, $getid3_temp);
+ $info['avdataend'] = $OldAVDataEnd;
+ unset($OldAVDataEnd);
+
+ }
+
+ unset($mdat_offset, $chapter_string_length, $chapter_matches);
+ break;
+
</ins><span class="cx"> case 'free': // FREE space atom
</span><span class="cx"> case 'skip': // SKIP atom
</span><span class="cx"> case 'wide': // 64-bit expansion placeholder atom
</span><del>- // 'mdat' data is too big to deal with, contains no useful metadata
</del><span class="cx"> // 'free', 'skip' and 'wide' are just padding, contains no useful data at all
</span><span class="cx">
</span><span class="cx"> // When writing QuickTime files, it is sometimes necessary to update an atom's size.
</span><span class="lines">@@ -1329,7 +1358,7 @@
</span><span class="cx"> //$atom_structure['data'] = $atom_data;
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case '©xyz': // GPS latitude+longitude+altitude
</del><ins>+ case "\xA9".'xyz': // GPS latitude+longitude+altitude
</ins><span class="cx"> $atom_structure['data'] = $atom_data;
</span><span class="cx"> if (preg_match('#([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)?/$#i', $atom_data, $matches)) {
</span><span class="cx"> @list($all, $latitude, $longitude, $altitude) = $matches;
</span><span class="lines">@@ -1358,16 +1387,12 @@
</span><span class="cx"> $info['quicktime']['comments']['picture'][] = array('image_mime'=>$atom_structure['image_mime'], 'data'=>$atom_data, 'description'=>$atom_structure['description']);
</span><span class="cx"> }
</span><span class="cx"> break;
</span><del>- case 'NCHD': // MakerNoteVersion
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
- $atom_structure['data'] = $atom_data;
- break;
- case 'NCTG': // NikonTags
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG
</del><ins>+ case 'NCTG': // Nikon - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG
</ins><span class="cx"> $atom_structure['data'] = $this->QuicktimeParseNikonNCTG($atom_data);
</span><span class="cx"> break;
</span><del>- case 'NCDB': // NikonTags
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
</del><ins>+ case 'NCHD': // Nikon:MakerNoteVersion - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+ case 'NCDB': // Nikon - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+ case 'CNCV': // Canon:CompressorVersion - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html
</ins><span class="cx"> $atom_structure['data'] = $atom_data;
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="lines">@@ -1391,7 +1416,7 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> default:
</span><del>- $info['warning'][] = 'Unknown QuickTime atom type: "'.$atomname.'" ('.trim(getid3_lib::PrintHexBytes($atomname)).') at offset '.$baseoffset;
</del><ins>+ $info['warning'][] = 'Unknown QuickTime atom type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" ('.trim(getid3_lib::PrintHexBytes($atomname)).') at offset '.$baseoffset;
</ins><span class="cx"> $atom_structure['data'] = $atom_data;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -2086,58 +2111,58 @@
</span><span class="cx"> public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') {
</span><span class="cx"> static $handyatomtranslatorarray = array();
</span><span class="cx"> if (empty($handyatomtranslatorarray)) {
</span><del>- $handyatomtranslatorarray['©cpy'] = 'copyright';
- $handyatomtranslatorarray['©day'] = 'creation_date'; // iTunes 4.0
- $handyatomtranslatorarray['©dir'] = 'director';
- $handyatomtranslatorarray['©ed1'] = 'edit1';
- $handyatomtranslatorarray['©ed2'] = 'edit2';
- $handyatomtranslatorarray['©ed3'] = 'edit3';
- $handyatomtranslatorarray['©ed4'] = 'edit4';
- $handyatomtranslatorarray['©ed5'] = 'edit5';
- $handyatomtranslatorarray['©ed6'] = 'edit6';
- $handyatomtranslatorarray['©ed7'] = 'edit7';
- $handyatomtranslatorarray['©ed8'] = 'edit8';
- $handyatomtranslatorarray['©ed9'] = 'edit9';
- $handyatomtranslatorarray['©fmt'] = 'format';
- $handyatomtranslatorarray['©inf'] = 'information';
- $handyatomtranslatorarray['©prd'] = 'producer';
- $handyatomtranslatorarray['©prf'] = 'performers';
- $handyatomtranslatorarray['©req'] = 'system_requirements';
- $handyatomtranslatorarray['©src'] = 'source_credit';
- $handyatomtranslatorarray['©wrt'] = 'writer';
</del><ins>+ $handyatomtranslatorarray["\xA9".'cpy'] = 'copyright';
+ $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0
+ $handyatomtranslatorarray["\xA9".'dir'] = 'director';
+ $handyatomtranslatorarray["\xA9".'ed1'] = 'edit1';
+ $handyatomtranslatorarray["\xA9".'ed2'] = 'edit2';
+ $handyatomtranslatorarray["\xA9".'ed3'] = 'edit3';
+ $handyatomtranslatorarray["\xA9".'ed4'] = 'edit4';
+ $handyatomtranslatorarray["\xA9".'ed5'] = 'edit5';
+ $handyatomtranslatorarray["\xA9".'ed6'] = 'edit6';
+ $handyatomtranslatorarray["\xA9".'ed7'] = 'edit7';
+ $handyatomtranslatorarray["\xA9".'ed8'] = 'edit8';
+ $handyatomtranslatorarray["\xA9".'ed9'] = 'edit9';
+ $handyatomtranslatorarray["\xA9".'fmt'] = 'format';
+ $handyatomtranslatorarray["\xA9".'inf'] = 'information';
+ $handyatomtranslatorarray["\xA9".'prd'] = 'producer';
+ $handyatomtranslatorarray["\xA9".'prf'] = 'performers';
+ $handyatomtranslatorarray["\xA9".'req'] = 'system_requirements';
+ $handyatomtranslatorarray["\xA9".'src'] = 'source_credit';
+ $handyatomtranslatorarray["\xA9".'wrt'] = 'writer';
</ins><span class="cx">
</span><span class="cx"> // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt
</span><del>- $handyatomtranslatorarray['©nam'] = 'title'; // iTunes 4.0
- $handyatomtranslatorarray['©cmt'] = 'comment'; // iTunes 4.0
- $handyatomtranslatorarray['©wrn'] = 'warning';
- $handyatomtranslatorarray['©hst'] = 'host_computer';
- $handyatomtranslatorarray['©mak'] = 'make';
- $handyatomtranslatorarray['©mod'] = 'model';
- $handyatomtranslatorarray['©PRD'] = 'product';
- $handyatomtranslatorarray['©swr'] = 'software';
- $handyatomtranslatorarray['©aut'] = 'author';
- $handyatomtranslatorarray['©ART'] = 'artist';
- $handyatomtranslatorarray['©trk'] = 'track';
- $handyatomtranslatorarray['©alb'] = 'album'; // iTunes 4.0
- $handyatomtranslatorarray['©com'] = 'comment';
- $handyatomtranslatorarray['©gen'] = 'genre'; // iTunes 4.0
- $handyatomtranslatorarray['©ope'] = 'composer';
- $handyatomtranslatorarray['©url'] = 'url';
- $handyatomtranslatorarray['©enc'] = 'encoder';
</del><ins>+ $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0
+ $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0
+ $handyatomtranslatorarray["\xA9".'wrn'] = 'warning';
+ $handyatomtranslatorarray["\xA9".'hst'] = 'host_computer';
+ $handyatomtranslatorarray["\xA9".'mak'] = 'make';
+ $handyatomtranslatorarray["\xA9".'mod'] = 'model';
+ $handyatomtranslatorarray["\xA9".'PRD'] = 'product';
+ $handyatomtranslatorarray["\xA9".'swr'] = 'software';
+ $handyatomtranslatorarray["\xA9".'aut'] = 'author';
+ $handyatomtranslatorarray["\xA9".'ART'] = 'artist';
+ $handyatomtranslatorarray["\xA9".'trk'] = 'track';
+ $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0
+ $handyatomtranslatorarray["\xA9".'com'] = 'comment';
+ $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0
+ $handyatomtranslatorarray["\xA9".'ope'] = 'composer';
+ $handyatomtranslatorarray["\xA9".'url'] = 'url';
+ $handyatomtranslatorarray["\xA9".'enc'] = 'encoder';
</ins><span class="cx">
</span><span class="cx"> // http://atomicparsley.sourceforge.net/mpeg-4files.html
</span><del>- $handyatomtranslatorarray['©art'] = 'artist'; // iTunes 4.0
</del><ins>+ $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0
</ins><span class="cx"> $handyatomtranslatorarray['aART'] = 'album_artist';
</span><span class="cx"> $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0
</span><span class="cx"> $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0
</span><span class="cx"> $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0
</span><del>- $handyatomtranslatorarray['©too'] = 'encoder'; // iTunes 4.0
</del><ins>+ $handyatomtranslatorarray["\xA9".'too'] = 'encoder'; // iTunes 4.0
</ins><span class="cx"> $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0
</span><span class="cx"> $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0?
</span><span class="cx"> $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0
</span><span class="cx"> $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0
</span><span class="cx"> $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0
</span><del>- $handyatomtranslatorarray['©grp'] = 'grouping'; // iTunes 4.2
</del><ins>+ $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2
</ins><span class="cx"> $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9
</span><span class="cx"> $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9
</span><span class="cx"> $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9
</span><span class="lines">@@ -2145,7 +2170,7 @@
</span><span class="cx"> $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9
</span><span class="cx"> $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9
</span><span class="cx"> $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0
</span><del>- $handyatomtranslatorarray['©lyr'] = 'lyrics'; // iTunes 5.0
</del><ins>+ $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0
</ins><span class="cx"> $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0
</span><span class="cx"> $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0
</span><span class="cx"> $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0
</span><span class="lines">@@ -2218,4 +2243,4 @@
</span><span class="cx"> return substr($pascalstring, 1);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudiovideoriffphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio-video.riff.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio-video.riff.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio-video.riff.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -26,9 +27,10 @@
</span><span class="cx"> getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, true);
</span><span class="cx"> getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.dts.php', __FILE__, true);
</span><span class="cx">
</span><del>-class getid3_riff extends getid3_handler
-{
</del><ins>+class getid3_riff extends getid3_handler {
</ins><span class="cx">
</span><ins>+ protected $container = 'riff'; // default
+
</ins><span class="cx"> public function Analyze() {
</span><span class="cx"> $info = &$this->getid3->info;
</span><span class="cx">
</span><span class="lines">@@ -58,7 +60,8 @@
</span><span class="cx"> switch ($RIFFtype) {
</span><span class="cx">
</span><span class="cx"> case 'FORM': // AIFF, AIFC
</span><del>- $info['fileformat'] = 'aiff';
</del><ins>+ //$info['fileformat'] = 'aiff';
+ $this->container = 'aiff';
</ins><span class="cx"> $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize);
</span><span class="cx"> $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4));
</span><span class="cx"> break;
</span><span class="lines">@@ -66,13 +69,18 @@
</span><span class="cx"> case 'RIFF': // AVI, WAV, etc
</span><span class="cx"> case 'SDSS': // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com)
</span><span class="cx"> case 'RMP3': // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s
</span><del>- $info['fileformat'] = 'riff';
</del><ins>+ //$info['fileformat'] = 'riff';
+ $this->container = 'riff';
</ins><span class="cx"> $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize);
</span><span class="cx"> if ($RIFFsubtype == 'RMP3') {
</span><span class="cx"> // RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s
</span><span class="cx"> $RIFFsubtype = 'WAVE';
</span><span class="cx"> }
</span><del>- $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4));
</del><ins>+ if ($RIFFsubtype != 'AMV ') {
+ // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size
+ // Handled separately in ParseRIFFAMV()
+ $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4));
+ }
</ins><span class="cx"> if (($info['avdataend'] - $info['filesize']) == 1) {
</span><span class="cx"> // LiteWave appears to incorrectly *not* pad actual output file
</span><span class="cx"> // to nearest WORD boundary so may appear to be short by one
</span><span class="lines">@@ -110,16 +118,19 @@
</span><span class="cx"> $nextRIFFoffset = $chunkdata['offset'] + $chunkdata['size'];
</span><span class="cx">
</span><span class="cx"> switch ($nextRIFFheaderID) {
</span><del>-
</del><span class="cx"> case 'RIFF':
</span><span class="cx"> $chunkdata['chunks'] = $this->ParseRIFF($chunkdata['offset'] + 4, $nextRIFFoffset);
</span><del>-
</del><span class="cx"> if (!isset($thisfile_riff[$nextRIFFtype])) {
</span><span class="cx"> $thisfile_riff[$nextRIFFtype] = array();
</span><span class="cx"> }
</span><span class="cx"> $thisfile_riff[$nextRIFFtype][] = $chunkdata;
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case 'AMV ':
+ unset($info['riff']);
+ $info['amv'] = $this->ParseRIFFAMV($chunkdata['offset'] + 4, $nextRIFFoffset);
+ break;
+
</ins><span class="cx"> case 'JUNK':
</span><span class="cx"> // ignore
</span><span class="cx"> $thisfile_riff[$nextRIFFheaderID][] = $chunkdata;
</span><span class="lines">@@ -152,13 +163,17 @@
</span><span class="cx">
</span><span class="cx"> default:
</span><span class="cx"> $this->error('Cannot parse RIFF (this is maybe not a RIFF / WAV / AVI file?) - expecting "FORM|RIFF|SDSS|RMP3" found "'.$RIFFsubtype.'" instead');
</span><del>- unset($info['fileformat']);
</del><ins>+ //unset($info['fileformat']);
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $streamindex = 0;
</span><span class="cx"> switch ($RIFFsubtype) {
</span><ins>+
+ // http://en.wikipedia.org/wiki/Wav
</ins><span class="cx"> case 'WAVE':
</span><ins>+ $info['fileformat'] = 'wav';
+
</ins><span class="cx"> if (empty($thisfile_audio['bitrate_mode'])) {
</span><span class="cx"> $thisfile_audio['bitrate_mode'] = 'cbr';
</span><span class="cx"> }
</span><span class="lines">@@ -588,10 +603,13 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ // http://en.wikipedia.org/wiki/Audio_Video_Interleave
</ins><span class="cx"> case 'AVI ':
</span><ins>+ $info['fileformat'] = 'avi';
+ $info['mime_type'] = 'video/avi';
+
</ins><span class="cx"> $thisfile_video['bitrate_mode'] = 'vbr'; // maybe not, but probably
</span><span class="cx"> $thisfile_video['dataformat'] = 'avi';
</span><del>- $info['mime_type'] = 'video/avi';
</del><span class="cx">
</span><span class="cx"> if (isset($thisfile_riff[$RIFFsubtype]['movi']['offset'])) {
</span><span class="cx"> $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['movi']['offset'] + 8;
</span><span class="lines">@@ -825,7 +843,7 @@
</span><span class="cx">
</span><span class="cx"> switch ($strhfccType) {
</span><span class="cx"> case 'vids':
</span><del>- $thisfile_riff_raw_strf_strhfccType_streamindex = self::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), ($info['fileformat'] == 'riff'));
</del><ins>+ $thisfile_riff_raw_strf_strhfccType_streamindex = self::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), ($this->container == 'riff'));
</ins><span class="cx"> $thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount'];
</span><span class="cx">
</span><span class="cx"> if ($thisfile_riff_video_current['codec'] == 'DV') {
</span><span class="lines">@@ -875,11 +893,28 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+
+ case 'AMV ':
+ $info['fileformat'] = 'amv';
+ $info['mime_type'] = 'video/amv';
+
+ $thisfile_video['bitrate_mode'] = 'vbr'; // it's MJPEG, presumably contant-quality encoding, thereby VBR
+ $thisfile_video['dataformat'] = 'mjpeg';
+ $thisfile_video['codec'] = 'mjpeg';
+ $thisfile_video['lossless'] = false;
+ $thisfile_video['bits_per_sample'] = 24;
+
+ $thisfile_audio['dataformat'] = 'adpcm';
+ $thisfile_audio['lossless'] = false;
+ break;
+
+
+ // http://en.wikipedia.org/wiki/CD-DA
</ins><span class="cx"> case 'CDDA':
</span><del>- $thisfile_audio['bitrate_mode'] = 'cbr';
</del><ins>+ $info['fileformat'] = 'cda';
+ unset($info['mime_type']);
+
</ins><span class="cx"> $thisfile_audio_dataformat = 'cda';
</span><del>- $thisfile_audio['lossless'] = true;
- unset($info['mime_type']);
</del><span class="cx">
</span><span class="cx"> $info['avdataoffset'] = 44;
</span><span class="cx">
</span><span class="lines">@@ -901,6 +936,7 @@
</span><span class="cx"> $info['playtime_seconds'] = $thisfile_riff_CDDA_fmt_0['playtime_seconds'];
</span><span class="cx">
</span><span class="cx"> // hardcoded data for CD-audio
</span><ins>+ $thisfile_audio['lossless'] = true;
</ins><span class="cx"> $thisfile_audio['sample_rate'] = 44100;
</span><span class="cx"> $thisfile_audio['channels'] = 2;
</span><span class="cx"> $thisfile_audio['bits_per_sample'] = 16;
</span><span class="lines">@@ -909,13 +945,15 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><del>-
</del><ins>+ // http://en.wikipedia.org/wiki/AIFF
</ins><span class="cx"> case 'AIFF':
</span><span class="cx"> case 'AIFC':
</span><ins>+ $info['fileformat'] = 'aiff';
+ $info['mime_type'] = 'audio/x-aiff';
+
</ins><span class="cx"> $thisfile_audio['bitrate_mode'] = 'cbr';
</span><span class="cx"> $thisfile_audio_dataformat = 'aiff';
</span><span class="cx"> $thisfile_audio['lossless'] = true;
</span><del>- $info['mime_type'] = 'audio/x-aiff';
</del><span class="cx">
</span><span class="cx"> if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) {
</span><span class="cx"> $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8;
</span><span class="lines">@@ -1028,12 +1066,15 @@
</span><span class="cx"> */
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ // http://en.wikipedia.org/wiki/8SVX
</ins><span class="cx"> case '8SVX':
</span><ins>+ $info['fileformat'] = '8svx';
+ $info['mime_type'] = 'audio/8svx';
+
</ins><span class="cx"> $thisfile_audio['bitrate_mode'] = 'cbr';
</span><span class="cx"> $thisfile_audio_dataformat = '8svx';
</span><span class="cx"> $thisfile_audio['bits_per_sample'] = 8;
</span><span class="cx"> $thisfile_audio['channels'] = 1; // overridden below, if need be
</span><del>- $info['mime_type'] = 'audio/x-aiff';
</del><span class="cx">
</span><span class="cx"> if (isset($thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'])) {
</span><span class="cx"> $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'] + 8;
</span><span class="lines">@@ -1108,31 +1149,31 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case 'CDXA':
+ $info['fileformat'] = 'vcd'; // Asume Video CD
+ $info['mime_type'] = 'video/mpeg';
</ins><span class="cx">
</span><del>- case 'CDXA':
- $info['mime_type'] = 'video/mpeg';
</del><span class="cx"> if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) {
</span><del>- if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, false)) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_mpeg = new getid3_mpeg($getid3_temp);
- $getid3_mpeg->Analyze();
- if (empty($getid3_temp->info['error'])) {
- $info['audio'] = $getid3_temp->info['audio'];
- $info['video'] = $getid3_temp->info['video'];
- $info['mpeg'] = $getid3_temp->info['mpeg'];
- $info['warning'] = $getid3_temp->info['warning'];
- }
- unset($getid3_temp, $getid3_mpeg);
</del><ins>+ getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, true);
+
+ $getid3_temp = new getID3();
+ $getid3_temp->openfile($this->getid3->filename);
+ $getid3_mpeg = new getid3_mpeg($getid3_temp);
+ $getid3_mpeg->Analyze();
+ if (empty($getid3_temp->info['error'])) {
+ $info['audio'] = $getid3_temp->info['audio'];
+ $info['video'] = $getid3_temp->info['video'];
+ $info['mpeg'] = $getid3_temp->info['mpeg'];
+ $info['warning'] = $getid3_temp->info['warning'];
</ins><span class="cx"> }
</span><ins>+ unset($getid3_temp, $getid3_mpeg);
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> default:
</span><span class="cx"> $info['error'][] = 'Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA), found "'.$RIFFsubtype.'" instead';
</span><del>- unset($info['fileformat']);
- break;
</del><ins>+ //unset($info['fileformat']);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> switch ($RIFFsubtype) {
</span><span class="lines">@@ -1150,6 +1191,7 @@
</span><span class="cx">
</span><span class="cx"> if (isset($thisfile_riff[$RIFFsubtype]['id3 '])) {
</span><span class="cx"> getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
</span><ins>+
</ins><span class="cx"> $getid3_temp = new getID3();
</span><span class="cx"> $getid3_temp->openfile($this->getid3->filename);
</span><span class="cx"> $getid3_id3v2 = new getid3_id3v2($getid3_temp);
</span><span class="lines">@@ -1278,6 +1320,115 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ public function ParseRIFFAMV($startoffset, $maxoffset) {
+ // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size
+
+ // https://code.google.com/p/amv-codec-tools/wiki/AmvDocumentation
+ //typedef struct _amvmainheader {
+ //FOURCC fcc; // 'amvh'
+ //DWORD cb;
+ //DWORD dwMicroSecPerFrame;
+ //BYTE reserve[28];
+ //DWORD dwWidth;
+ //DWORD dwHeight;
+ //DWORD dwSpeed;
+ //DWORD reserve0;
+ //DWORD reserve1;
+ //BYTE bTimeSec;
+ //BYTE bTimeMin;
+ //WORD wTimeHour;
+ //} AMVMAINHEADER;
+
+ $info = &$this->getid3->info;
+ $RIFFchunk = false;
+
+ try {
+
+ $this->fseek($startoffset);
+ $maxoffset = min($maxoffset, $info['avdataend']);
+ $AMVheader = $this->fread(284);
+ if (substr($AMVheader, 0, 8) != 'hdrlamvh') {
+ throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"');
+ }
+ if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes
+ throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"');
+ }
+ $RIFFchunk = array();
+ $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4));
+ $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved?
+ $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4));
+ $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4));
+ $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4));
+ $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved?
+ $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved?
+ $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1));
+ $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1));
+ $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2));
+
+ $info['video']['frame_rate'] = 1000000 / $RIFFchunk['amvh']['us_per_frame'];
+ $info['video']['resolution_x'] = $RIFFchunk['amvh']['resolution_x'];
+ $info['video']['resolution_y'] = $RIFFchunk['amvh']['resolution_y'];
+ $info['playtime_seconds'] = ($RIFFchunk['amvh']['runtime_hrs'] * 3600) + ($RIFFchunk['amvh']['runtime_min'] * 60) + $RIFFchunk['amvh']['runtime_sec'];
+
+ // the rest is all hardcoded(?) and does not appear to be useful until you get to audio info at offset 256, even then everything is probably hardcoded
+
+ if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") {
+ throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"');
+ }
+ // followed by 56 bytes of null: substr($AMVheader, 88, 56) -> 144
+ if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") {
+ throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"');
+ }
+ // followed by 36 bytes of null: substr($AMVheader, 144, 36) -> 180
+
+ if (substr($AMVheader, 188, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x30\x00\x00\x00") {
+ throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"');
+ }
+ // followed by 48 bytes of null: substr($AMVheader, 208, 48) -> 256
+ if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") {
+ throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"');
+ }
+ // followed by 20 bytes of a modified WAVEFORMATEX:
+ // typedef struct {
+ // WORD wFormatTag; //(Fixme: this is equal to PCM's 0x01 format code)
+ // WORD nChannels; //(Fixme: this is always 1)
+ // DWORD nSamplesPerSec; //(Fixme: for all known sample files this is equal to 22050)
+ // DWORD nAvgBytesPerSec; //(Fixme: for all known sample files this is equal to 44100)
+ // WORD nBlockAlign; //(Fixme: this seems to be 2 in AMV files, is this correct ?)
+ // WORD wBitsPerSample; //(Fixme: this seems to be 16 in AMV files instead of the expected 4)
+ // WORD cbSize; //(Fixme: this seems to be 0 in AMV files)
+ // WORD reserved;
+ // } WAVEFORMATEX;
+ $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2));
+ $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2));
+ $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4));
+ $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4));
+ $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2));
+ $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2));
+ $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2));
+ $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2));
+
+
+ $info['audio']['lossless'] = false;
+ $info['audio']['sample_rate'] = $RIFFchunk['strf']['nsamplespersec'];
+ $info['audio']['channels'] = $RIFFchunk['strf']['nchannels'];
+ $info['audio']['bits_per_sample'] = $RIFFchunk['strf']['wbitspersample'];
+ $info['audio']['bitrate'] = $info['audio']['sample_rate'] * $info['audio']['channels'] * $info['audio']['bits_per_sample'];
+ $info['audio']['bitrate_mode'] = 'cbr';
+
+
+ } catch (getid3_exception $e) {
+ if ($e->getCode() == 10) {
+ $this->warning('RIFFAMV parser: '.$e->getMessage());
+ } else {
+ throw $e;
+ }
+ }
+
+ return $RIFFchunk;
+ }
+
+
</ins><span class="cx"> public function ParseRIFF($startoffset, $maxoffset) {
</span><span class="cx"> $info = &$this->getid3->info;
</span><span class="cx">
</span><span class="lines">@@ -1329,7 +1480,7 @@
</span><span class="cx"> $getid3_temp->openfile($this->getid3->filename);
</span><span class="cx"> $getid3_temp->info['avdataoffset'] = $this->ftell() - 4;
</span><span class="cx"> $getid3_temp->info['avdataend'] = $this->ftell() + $AudioChunkSize;
</span><del>- $getid3_mp3 = new getid3_mp3($getid3_temp);
</del><ins>+ $getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__);
</ins><span class="cx"> $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
</span><span class="cx"> if (isset($getid3_temp->info['mpeg']['audio'])) {
</span><span class="cx"> $info['mpeg']['audio'] = $getid3_temp->info['mpeg']['audio'];
</span><span class="lines">@@ -1412,7 +1563,7 @@
</span><span class="cx"> $getid3_temp->openfile($this->getid3->filename);
</span><span class="cx"> $getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
</span><span class="cx"> $getid3_temp->info['avdataend'] = $info['avdataend'];
</span><del>- $getid3_mp3 = new getid3_mp3($getid3_temp);
</del><ins>+ $getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__);
</ins><span class="cx"> $getid3_mp3->getOnlyMPEGaudioInfo($info['avdataoffset'], false);
</span><span class="cx"> if (empty($getid3_temp->info['error'])) {
</span><span class="cx"> $info['audio'] = $getid3_temp->info['audio'];
</span><span class="lines">@@ -2426,10 +2577,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private function EitherEndian2Int($byteword, $signed=false) {
</span><del>- if ($this->getid3->info['fileformat'] == 'riff') {
</del><ins>+ if ($this->container == 'riff') {
</ins><span class="cx"> return getid3_lib::LittleEndian2Int($byteword, $signed);
</span><span class="cx"> }
</span><span class="cx"> return getid3_lib::BigEndian2Int($byteword, false, $signed);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudioac3php"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio.ac3.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio.ac3.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio.ac3.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -470,4 +471,4 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudiodtsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio.dts.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio.dts.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio.dts.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -287,4 +288,4 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudioflacphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio.flac.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio.flac.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio.flac.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -439,4 +440,4 @@
</span><span class="cx"> return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved');
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudiomp3php"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio.mp3.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio.mp3.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio.mp3.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -95,8 +96,8 @@
</span><span class="cx">
</span><span class="cx"> // Not sure what version of LAME this is - look in padding of last frame for longer version string
</span><span class="cx"> $PossibleLAMEversionStringOffset = $info['avdataend'] - $PossiblyLongerLAMEversion_FrameLength;
</span><del>- fseek($this->getid3->fp, $PossibleLAMEversionStringOffset);
- $PossiblyLongerLAMEversion_Data = fread($this->getid3->fp, $PossiblyLongerLAMEversion_FrameLength);
</del><ins>+ $this->fseek($PossibleLAMEversionStringOffset);
+ $PossiblyLongerLAMEversion_Data = $this->fread($PossiblyLongerLAMEversion_FrameLength);
</ins><span class="cx"> switch (substr($CurrentDataLAMEversionString, -1)) {
</span><span class="cx"> case 'a':
</span><span class="cx"> case 'b':
</span><span class="lines">@@ -422,12 +423,12 @@
</span><span class="cx"> $MPEGaudioEmphasisLookup = self::MPEGaudioEmphasisArray();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (fseek($this->getid3->fp, $offset, SEEK_SET) != 0) {
</del><ins>+ if ($this->fseek($offset) != 0) {
</ins><span class="cx"> $info['error'][] = 'decodeMPEGaudioHeader() failed to seek to next offset at '.$offset;
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- //$headerstring = fread($this->getid3->fp, 1441); // worst-case max length = 32kHz @ 320kbps layer 3 = 1441 bytes/frame
- $headerstring = fread($this->getid3->fp, 226); // LAME header at offset 36 + 190 bytes of Xing/LAME data
</del><ins>+ //$headerstring = $this->fread(1441); // worst-case max length = 32kHz @ 320kbps layer 3 = 1441 bytes/frame
+ $headerstring = $this->fread(226); // LAME header at offset 36 + 190 bytes of Xing/LAME data
</ins><span class="cx">
</span><span class="cx"> // MP3 audio frame structure:
</span><span class="cx"> // $aa $aa $aa $aa [$bb $bb] $cc...
</span><span class="lines">@@ -890,19 +891,21 @@
</span><span class="cx">
</span><span class="cx"> if (($ExpectedNumberOfAudioBytes > 0) && ($ExpectedNumberOfAudioBytes != ($info['avdataend'] - $info['avdataoffset']))) {
</span><span class="cx"> if ($ExpectedNumberOfAudioBytes > ($info['avdataend'] - $info['avdataoffset'])) {
</span><del>- if (isset($info['fileformat']) && ($info['fileformat'] == 'riff')) {
</del><ins>+ if ($this->isDependencyFor('matroska') || $this->isDependencyFor('riff')) {
</ins><span class="cx"> // ignore, audio data is broken into chunks so will always be data "missing"
</span><del>- } elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) {
- $info['warning'][] = 'Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)';
- } else {
- $info['warning'][] = 'Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)';
</del><span class="cx"> }
</span><ins>+ elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) {
+ $this->warning('Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)');
+ }
+ else {
+ $this->warning('Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)');
+ }
</ins><span class="cx"> } else {
</span><span class="cx"> if ((($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes) == 1) {
</span><del>- // $prenullbytefileoffset = ftell($this->getid3->fp);
- // fseek($this->getid3->fp, $info['avdataend'], SEEK_SET);
- // $PossibleNullByte = fread($this->getid3->fp, 1);
- // fseek($this->getid3->fp, $prenullbytefileoffset, SEEK_SET);
</del><ins>+ // $prenullbytefileoffset = $this->ftell();
+ // $this->fseek($info['avdataend']);
+ // $PossibleNullByte = $this->fread(1);
+ // $this->fseek($prenullbytefileoffset);
</ins><span class="cx"> // if ($PossibleNullByte === "\x00") {
</span><span class="cx"> $info['avdataend']--;
</span><span class="cx"> // $info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored';
</span><span class="lines">@@ -1118,8 +1121,8 @@
</span><span class="cx"> public function FreeFormatFrameLength($offset, $deepscan=false) {
</span><span class="cx"> $info = &$this->getid3->info;
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $offset, SEEK_SET);
- $MPEGaudioData = fread($this->getid3->fp, 32768);
</del><ins>+ $this->fseek($offset);
+ $MPEGaudioData = $this->fread(32768);
</ins><span class="cx">
</span><span class="cx"> $SyncPattern1 = substr($MPEGaudioData, 0, 4);
</span><span class="cx"> // may be different pattern due to padding
</span><span class="lines">@@ -1166,8 +1169,8 @@
</span><span class="cx"> $ActualFrameLengthValues = array();
</span><span class="cx"> $nextoffset = $offset + $framelength;
</span><span class="cx"> while ($nextoffset < ($info['avdataend'] - 6)) {
</span><del>- fseek($this->getid3->fp, $nextoffset - 1, SEEK_SET);
- $NextSyncPattern = fread($this->getid3->fp, 6);
</del><ins>+ $this->fseek($nextoffset - 1);
+ $NextSyncPattern = $this->fread(6);
</ins><span class="cx"> if ((substr($NextSyncPattern, 1, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 1, strlen($SyncPattern2)) == $SyncPattern2)) {
</span><span class="cx"> // good - found where expected
</span><span class="cx"> $ActualFrameLengthValues[] = $framelength;
</span><span class="lines">@@ -1215,22 +1218,22 @@
</span><span class="cx"> $Distribution['padding'] = array();
</span><span class="cx">
</span><span class="cx"> $info = &$this->getid3->info;
</span><del>- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
</del><ins>+ $this->fseek($info['avdataoffset']);
</ins><span class="cx">
</span><span class="cx"> $max_frames_scan = 5000;
</span><span class="cx"> $frames_scanned = 0;
</span><span class="cx">
</span><span class="cx"> $previousvalidframe = $info['avdataoffset'];
</span><del>- while (ftell($this->getid3->fp) < $info['avdataend']) {
</del><ins>+ while ($this->ftell() < $info['avdataend']) {
</ins><span class="cx"> set_time_limit(30);
</span><del>- $head4 = fread($this->getid3->fp, 4);
</del><ins>+ $head4 = $this->fread(4);
</ins><span class="cx"> if (strlen($head4) < 4) {
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> if ($head4{0} != "\xFF") {
</span><span class="cx"> for ($i = 1; $i < 4; $i++) {
</span><span class="cx"> if ($head4{$i} == "\xFF") {
</span><del>- fseek($this->getid3->fp, $i - 4, SEEK_CUR);
</del><ins>+ $this->fseek($i - 4, SEEK_CUR);
</ins><span class="cx"> continue 2;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1258,9 +1261,9 @@
</span><span class="cx"> $LongMPEGfrequencyLookup[$head4]);
</span><span class="cx"> }
</span><span class="cx"> if ($MPEGaudioHeaderLengthCache[$head4] > 4) {
</span><del>- $WhereWeWere = ftell($this->getid3->fp);
- fseek($this->getid3->fp, $MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);
- $next4 = fread($this->getid3->fp, 4);
</del><ins>+ $WhereWeWere = $this->ftell();
+ $this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);
+ $next4 = $this->fread(4);
</ins><span class="cx"> if ($next4{0} == "\xFF") {
</span><span class="cx"> if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
</span><span class="cx"> $MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4);
</span><span class="lines">@@ -1269,7 +1272,7 @@
</span><span class="cx"> $MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
</span><span class="cx"> }
</span><span class="cx"> if ($MPEGaudioHeaderValidCache[$next4]) {
</span><del>- fseek($this->getid3->fp, -4, SEEK_CUR);
</del><ins>+ $this->fseek(-4, SEEK_CUR);
</ins><span class="cx">
</span><span class="cx"> getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);
</span><span class="cx"> getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);
</span><span class="lines">@@ -1277,7 +1280,7 @@
</span><span class="cx"> getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]);
</span><span class="cx"> getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]);
</span><span class="cx"> if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) {
</span><del>- $pct_data_scanned = (ftell($this->getid3->fp) - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);
</del><ins>+ $pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);
</ins><span class="cx"> $info['warning'][] = 'too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
</span><span class="cx"> foreach ($Distribution as $key1 => $value1) {
</span><span class="cx"> foreach ($value1 as $key2 => $value2) {
</span><span class="lines">@@ -1290,7 +1293,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> unset($next4);
</span><del>- fseek($this->getid3->fp, $WhereWeWere - 3, SEEK_SET);
</del><ins>+ $this->fseek($WhereWeWere - 3);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span><span class="lines">@@ -1355,13 +1358,13 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $avdataoffset, SEEK_SET);
</del><ins>+ $this->fseek($avdataoffset);
</ins><span class="cx"> $sync_seek_buffer_size = min(128 * 1024, $info['avdataend'] - $avdataoffset);
</span><span class="cx"> if ($sync_seek_buffer_size <= 0) {
</span><span class="cx"> $info['error'][] = 'Invalid $sync_seek_buffer_size at offset '.$avdataoffset;
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- $header = fread($this->getid3->fp, $sync_seek_buffer_size);
</del><ins>+ $header = $this->fread($sync_seek_buffer_size);
</ins><span class="cx"> $sync_seek_buffer_size = strlen($header);
</span><span class="cx"> $SynchSeekOffset = 0;
</span><span class="cx"> while ($SynchSeekOffset < $sync_seek_buffer_size) {
</span><span class="lines">@@ -1473,7 +1476,7 @@
</span><span class="cx">
</span><span class="cx"> $dummy = array('error'=>$info['error'], 'warning'=>$info['warning'], 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
</span><span class="cx"> $synchstartoffset = $info['avdataoffset'];
</span><del>- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
</del><ins>+ $this->fseek($info['avdataoffset']);
</ins><span class="cx">
</span><span class="cx"> // you can play with these numbers:
</span><span class="cx"> $max_frames_scan = 50000;
</span><span class="lines">@@ -1488,13 +1491,13 @@
</span><span class="cx"> $pct_data_scanned = 0;
</span><span class="cx"> for ($current_segment = 0; $current_segment < $max_scan_segments; $current_segment++) {
</span><span class="cx"> $frames_scanned_this_segment = 0;
</span><del>- if (ftell($this->getid3->fp) >= $info['avdataend']) {
</del><ins>+ if ($this->ftell() >= $info['avdataend']) {
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><del>- $scan_start_offset[$current_segment] = max(ftell($this->getid3->fp), $info['avdataoffset'] + round($current_segment * (($info['avdataend'] - $info['avdataoffset']) / $max_scan_segments)));
</del><ins>+ $scan_start_offset[$current_segment] = max($this->ftell(), $info['avdataoffset'] + round($current_segment * (($info['avdataend'] - $info['avdataoffset']) / $max_scan_segments)));
</ins><span class="cx"> if ($current_segment > 0) {
</span><del>- fseek($this->getid3->fp, $scan_start_offset[$current_segment], SEEK_SET);
- $buffer_4k = fread($this->getid3->fp, 4096);
</del><ins>+ $this->fseek($scan_start_offset[$current_segment]);
+ $buffer_4k = $this->fread(4096);
</ins><span class="cx"> for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) {
</span><span class="cx"> if (($buffer_4k{$j} == "\xFF") && ($buffer_4k{($j + 1)} > "\xE0")) { // synch detected
</span><span class="cx"> if ($this->decodeMPEGaudioHeader($scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) {
</span><span class="lines">@@ -1523,7 +1526,7 @@
</span><span class="cx"> }
</span><span class="cx"> $frames_scanned++;
</span><span class="cx"> if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) {
</span><del>- $this_pct_scanned = (ftell($this->getid3->fp) - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']);
</del><ins>+ $this_pct_scanned = ($this->ftell() - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']);
</ins><span class="cx"> if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) {
</span><span class="cx"> // file likely contains < $max_frames_scan, just scan as one segment
</span><span class="cx"> $max_scan_segments = 1;
</span><span class="lines">@@ -2006,4 +2009,4 @@
</span><span class="cx"> return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to info@getid3.org');
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduleaudiooggphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.audio.ogg.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.audio.ogg.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.audio.ogg.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -114,7 +115,67 @@
</span><span class="cx"> $info['audio']['bitrate_mode'] = 'vbr';
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ } elseif (substr($filedata, 0, 7) == "\x80".'theora') {
</ins><span class="cx">
</span><ins>+ // http://www.theora.org/doc/Theora.pdf (section 6.2)
+
+ $info['ogg']['pageheader']['theora']['theora_magic'] = substr($filedata, $filedataoffset, 7); // hard-coded to "\x80.'theora'
+ $filedataoffset += 7;
+ $info['ogg']['pageheader']['theora']['version_major'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
+ $filedataoffset += 1;
+ $info['ogg']['pageheader']['theora']['version_minor'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
+ $filedataoffset += 1;
+ $info['ogg']['pageheader']['theora']['version_revision'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
+ $filedataoffset += 1;
+ $info['ogg']['pageheader']['theora']['frame_width_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2));
+ $filedataoffset += 2;
+ $info['ogg']['pageheader']['theora']['frame_height_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2));
+ $filedataoffset += 2;
+ $info['ogg']['pageheader']['theora']['resolution_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
+ $filedataoffset += 3;
+ $info['ogg']['pageheader']['theora']['resolution_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
+ $filedataoffset += 3;
+ $info['ogg']['pageheader']['theora']['picture_offset_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
+ $filedataoffset += 1;
+ $info['ogg']['pageheader']['theora']['picture_offset_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
+ $filedataoffset += 1;
+ $info['ogg']['pageheader']['theora']['frame_rate_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4));
+ $filedataoffset += 4;
+ $info['ogg']['pageheader']['theora']['frame_rate_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4));
+ $filedataoffset += 4;
+ $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
+ $filedataoffset += 3;
+ $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
+ $filedataoffset += 3;
+ $info['ogg']['pageheader']['theora']['color_space_id'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1));
+ $filedataoffset += 1;
+ $info['ogg']['pageheader']['theora']['nominal_bitrate'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3));
+ $filedataoffset += 3;
+ $info['ogg']['pageheader']['theora']['flags'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2));
+ $filedataoffset += 2;
+
+ $info['ogg']['pageheader']['theora']['quality'] = ($info['ogg']['pageheader']['theora']['flags'] & 0xFC00) >> 10;
+ $info['ogg']['pageheader']['theora']['kfg_shift'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x03E0) >> 5;
+ $info['ogg']['pageheader']['theora']['pixel_format_id'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0018) >> 3;
+ $info['ogg']['pageheader']['theora']['reserved'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0007) >> 0; // should be 0
+ $info['ogg']['pageheader']['theora']['color_space'] = self::TheoraColorSpace($info['ogg']['pageheader']['theora']['color_space_id']);
+ $info['ogg']['pageheader']['theora']['pixel_format'] = self::TheoraPixelFormat($info['ogg']['pageheader']['theora']['pixel_format_id']);
+
+ $info['video']['dataformat'] = 'theora';
+ $info['mime_type'] = 'video/ogg';
+ //$info['audio']['bitrate_mode'] = 'abr';
+ //$info['audio']['lossless'] = false;
+ $info['video']['resolution_x'] = $info['ogg']['pageheader']['theora']['resolution_x'];
+ $info['video']['resolution_y'] = $info['ogg']['pageheader']['theora']['resolution_y'];
+ if ($info['ogg']['pageheader']['theora']['frame_rate_denominator'] > 0) {
+ $info['video']['frame_rate'] = (float) $info['ogg']['pageheader']['theora']['frame_rate_numerator'] / $info['ogg']['pageheader']['theora']['frame_rate_denominator'];
+ }
+ if ($info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] > 0) {
+ $info['video']['pixel_aspect_ratio'] = (float) $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] / $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'];
+ }
+$info['warning'][] = 'Ogg Theora (v3) not fully supported in this version of getID3 ['.$this->getid3->version().'] -- bitrate, playtime and all audio data are currently unavailable';
+
+
</ins><span class="cx"> } elseif (substr($filedata, 0, 8) == "fishead\x00") {
</span><span class="cx">
</span><span class="cx"> // Ogg Skeleton version 3.0 Format Specification
</span><span class="lines">@@ -172,8 +233,8 @@
</span><span class="cx">
</span><span class="cx"> } elseif (substr($filedata, 1, 6) == 'theora') {
</span><span class="cx">
</span><del>- $info['video']['dataformat'] = 'theora';
- $info['error'][] = 'Ogg Theora not correctly handled in this version of getID3 ['.$this->getid3->version().']';
</del><ins>+ $info['video']['dataformat'] = 'theora1';
+ $info['error'][] = 'Ogg Theora (v1) not correctly handled in this version of getID3 ['.$this->getid3->version().']';
</ins><span class="cx"> //break;
</span><span class="cx">
</span><span class="cx"> } elseif (substr($filedata, 1, 6) == 'vorbis') {
</span><span class="lines">@@ -668,4 +729,28 @@
</span><span class="cx"> return round($qval, 1); // 5 or 4.9
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+ public static function TheoraColorSpace($colorspace_id) {
+ // http://www.theora.org/doc/Theora.pdf (table 6.3)
+ static $TheoraColorSpaceLookup = array();
+ if (empty($TheoraColorSpaceLookup)) {
+ $TheoraColorSpaceLookup[0] = 'Undefined';
+ $TheoraColorSpaceLookup[1] = 'Rec. 470M';
+ $TheoraColorSpaceLookup[2] = 'Rec. 470BG';
+ $TheoraColorSpaceLookup[3] = 'Reserved';
+ }
+ return (isset($TheoraColorSpaceLookup[$colorspace_id]) ? $TheoraColorSpaceLookup[$colorspace_id] : null);
+ }
+
+ public static function TheoraPixelFormat($pixelformat_id) {
+ // http://www.theora.org/doc/Theora.pdf (table 6.4)
+ static $TheoraPixelFormatLookup = array();
+ if (empty($TheoraPixelFormatLookup)) {
+ $TheoraPixelFormatLookup[0] = '4:2:0';
+ $TheoraPixelFormatLookup[1] = 'Reserved';
+ $TheoraPixelFormatLookup[2] = '4:2:2';
+ $TheoraPixelFormatLookup[3] = '4:4:4';
+ }
+ return (isset($TheoraPixelFormatLookup[$pixelformat_id]) ? $TheoraPixelFormatLookup[$pixelformat_id] : null);
+ }
+
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduletagapetagphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.tag.apetag.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.tag.apetag.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.tag.apetag.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -32,8 +33,8 @@
</span><span class="cx">
</span><span class="cx"> if ($this->overrideendoffset == 0) {
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, 0 - $id3v1tagsize - $apetagheadersize - $lyrics3tagsize, SEEK_END);
- $APEfooterID3v1 = fread($this->getid3->fp, $id3v1tagsize + $apetagheadersize + $lyrics3tagsize);
</del><ins>+ $this->fseek(0 - $id3v1tagsize - $apetagheadersize - $lyrics3tagsize, SEEK_END);
+ $APEfooterID3v1 = $this->fread($id3v1tagsize + $apetagheadersize + $lyrics3tagsize);
</ins><span class="cx">
</span><span class="cx"> //if (preg_match('/APETAGEX.{24}TAG.{125}$/i', $APEfooterID3v1)) {
</span><span class="cx"> if (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $id3v1tagsize - $apetagheadersize, 8) == 'APETAGEX') {
</span><span class="lines">@@ -51,8 +52,8 @@
</span><span class="cx">
</span><span class="cx"> } else {
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $this->overrideendoffset - $apetagheadersize, SEEK_SET);
- if (fread($this->getid3->fp, 8) == 'APETAGEX') {
</del><ins>+ $this->fseek($this->overrideendoffset - $apetagheadersize);
+ if ($this->fread(8) == 'APETAGEX') {
</ins><span class="cx"> $info['ape']['tag_offset_end'] = $this->overrideendoffset;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -68,21 +69,21 @@
</span><span class="cx"> // shortcut
</span><span class="cx"> $thisfile_ape = &$info['ape'];
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $thisfile_ape['tag_offset_end'] - $apetagheadersize, SEEK_SET);
- $APEfooterData = fread($this->getid3->fp, 32);
</del><ins>+ $this->fseek($thisfile_ape['tag_offset_end'] - $apetagheadersize);
+ $APEfooterData = $this->fread(32);
</ins><span class="cx"> if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) {
</span><span class="cx"> $info['error'][] = 'Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end'];
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) {
</span><del>- fseek($this->getid3->fp, $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'] - $apetagheadersize, SEEK_SET);
- $thisfile_ape['tag_offset_start'] = ftell($this->getid3->fp);
- $APEtagData = fread($this->getid3->fp, $thisfile_ape['footer']['raw']['tagsize'] + $apetagheadersize);
</del><ins>+ $this->fseek($thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'] - $apetagheadersize);
+ $thisfile_ape['tag_offset_start'] = $this->ftell();
+ $APEtagData = $this->fread($thisfile_ape['footer']['raw']['tagsize'] + $apetagheadersize);
</ins><span class="cx"> } else {
</span><span class="cx"> $thisfile_ape['tag_offset_start'] = $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'];
</span><del>- fseek($this->getid3->fp, $thisfile_ape['tag_offset_start'], SEEK_SET);
- $APEtagData = fread($this->getid3->fp, $thisfile_ape['footer']['raw']['tagsize']);
</del><ins>+ $this->fseek($thisfile_ape['tag_offset_start']);
+ $APEtagData = $this->fread($thisfile_ape['footer']['raw']['tagsize']);
</ins><span class="cx"> }
</span><span class="cx"> $info['avdataend'] = $thisfile_ape['tag_offset_start'];
</span><span class="cx">
</span><span class="lines">@@ -367,4 +368,4 @@
</span><span class="cx"> return in_array(strtolower($itemkey), $APEtagItemIsUTF8Lookup);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduletagid3v1php"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.tag.id3v1.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.tag.id3v1.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.tag.id3v1.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -25,9 +26,9 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, -256, SEEK_END);
- $preid3v1 = fread($this->getid3->fp, 128);
- $id3v1tag = fread($this->getid3->fp, 128);
</del><ins>+ $this->fseek(-256, SEEK_END);
+ $preid3v1 = $this->fread(128);
+ $id3v1tag = $this->fread(128);
</ins><span class="cx">
</span><span class="cx"> if (substr($id3v1tag, 0, 3) == 'TAG') {
</span><span class="cx">
</span><span class="lines">@@ -356,4 +357,4 @@
</span><span class="cx"> return $ID3v1Tag;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3moduletagid3v2php"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.tag.id3v2.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.tag.id3v2.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.tag.id3v2.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -51,8 +52,8 @@
</span><span class="cx"> $thisfile_id3v2_flags = &$thisfile_id3v2['flags'];
</span><span class="cx">
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $this->StartingOffset, SEEK_SET);
- $header = fread($this->getid3->fp, 10);
</del><ins>+ $this->fseek($this->StartingOffset);
+ $header = $this->fread(10);
</ins><span class="cx"> if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) {
</span><span class="cx">
</span><span class="cx"> $thisfile_id3v2['majorversion'] = ord($header{3});
</span><span class="lines">@@ -131,7 +132,7 @@
</span><span class="cx"> }
</span><span class="cx"> if ($sizeofframes > 0) {
</span><span class="cx">
</span><del>- $framedata = fread($this->getid3->fp, $sizeofframes); // read all frames from file into $framedata variable
</del><ins>+ $framedata = $this->fread($sizeofframes); // read all frames from file into $framedata variable
</ins><span class="cx">
</span><span class="cx"> // if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x)
</span><span class="cx"> if (!empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) {
</span><span class="lines">@@ -423,7 +424,7 @@
</span><span class="cx"> // ID3v2 size 4 * %0xxxxxxx
</span><span class="cx">
</span><span class="cx"> if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) {
</span><del>- $footer = fread($this->getid3->fp, 10);
</del><ins>+ $footer = $this->fread(10);
</ins><span class="cx"> if (substr($footer, 0, 3) == '3DI') {
</span><span class="cx"> $thisfile_id3v2['footer'] = true;
</span><span class="cx"> $thisfile_id3v2['majorversion_footer'] = ord($footer{3});
</span><span class="lines">@@ -642,7 +643,12 @@
</span><span class="cx"> $parsedFrame['description'] = $frame_description;
</span><span class="cx"> $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
</span><span class="cx"> if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
</span><del>- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
</del><ins>+ $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0));
+ if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
+ $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
+ } else {
+ $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
+ }
</ins><span class="cx"> }
</span><span class="cx"> //unset($parsedFrame['data']); do not unset, may be needed elsewhere, e.g. for replaygain
</span><span class="cx">
</span><span class="lines">@@ -1077,7 +1083,12 @@
</span><span class="cx"> $parsedFrame['description'] = $frame_description;
</span><span class="cx"> $parsedFrame['data'] = $frame_text;
</span><span class="cx"> if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
</span><del>- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
</del><ins>+ $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (!empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0));
+ if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
+ $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+ } else {
+ $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span><span class="lines">@@ -1885,7 +1896,7 @@
</span><span class="cx"> $frame_offset += 2;
</span><span class="cx"> $parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
</span><span class="cx"> $frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8);
</span><del>- for ($i = 0; $i < $frame_indexpoints; $i++) {
</del><ins>+ for ($i = 0; $i < $parsedFrame['indexpoints']; $i++) {
</ins><span class="cx"> $parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint));
</span><span class="cx"> $frame_offset += $frame_bytesperpoint;
</span><span class="cx"> }
</span><span class="lines">@@ -3411,4 +3422,3 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span><del>-
</del></span></pre></div>
<a id="trunksrcwpincludesID3moduletaglyrics3php"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/module.tag.lyrics3.php (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/module.tag.lyrics3.php 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/module.tag.lyrics3.php 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx"> // See readme.txt for more details //
</span><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -27,8 +28,8 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, (0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - "LYRICSEND" - [Lyrics3size]
- $lyrics3_id3v1 = fread($this->getid3->fp, 128 + 9 + 6);
</del><ins>+ $this->fseek((0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - "LYRICSEND" - [Lyrics3size]
+ $lyrics3_id3v1 = $this->fread(128 + 9 + 6);
</ins><span class="cx"> $lyrics3lsz = substr($lyrics3_id3v1, 0, 6); // Lyrics3size
</span><span class="cx"> $lyrics3end = substr($lyrics3_id3v1, 6, 9); // LYRICSEND or LYRICS200
</span><span class="cx"> $id3v1tag = substr($lyrics3_id3v1, 15, 128); // ID3v1
</span><span class="lines">@@ -68,9 +69,9 @@
</span><span class="cx">
</span><span class="cx"> if (isset($info['ape']['tag_offset_start']) && ($info['ape']['tag_offset_start'] > 15)) {
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $info['ape']['tag_offset_start'] - 15, SEEK_SET);
- $lyrics3lsz = fread($this->getid3->fp, 6);
- $lyrics3end = fread($this->getid3->fp, 9);
</del><ins>+ $this->fseek($info['ape']['tag_offset_start'] - 15);
+ $lyrics3lsz = $this->fread(6);
+ $lyrics3end = $this->fread(9);
</ins><span class="cx">
</span><span class="cx"> if ($lyrics3end == 'LYRICSEND') {
</span><span class="cx"> // Lyrics3v1, APE, maybe ID3v1
</span><span class="lines">@@ -101,20 +102,19 @@
</span><span class="cx">
</span><span class="cx"> if (!isset($info['ape'])) {
</span><span class="cx"> $GETID3_ERRORARRAY = &$info['warning'];
</span><del>- if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, false)) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_apetag = new getid3_apetag($getid3_temp);
- $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start'];
- $getid3_apetag->Analyze();
- if (!empty($getid3_temp->info['ape'])) {
- $info['ape'] = $getid3_temp->info['ape'];
- }
- if (!empty($getid3_temp->info['replay_gain'])) {
- $info['replay_gain'] = $getid3_temp->info['replay_gain'];
- }
- unset($getid3_temp, $getid3_apetag);
</del><ins>+ getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true);
+ $getid3_temp = new getID3();
+ $getid3_temp->openfile($this->getid3->filename);
+ $getid3_apetag = new getid3_apetag($getid3_temp);
+ $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start'];
+ $getid3_apetag->Analyze();
+ if (!empty($getid3_temp->info['ape'])) {
+ $info['ape'] = $getid3_temp->info['ape'];
</ins><span class="cx"> }
</span><ins>+ if (!empty($getid3_temp->info['replay_gain'])) {
+ $info['replay_gain'] = $getid3_temp->info['replay_gain'];
+ }
+ unset($getid3_temp, $getid3_apetag);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span><span class="lines">@@ -132,11 +132,11 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- fseek($this->getid3->fp, $endoffset, SEEK_SET);
</del><ins>+ $this->fseek($endoffset);
</ins><span class="cx"> if ($length <= 0) {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- $rawdata = fread($this->getid3->fp, $length);
</del><ins>+ $rawdata = $this->fread($length);
</ins><span class="cx">
</span><span class="cx"> $ParsedLyrics3['raw']['lyrics3version'] = $version;
</span><span class="cx"> $ParsedLyrics3['raw']['lyrics3tagsize'] = $length;
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx"> $ParsedLyrics3['raw']['LYR'] = trim(substr($rawdata, 11, strlen($rawdata) - 11 - 9));
</span><span class="cx"> $this->Lyrics3LyricsTimestampParse($ParsedLyrics3);
</span><span class="cx"> } else {
</span><del>- $info['error'][] = '"LYRICSEND" expected at '.(ftell($this->getid3->fp) - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
</del><ins>+ $info['error'][] = '"LYRICSEND" expected at '.($this->ftell() - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="lines">@@ -217,7 +217,7 @@
</span><span class="cx"> $this->Lyrics3LyricsTimestampParse($ParsedLyrics3);
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- $info['error'][] = '"LYRICS200" expected at '.(ftell($this->getid3->fp) - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
</del><ins>+ $info['error'][] = '"LYRICS200" expected at '.($this->ftell() - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="lines">@@ -291,4 +291,4 @@
</span><span class="cx"> }
</span><span class="cx"> return null;
</span><span class="cx"> }
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesID3readmetxt"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/ID3/readme.txt (29733 => 29734)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/ID3/readme.txt 2014-09-11 17:43:05 UTC (rev 29733)
+++ trunk/src/wp-includes/ID3/readme.txt 2014-09-11 19:06:33 UTC (rev 29734)
</span><span class="lines">@@ -2,6 +2,7 @@
</span><span class="cx"> /// getID3() by James Heinrich <info@getid3.org> //
</span><span class="cx"> // available at http://getid3.sourceforge.net //
</span><span class="cx"> // or http://www.getid3.org //
</span><ins>+// also https://github.com/JamesHeinrich/getID3 //
</ins><span class="cx"> /////////////////////////////////////////////////////////////////
</span><span class="cx">
</span><span class="cx"> *****************************************************************
</span><span class="lines">@@ -67,13 +68,13 @@
</span><span class="cx"> ===========================================================================
</span><span class="cx">
</span><span class="cx"> Reads & parses (to varying degrees):
</span><del>-# tags:
</del><ins>+ ¤ tags:
</ins><span class="cx"> * APE (v1 and v2)
</span><span class="cx"> * ID3v1 (& ID3v1.1)
</span><span class="cx"> * ID3v2 (v2.4, v2.3, v2.2)
</span><span class="cx"> * Lyrics3 (v1 & v2)
</span><span class="cx">
</span><del>-# audio-lossy:
</del><ins>+ ¤ audio-lossy:
</ins><span class="cx"> * MP3/MP2/MP1
</span><span class="cx"> * MPC / Musepack
</span><span class="cx"> * Ogg (Vorbis, OggFLAC, Speex)
</span><span class="lines">@@ -85,7 +86,7 @@
</span><span class="cx"> * DSS
</span><span class="cx"> * VQF
</span><span class="cx">
</span><del>-# audio-lossless:
</del><ins>+ ¤ audio-lossless:
</ins><span class="cx"> * AIFF
</span><span class="cx"> * AU
</span><span class="cx"> * Bonk
</span><span class="lines">@@ -104,7 +105,7 @@
</span><span class="cx"> * WAV (RIFF)
</span><span class="cx"> * WavPack
</span><span class="cx">
</span><del>-# audio-video:
</del><ins>+ ¤ audio-video:
</ins><span class="cx"> * ASF: ASF, Windows Media Audio (WMA), Windows Media Video (WMV)
</span><span class="cx"> * AVI (RIFF)
</span><span class="cx"> * Flash
</span><span class="lines">@@ -114,7 +115,7 @@
</span><span class="cx"> * Quicktime (including MP4)
</span><span class="cx"> * RealVideo
</span><span class="cx">
</span><del>-# still image:
</del><ins>+ ¤ still image:
</ins><span class="cx"> * BMP
</span><span class="cx"> * GIF
</span><span class="cx"> * JPEG
</span><span class="lines">@@ -123,7 +124,7 @@
</span><span class="cx"> * SWF (Flash)
</span><span class="cx"> * PhotoCD
</span><span class="cx">
</span><del>-# data:
</del><ins>+ ¤ data:
</ins><span class="cx"> * ISO-9660 CD-ROM image (directory structure)
</span><span class="cx"> * SZIP (limited support)
</span><span class="cx"> * ZIP (directory structure)
</span><span class="lines">@@ -309,7 +310,7 @@
</span><span class="cx"> (http://web.inter.nl.net/users/hvdh/lossless/lossless.htm)
</span><span class="cx"> * Support for RIFF-INFO chunks
</span><span class="cx"> * http://lotto.st-andrews.ac.uk/~njh/tag_interchange.html
</span><del>- (thanks Nick Humfrey <njh@surgeradio*co*uk>)
</del><ins>+ (thanks Nick Humfrey <njhØsurgeradio*co*uk>)
</ins><span class="cx"> * http://abcavi.narod.ru/sof/abcavi/infotags.htm
</span><span class="cx"> (thanks Kibi)
</span><span class="cx"> * Better support for Bink video
</span><span class="lines">@@ -324,23 +325,23 @@
</span><span class="cx"> * Support for IFF
</span><span class="cx"> * Support for ICO
</span><span class="cx"> * Support for ANI
</span><del>-* Support for EXE (comments, author, etc) (thanks p*quaedackers@planet*nl)
</del><ins>+* Support for EXE (comments, author, etc) (thanks p*quaedackersØplanet*nl)
</ins><span class="cx"> * Support for DVD-IFO (region, subtitles, aspect ratio, etc)
</span><del>- (thanks p*quaedackers@planet*nl)
</del><ins>+ (thanks p*quaedackersØplanet*nl)
</ins><span class="cx"> * More complete support for SWF - parsing encapsulated MP3 and/or JPEG content
</span><del>- (thanks n8n8@yahoo*com)
</del><ins>+ (thanks n8n8Øyahoo*com)
</ins><span class="cx"> * Support for a2b
</span><span class="cx"> * Optional scan-through-frames for AVI verification
</span><del>- (thanks rockcohen@massive-interactive*nl)
-* Support for TTF (thanks info@butterflyx*com)
</del><ins>+ (thanks rockcohenØmassive-interactive*nl)
+* Support for TTF (thanks infoØbutterflyx*com)
</ins><span class="cx"> * Support for DSS (http://www.getid3.org/phpBB3/viewtopic.php?t=171)
</span><span class="cx"> * Support for SMAF (http://smaf-yamaha.com/what/demo.html)
</span><span class="cx"> http://www.getid3.org/phpBB3/viewtopic.php?t=182
</span><span class="cx"> * Support for AMR (http://www.getid3.org/phpBB3/viewtopic.php?t=195)
</span><span class="cx"> * Support for 3gpp (http://www.getid3.org/phpBB3/viewtopic.php?t=195)
</span><del>-* Support for ID4 (http://www.wackysoft.cjb.net grizlyY2K@hotmail*com)
</del><ins>+* Support for ID4 (http://www.wackysoft.cjb.net grizlyY2KØhotmail*com)
</ins><span class="cx"> * Parse XML data returned in Ogg comments
</span><del>-* Parse XML data from Quicktime SMIL metafiles (klausrath@mac*com)
</del><ins>+* Parse XML data from Quicktime SMIL metafiles (klausrathØmac*com)
</ins><span class="cx"> * ID3v2 genre string creator function
</span><span class="cx"> * More complete parsing of JPG
</span><span class="cx"> * Support for all old-style ASF packets
</span><span class="lines">@@ -424,9 +425,9 @@
</span><span class="cx"> "movi" chunk that fits in the first 2GB, should issue error
</span><span class="cx"> to show that playtime is incorrect. Other data should be mostly
</span><span class="cx"> correct, assuming that data is constant throughout the file)
</span><ins>+* PHP <= v5 on Windows cannot read UTF-8 filenames
</ins><span class="cx">
</span><span class="cx">
</span><del>-
</del><span class="cx"> Known Bugs/Issues in other programs
</span><span class="cx"> -----------------------------------
</span><span class="cx"> http://www.getid3.org/phpBB3/viewtopic.php?t=25
</span><span class="lines">@@ -600,4 +601,4 @@
</span><span class="cx"> * http://cpansearch.perl.org/src/RGIBSON/Audio-DSS-0.02/lib/Audio/DSS.pm
</span><span class="cx"> * http://trac.musepack.net/trac/wiki/SV8Specification
</span><span class="cx"> * http://wyday.com/cuesharp/specification.php
</span><del>-* http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
</del><ins>+* http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>