From 4b3a0808a06ca7759cf1b84d95f9b5e8c8f3ebd4 Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Mon, 15 Feb 2016 11:53:42 -0800 Subject: [PATCH] Updated getID3() - this fixes Atom tag parsing. --- app/Library/getid3/changelog.txt | 18 +++++++++++++++++ app/Library/getid3/getid3/getid3.php | 2 +- .../getid3/module.audio-video.quicktime.php | 20 +++++++++++++++++-- .../getid3/getid3/module.audio-video.riff.php | 9 ++++++++- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/app/Library/getid3/changelog.txt b/app/Library/getid3/changelog.txt index 2c0cca62..11c1cf34 100644 --- a/app/Library/getid3/changelog.txt +++ b/app/Library/getid3/changelog.txt @@ -18,6 +18,24 @@ Version History =============== +1.9.11: [2015-12-24] James Heinrich + * bugfix (G:64): update constructor syntax for PHP 7 + * bugfix (G:62): infinite loop in large PNG files + * bugfix (G:61): ID3v2 remove BOM from frame descriptions + * bugfix (G:60): missing "break" in module.audio-video.quicktime.php + * bugfix (G:59): .gitignore comments + * bugfix (G:58): inconsistency in relation to module.tag.id3v2.php + * bugfix (G:57): comparing instead of assign + * bugfix (G:56): unsupported MIME type "audio/x-wave" + * bugfix (G:55): readme.md variable reference + * bugfix (G:54): QuickTime false 1000fps + * bugfix (G:53): Quicktime / ID3v2 multiple genres + * bugfix (G:52): sys_get_temp_dir in GetDataImageSize + * bugfix (#1903): Quicktime meta atom not parsed + * demo.joinmp3.php enhancements + * m4b (audiobook) chapters not parsed correctly + * sqlite3 caching not working + 1.9.10: [2015-09-14] James Heinrich * bugfix (G:49): Declaration of getID3_cached_sqlite3 * bugfix (#1892): extension.cache.mysql diff --git a/app/Library/getid3/getid3/getid3.php b/app/Library/getid3/getid3/getid3.php index b7b54d35..c085e8c4 100644 --- a/app/Library/getid3/getid3/getid3.php +++ b/app/Library/getid3/getid3/getid3.php @@ -109,7 +109,7 @@ class getID3 protected $startup_error = ''; protected $startup_warning = ''; - const VERSION = '1.9.10-201511241457'; + const VERSION = '1.9.11-201601190922'; const FREAD_BUFFER_SIZE = 32768; const ATTACHMENTS_NONE = false; diff --git a/app/Library/getid3/getid3/module.audio-video.quicktime.php b/app/Library/getid3/getid3/module.audio-video.quicktime.php index 73853d09..d46cc6ea 100644 --- a/app/Library/getid3/getid3/module.audio-video.quicktime.php +++ b/app/Library/getid3/getid3/module.audio-video.quicktime.php @@ -499,6 +499,18 @@ class getid3_quicktime extends getid3_handler $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 8)); break; + case 'covr': + $atom_structure['data'] = substr($boxdata, 8); + // 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'; + } + break; + case 'atID': case 'cnID': case 'geID': @@ -516,9 +528,9 @@ class getid3_quicktime extends getid3_handler $atom_structure['data'] = substr($boxdata, 8); if ($atomname == 'covr') { // not a foolproof check, but better than nothing - if (preg_match('#^\xFF\xD8\xFF#', $atom_structure['data'])) { + 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'])) { + } 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'; @@ -1579,6 +1591,10 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ // Furthermore, for historical reasons the list of atoms is optionally // terminated by a 32-bit integer set to 0. If you are writing a program // to read user data atoms, you should allow for the terminating 0. + if (strlen($atom_data) > 12) { + $subatomoffset += 4; + continue; + } return $atom_structure; } diff --git a/app/Library/getid3/getid3/module.audio-video.riff.php b/app/Library/getid3/getid3/module.audio-video.riff.php index e8ba9445..f0be500a 100644 --- a/app/Library/getid3/getid3/module.audio-video.riff.php +++ b/app/Library/getid3/getid3/module.audio-video.riff.php @@ -1170,9 +1170,16 @@ class getid3_riff extends getid3_handler { } break; + case 'WEBP': + // https://developers.google.com/speed/webp/docs/riff_container + $info['fileformat'] = 'webp'; + $info['mime_type'] = 'image/webp'; + +$info['error'][] = 'WebP image parsing not supported in this version of getID3()'; + break; default: - $info['error'][] = 'Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA), found "'.$RIFFsubtype.'" instead'; + $info['error'][] = 'Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA|WEBP), found "'.$RIFFsubtype.'" instead'; //unset($info['fileformat']); }