Updated getID3() - this fixes Atom tag parsing.

This commit is contained in:
Peter Deltchev 2016-02-15 11:53:42 -08:00
parent b345601faf
commit 4b3a0808a0
4 changed files with 45 additions and 4 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;
}

View file

@ -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']);
}