Annotation of /trunk/lib/getid3/module.tag.id3v2.php
Parent Directory
|
Revision Log
Revision 2 - (view) (download)
| 1 : | andphe | 2 | <?php |
| 2 : | ///////////////////////////////////////////////////////////////// | ||
| 3 : | /// getID3() by James Heinrich <info@getid3.org> // | ||
| 4 : | // available at http://getid3.sourceforge.net // | ||
| 5 : | // or http://www.getid3.org // | ||
| 6 : | ///////////////////////////////////////////////////////////////// | ||
| 7 : | // See readme.txt for more details // | ||
| 8 : | ///////////////////////////////////////////////////////////////// | ||
| 9 : | /// // | ||
| 10 : | // module.tag.id3v2.php // | ||
| 11 : | // module for analyzing ID3v2 tags // | ||
| 12 : | // dependencies: module.tag.id3v1.php // | ||
| 13 : | // /// | ||
| 14 : | ///////////////////////////////////////////////////////////////// | ||
| 15 : | // MOS Intruder Alerts | ||
| 16 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 17 : | |||
| 18 : | getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true); | ||
| 19 : | |||
| 20 : | class getid3_id3v2 | ||
| 21 : | { | ||
| 22 : | |||
| 23 : | function getid3_id3v2(&$fd, &$ThisFileInfo, $StartingOffset=0) { | ||
| 24 : | // Overall tag structure: | ||
| 25 : | // +-----------------------------+ | ||
| 26 : | // | Header (10 bytes) | | ||
| 27 : | // +-----------------------------+ | ||
| 28 : | // | Extended Header | | ||
| 29 : | // | (variable length, OPTIONAL) | | ||
| 30 : | // +-----------------------------+ | ||
| 31 : | // | Frames (variable length) | | ||
| 32 : | // +-----------------------------+ | ||
| 33 : | // | Padding | | ||
| 34 : | // | (variable length, OPTIONAL) | | ||
| 35 : | // +-----------------------------+ | ||
| 36 : | // | Footer (10 bytes, OPTIONAL) | | ||
| 37 : | // +-----------------------------+ | ||
| 38 : | |||
| 39 : | // Header | ||
| 40 : | // ID3v2/file identifier "ID3" | ||
| 41 : | // ID3v2 version $04 00 | ||
| 42 : | // ID3v2 flags (%ab000000 in v2.2, %abc00000 in v2.3, %abcd0000 in v2.4.x) | ||
| 43 : | // ID3v2 size 4 * %0xxxxxxx | ||
| 44 : | |||
| 45 : | |||
| 46 : | // shortcuts | ||
| 47 : | $ThisFileInfo['id3v2']['header'] = true; | ||
| 48 : | $thisfile_id3v2 = &$ThisFileInfo['id3v2']; | ||
| 49 : | $thisfile_id3v2['flags'] = array(); | ||
| 50 : | $thisfile_id3v2_flags = &$thisfile_id3v2['flags']; | ||
| 51 : | |||
| 52 : | |||
| 53 : | fseek($fd, $StartingOffset, SEEK_SET); | ||
| 54 : | $header = fread($fd, 10); | ||
| 55 : | if (substr($header, 0, 3) == 'ID3') { | ||
| 56 : | |||
| 57 : | $thisfile_id3v2['majorversion'] = ord($header{3}); | ||
| 58 : | $thisfile_id3v2['minorversion'] = ord($header{4}); | ||
| 59 : | |||
| 60 : | // shortcut | ||
| 61 : | $id3v2_majorversion = &$thisfile_id3v2['majorversion']; | ||
| 62 : | |||
| 63 : | } else { | ||
| 64 : | |||
| 65 : | unset($ThisFileInfo['id3v2']); | ||
| 66 : | return false; | ||
| 67 : | |||
| 68 : | } | ||
| 69 : | |||
| 70 : | if ($id3v2_majorversion > 4) { // this script probably won't correctly parse ID3v2.5.x and above (if it ever exists) | ||
| 71 : | |||
| 72 : | $ThisFileInfo['error'][] = 'this script only parses up to ID3v2.4.x - this tag is ID3v2.'.$id3v2_majorversion.'.'.$thisfile_id3v2['minorversion']; | ||
| 73 : | return false; | ||
| 74 : | |||
| 75 : | } | ||
| 76 : | |||
| 77 : | $id3_flags = ord($header{5}); | ||
| 78 : | switch ($id3v2_majorversion) { | ||
| 79 : | case 2: | ||
| 80 : | // %ab000000 in v2.2 | ||
| 81 : | $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation | ||
| 82 : | $thisfile_id3v2_flags['compression'] = (bool) ($id3_flags & 0x40); // b - Compression | ||
| 83 : | break; | ||
| 84 : | |||
| 85 : | case 3: | ||
| 86 : | // %abc00000 in v2.3 | ||
| 87 : | $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation | ||
| 88 : | $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); // b - Extended header | ||
| 89 : | $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); // c - Experimental indicator | ||
| 90 : | break; | ||
| 91 : | |||
| 92 : | case 4: | ||
| 93 : | // %abcd0000 in v2.4 | ||
| 94 : | $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation | ||
| 95 : | $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); // b - Extended header | ||
| 96 : | $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); // c - Experimental indicator | ||
| 97 : | $thisfile_id3v2_flags['isfooter'] = (bool) ($id3_flags & 0x10); // d - Footer present | ||
| 98 : | break; | ||
| 99 : | } | ||
| 100 : | |||
| 101 : | $thisfile_id3v2['headerlength'] = getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length | ||
| 102 : | |||
| 103 : | $thisfile_id3v2['tag_offset_start'] = $StartingOffset; | ||
| 104 : | $thisfile_id3v2['tag_offset_end'] = $thisfile_id3v2['tag_offset_start'] + $thisfile_id3v2['headerlength']; | ||
| 105 : | |||
| 106 : | // Extended Header | ||
| 107 : | if (isset($thisfile_id3v2_flags['exthead']) && $thisfile_id3v2_flags['exthead']) { | ||
| 108 : | // Extended header size 4 * %0xxxxxxx | ||
| 109 : | // Number of flag bytes $01 | ||
| 110 : | // Extended Flags $xx | ||
| 111 : | // Where the 'Extended header size' is the size of the whole extended header, stored as a 32 bit synchsafe integer. | ||
| 112 : | $thisfile_id3v2['exthead_length'] = getid3_lib::BigEndian2Int(fread($fd, 4), 1); | ||
| 113 : | |||
| 114 : | $thisfile_id3v2['exthead_flag_bytes'] = ord(fread($fd, 1)); | ||
| 115 : | if ($thisfile_id3v2['exthead_flag_bytes'] == 1) { | ||
| 116 : | // The extended flags field, with its size described by 'number of flag bytes', is defined as: | ||
| 117 : | // %0bcd0000 | ||
| 118 : | // b - Tag is an update | ||
| 119 : | // Flag data length $00 | ||
| 120 : | // c - CRC data present | ||
| 121 : | // Flag data length $05 | ||
| 122 : | // Total frame CRC 5 * %0xxxxxxx | ||
| 123 : | // d - Tag restrictions | ||
| 124 : | // Flag data length $01 | ||
| 125 : | $extheaderflags = fread($fd, $thisfile_id3v2['exthead_flag_bytes']); | ||
| 126 : | $id3_exthead_flags = getid3_lib::BigEndian2Bin(substr($header, 5, 1)); | ||
| 127 : | $thisfile_id3v2['exthead_flags']['update'] = substr($id3_exthead_flags, 1, 1); | ||
| 128 : | $thisfile_id3v2['exthead_flags']['CRC'] = substr($id3_exthead_flags, 2, 1); | ||
| 129 : | if ($thisfile_id3v2['exthead_flags']['CRC']) { | ||
| 130 : | $extheaderrawCRC = fread($fd, 5); | ||
| 131 : | $thisfile_id3v2['exthead_flags']['CRC'] = getid3_lib::BigEndian2Int($extheaderrawCRC, 1); | ||
| 132 : | } | ||
| 133 : | $thisfile_id3v2['exthead_flags']['restrictions'] = substr($id3_exthead_flags, 3, 1); | ||
| 134 : | if ($thisfile_id3v2['exthead_flags']['restrictions']) { | ||
| 135 : | // Restrictions %ppqrrstt | ||
| 136 : | $extheaderrawrestrictions = fread($fd, 1); | ||
| 137 : | $thisfile_id3v2['exthead_flags']['restrictions_tagsize'] = (bindec('11000000') & ord($extheaderrawrestrictions)) >> 6; // p - Tag size restrictions | ||
| 138 : | $thisfile_id3v2['exthead_flags']['restrictions_textenc'] = (bindec('00100000') & ord($extheaderrawrestrictions)) >> 5; // q - Text encoding restrictions | ||
| 139 : | $thisfile_id3v2['exthead_flags']['restrictions_textsize'] = (bindec('00011000') & ord($extheaderrawrestrictions)) >> 3; // r - Text fields size restrictions | ||
| 140 : | $thisfile_id3v2['exthead_flags']['restrictions_imgenc'] = (bindec('00000100') & ord($extheaderrawrestrictions)) >> 2; // s - Image encoding restrictions | ||
| 141 : | $thisfile_id3v2['exthead_flags']['restrictions_imgsize'] = (bindec('00000011') & ord($extheaderrawrestrictions)) >> 0; // t - Image size restrictions | ||
| 142 : | } | ||
| 143 : | } else { | ||
| 144 : | $ThisFileInfo['warning'][] = '$thisfile_id3v2[exthead_flag_bytes] = "'.$thisfile_id3v2['exthead_flag_bytes'].'" (expecting "1")'; | ||
| 145 : | fseek($fd, $thisfile_id3v2['exthead_length'] - 1, SEEK_CUR); | ||
| 146 : | //return false; | ||
| 147 : | } | ||
| 148 : | } // end extended header | ||
| 149 : | |||
| 150 : | |||
| 151 : | // create 'encoding' key - used by getid3::HandleAllTags() | ||
| 152 : | // in ID3v2 every field can have it's own encoding type | ||
| 153 : | // so force everything to UTF-8 so it can be handled consistantly | ||
| 154 : | $thisfile_id3v2['encoding'] = 'UTF-8'; | ||
| 155 : | |||
| 156 : | |||
| 157 : | // Frames | ||
| 158 : | |||
| 159 : | // All ID3v2 frames consists of one frame header followed by one or more | ||
| 160 : | // fields containing the actual information. The header is always 10 | ||
| 161 : | // bytes and laid out as follows: | ||
| 162 : | // | ||
| 163 : | // Frame ID $xx xx xx xx (four characters) | ||
| 164 : | // Size 4 * %0xxxxxxx | ||
| 165 : | // Flags $xx xx | ||
| 166 : | |||
| 167 : | $sizeofframes = $thisfile_id3v2['headerlength'] - 10; // not including 10-byte initial header | ||
| 168 : | if (@$thisfile_id3v2['exthead_length']) { | ||
| 169 : | $sizeofframes -= ($thisfile_id3v2['exthead_length'] + 4); | ||
| 170 : | } | ||
| 171 : | if (@$thisfile_id3v2_flags['isfooter']) { | ||
| 172 : | $sizeofframes -= 10; // footer takes last 10 bytes of ID3v2 header, after frame data, before audio | ||
| 173 : | } | ||
| 174 : | if ($sizeofframes > 0) { | ||
| 175 : | |||
| 176 : | $framedata = fread($fd, $sizeofframes); // read all frames from file into $framedata variable | ||
| 177 : | |||
| 178 : | // if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x) | ||
| 179 : | if (@$thisfile_id3v2_flags['unsynch'] && ($id3v2_majorversion <= 3)) { | ||
| 180 : | $framedata = $this->DeUnsynchronise($framedata); | ||
| 181 : | } | ||
| 182 : | // [in ID3v2.4.0] Unsynchronisation [S:6.1] is done on frame level, instead | ||
| 183 : | // of on tag level, making it easier to skip frames, increasing the streamability | ||
| 184 : | // of the tag. The unsynchronisation flag in the header [S:3.1] indicates that | ||
| 185 : | // there exists an unsynchronised frame, while the new unsynchronisation flag in | ||
| 186 : | // the frame header [S:4.1.2] indicates unsynchronisation. | ||
| 187 : | |||
| 188 : | $framedataoffset = 10 + (@$thisfile_id3v2['exthead_length'] ? $thisfile_id3v2['exthead_length'] + 4 : 0); // how many bytes into the stream - start from after the 10-byte header (and extended header length+4, if present) | ||
| 189 : | while (isset($framedata) && (strlen($framedata) > 0)) { // cycle through until no more frame data is left to parse | ||
| 190 : | if (strlen($framedata) <= $this->ID3v2HeaderLength($id3v2_majorversion)) { | ||
| 191 : | // insufficient room left in ID3v2 header for actual data - must be padding | ||
| 192 : | $thisfile_id3v2['padding']['start'] = $framedataoffset; | ||
| 193 : | $thisfile_id3v2['padding']['length'] = strlen($framedata); | ||
| 194 : | $thisfile_id3v2['padding']['valid'] = true; | ||
| 195 : | for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) { | ||
| 196 : | if ($framedata{$i} != "\x00") { | ||
| 197 : | $thisfile_id3v2['padding']['valid'] = false; | ||
| 198 : | $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; | ||
| 199 : | $ThisFileInfo['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'; | ||
| 200 : | break; | ||
| 201 : | } | ||
| 202 : | } | ||
| 203 : | break; // skip rest of ID3v2 header | ||
| 204 : | } | ||
| 205 : | if ($id3v2_majorversion == 2) { | ||
| 206 : | // Frame ID $xx xx xx (three characters) | ||
| 207 : | // Size $xx xx xx (24-bit integer) | ||
| 208 : | // Flags $xx xx | ||
| 209 : | |||
| 210 : | $frame_header = substr($framedata, 0, 6); // take next 6 bytes for header | ||
| 211 : | $framedata = substr($framedata, 6); // and leave the rest in $framedata | ||
| 212 : | $frame_name = substr($frame_header, 0, 3); | ||
| 213 : | $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0); | ||
| 214 : | $frame_flags = 0; // not used for anything in ID3v2.2, just set to avoid E_NOTICEs | ||
| 215 : | |||
| 216 : | } elseif ($id3v2_majorversion > 2) { | ||
| 217 : | |||
| 218 : | // Frame ID $xx xx xx xx (four characters) | ||
| 219 : | // Size $xx xx xx xx (32-bit integer in v2.3, 28-bit synchsafe in v2.4+) | ||
| 220 : | // Flags $xx xx | ||
| 221 : | |||
| 222 : | $frame_header = substr($framedata, 0, 10); // take next 10 bytes for header | ||
| 223 : | $framedata = substr($framedata, 10); // and leave the rest in $framedata | ||
| 224 : | |||
| 225 : | $frame_name = substr($frame_header, 0, 4); | ||
| 226 : | if ($id3v2_majorversion == 3) { | ||
| 227 : | $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer | ||
| 228 : | } else { // ID3v2.4+ | ||
| 229 : | $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 1); // 32-bit synchsafe integer (28-bit value) | ||
| 230 : | } | ||
| 231 : | |||
| 232 : | if ($frame_size < (strlen($framedata) + 4)) { | ||
| 233 : | $nextFrameID = substr($framedata, $frame_size, 4); | ||
| 234 : | if ($this->IsValidID3v2FrameName($nextFrameID, $id3v2_majorversion)) { | ||
| 235 : | // next frame is OK | ||
| 236 : | } elseif (($frame_name == "\x00".'MP3') || ($frame_name == "\x00\x00".'MP') || ($frame_name == ' MP3') || ($frame_name == 'MP3e')) { | ||
| 237 : | // MP3ext known broken frames - "ok" for the purposes of this test | ||
| 238 : | } elseif (($id3v2_majorversion == 4) && ($this->IsValidID3v2FrameName(substr($framedata, getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0), 4), 3))) { | ||
| 239 : | $ThisFileInfo['warning'][] = 'ID3v2 tag written as ID3v2.4, but with non-synchsafe integers (ID3v2.3 style). Older versions of (Helium2; iTunes) are known culprits of this. Tag has been parsed as ID3v2.3'; | ||
| 240 : | $id3v2_majorversion = 3; | ||
| 241 : | $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer | ||
| 242 : | } | ||
| 243 : | } | ||
| 244 : | |||
| 245 : | |||
| 246 : | $frame_flags = getid3_lib::BigEndian2Int(substr($frame_header, 8, 2)); | ||
| 247 : | } | ||
| 248 : | |||
| 249 : | if ((($id3v2_majorversion == 2) && ($frame_name == "\x00\x00\x00")) || ($frame_name == "\x00\x00\x00\x00")) { | ||
| 250 : | // padding encountered | ||
| 251 : | |||
| 252 : | $thisfile_id3v2['padding']['start'] = $framedataoffset; | ||
| 253 : | $thisfile_id3v2['padding']['length'] = strlen($framedata); | ||
| 254 : | $thisfile_id3v2['padding']['valid'] = true; | ||
| 255 : | for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) { | ||
| 256 : | if ($framedata{$i} != "\x00") { | ||
| 257 : | $thisfile_id3v2['padding']['valid'] = false; | ||
| 258 : | $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; | ||
| 259 : | $ThisFileInfo['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'; | ||
| 260 : | break; | ||
| 261 : | } | ||
| 262 : | } | ||
| 263 : | break; // skip rest of ID3v2 header | ||
| 264 : | } | ||
| 265 : | |||
| 266 : | if ($frame_name == 'COM ') { | ||
| 267 : | $ThisFileInfo['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by iTunes (versions "X v2.0.3", "v3.0.1" are known-guilty, probably others too)]'; | ||
| 268 : | $frame_name = 'COMM'; | ||
| 269 : | } | ||
| 270 : | if (($frame_size <= strlen($framedata)) && ($this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion))) { | ||
| 271 : | |||
| 272 : | if (isset($parsedFrame)) { | ||
| 273 : | unset($parsedFrame); | ||
| 274 : | } | ||
| 275 : | $parsedFrame['frame_name'] = $frame_name; | ||
| 276 : | $parsedFrame['frame_flags_raw'] = $frame_flags; | ||
| 277 : | $parsedFrame['data'] = substr($framedata, 0, $frame_size); | ||
| 278 : | $parsedFrame['datalength'] = getid3_lib::CastAsInt($frame_size); | ||
| 279 : | $parsedFrame['dataoffset'] = $framedataoffset; | ||
| 280 : | |||
| 281 : | $this->ParseID3v2Frame($parsedFrame, $ThisFileInfo); | ||
| 282 : | $thisfile_id3v2[$frame_name][] = $parsedFrame; | ||
| 283 : | |||
| 284 : | $framedata = substr($framedata, $frame_size); | ||
| 285 : | |||
| 286 : | } else { // invalid frame length or FrameID | ||
| 287 : | |||
| 288 : | if ($frame_size <= strlen($framedata)) { | ||
| 289 : | |||
| 290 : | if ($this->IsValidID3v2FrameName(substr($framedata, $frame_size, 4), $id3v2_majorversion)) { | ||
| 291 : | |||
| 292 : | // next frame is valid, just skip the current frame | ||
| 293 : | $framedata = substr($framedata, $frame_size); | ||
| 294 : | $ThisFileInfo['warning'][] = 'Next ID3v2 frame is valid, skipping current frame.'; | ||
| 295 : | |||
| 296 : | } else { | ||
| 297 : | |||
| 298 : | // next frame is invalid too, abort processing | ||
| 299 : | //unset($framedata); | ||
| 300 : | $framedata = null; | ||
| 301 : | $ThisFileInfo['error'][] = 'Next ID3v2 frame is also invalid, aborting processing.'; | ||
| 302 : | |||
| 303 : | } | ||
| 304 : | |||
| 305 : | } elseif ($frame_size == strlen($framedata)) { | ||
| 306 : | |||
| 307 : | // this is the last frame, just skip | ||
| 308 : | $ThisFileInfo['warning'][] = 'This was the last ID3v2 frame.'; | ||
| 309 : | |||
| 310 : | } else { | ||
| 311 : | |||
| 312 : | // next frame is invalid too, abort processing | ||
| 313 : | //unset($framedata); | ||
| 314 : | $framedata = null; | ||
| 315 : | $ThisFileInfo['warning'][] = 'Invalid ID3v2 frame size, aborting.'; | ||
| 316 : | |||
| 317 : | } | ||
| 318 : | if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) { | ||
| 319 : | |||
| 320 : | switch ($frame_name) { | ||
| 321 : | case "\x00\x00".'MP': | ||
| 322 : | case "\x00".'MP3': | ||
| 323 : | case ' MP3': | ||
| 324 : | case 'MP3e': | ||
| 325 : | case "\x00".'MP': | ||
| 326 : | case ' MP': | ||
| 327 : | case 'MP3': | ||
| 328 : | $ThisFileInfo['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by "MP3ext (www.mutschler.de/mp3ext/)"]'; | ||
| 329 : | break; | ||
| 330 : | |||
| 331 : | default: | ||
| 332 : | $ThisFileInfo['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))).'; | ||
| 333 : | break; | ||
| 334 : | } | ||
| 335 : | |||
| 336 : | } elseif ($frame_size > strlen($framedata)){ | ||
| 337 : | |||
| 338 : | $ThisFileInfo['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.strlen($framedata).')).'; | ||
| 339 : | |||
| 340 : | } else { | ||
| 341 : | |||
| 342 : | $ThisFileInfo['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag).'; | ||
| 343 : | |||
| 344 : | } | ||
| 345 : | |||
| 346 : | } | ||
| 347 : | $framedataoffset += ($frame_size + $this->ID3v2HeaderLength($id3v2_majorversion)); | ||
| 348 : | |||
| 349 : | } | ||
| 350 : | |||
| 351 : | } | ||
| 352 : | |||
| 353 : | |||
| 354 : | // Footer | ||
| 355 : | |||
| 356 : | // The footer is a copy of the header, but with a different identifier. | ||
| 357 : | // ID3v2 identifier "3DI" | ||
| 358 : | // ID3v2 version $04 00 | ||
| 359 : | // ID3v2 flags %abcd0000 | ||
| 360 : | // ID3v2 size 4 * %0xxxxxxx | ||
| 361 : | |||
| 362 : | if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) { | ||
| 363 : | $footer = fread($fd, 10); | ||
| 364 : | if (substr($footer, 0, 3) == '3DI') { | ||
| 365 : | $thisfile_id3v2['footer'] = true; | ||
| 366 : | $thisfile_id3v2['majorversion_footer'] = ord($footer{3}); | ||
| 367 : | $thisfile_id3v2['minorversion_footer'] = ord($footer{4}); | ||
| 368 : | } | ||
| 369 : | if ($thisfile_id3v2['majorversion_footer'] <= 4) { | ||
| 370 : | $id3_flags = ord(substr($footer{5})); | ||
| 371 : | $thisfile_id3v2_flags['unsynch_footer'] = (bool) ($id3_flags & 0x80); | ||
| 372 : | $thisfile_id3v2_flags['extfoot_footer'] = (bool) ($id3_flags & 0x40); | ||
| 373 : | $thisfile_id3v2_flags['experim_footer'] = (bool) ($id3_flags & 0x20); | ||
| 374 : | $thisfile_id3v2_flags['isfooter_footer'] = (bool) ($id3_flags & 0x10); | ||
| 375 : | |||
| 376 : | $thisfile_id3v2['footerlength'] = getid3_lib::BigEndian2Int(substr($footer, 6, 4), 1); | ||
| 377 : | } | ||
| 378 : | } // end footer | ||
| 379 : | |||
| 380 : | if (isset($thisfile_id3v2['comments']['genre'])) { | ||
| 381 : | foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) { | ||
| 382 : | unset($thisfile_id3v2['comments']['genre'][$key]); | ||
| 383 : | $thisfile_id3v2['comments'] = getid3_lib::array_merge_noclobber($thisfile_id3v2['comments'], $this->ParseID3v2GenreString($value)); | ||
| 384 : | } | ||
| 385 : | } | ||
| 386 : | |||
| 387 : | if (isset($thisfile_id3v2['comments']['track'])) { | ||
| 388 : | foreach ($thisfile_id3v2['comments']['track'] as $key => $value) { | ||
| 389 : | if (strstr($value, '/')) { | ||
| 390 : | list($thisfile_id3v2['comments']['tracknum'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track'][$key]); | ||
| 391 : | } | ||
| 392 : | } | ||
| 393 : | } | ||
| 394 : | |||
| 395 : | if (!isset($thisfile_id3v2['comments']['year']) && ereg('^([0-9]{4})', trim(@$thisfile_id3v2['comments']['recording_time'][0]), $matches)) { | ||
| 396 : | $thisfile_id3v2['comments']['year'] = array($matches[1]); | ||
| 397 : | } | ||
| 398 : | |||
| 399 : | |||
| 400 : | // Set avdataoffset | ||
| 401 : | $ThisFileInfo['avdataoffset'] = $thisfile_id3v2['headerlength']; | ||
| 402 : | if (isset($thisfile_id3v2['footer'])) { | ||
| 403 : | $ThisFileInfo['avdataoffset'] += 10; | ||
| 404 : | } | ||
| 405 : | |||
| 406 : | return true; | ||
| 407 : | } | ||
| 408 : | |||
| 409 : | |||
| 410 : | function ParseID3v2GenreString($genrestring) { | ||
| 411 : | // Parse genres into arrays of genreName and genreID | ||
| 412 : | // ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)' | ||
| 413 : | // ID3v2.4.x: '21' $00 'Eurodisco' $00 | ||
| 414 : | |||
| 415 : | $genrestring = trim($genrestring); | ||
| 416 : | $returnarray = array(); | ||
| 417 : | if (strpos($genrestring, "\x00") !== false) { | ||
| 418 : | $unprocessed = trim($genrestring); // trailing nulls will cause an infinite loop. | ||
| 419 : | $genrestring = ''; | ||
| 420 : | while (strpos($unprocessed, "\x00") !== false) { | ||
| 421 : | // convert null-seperated v2.4-format into v2.3 ()-seperated format | ||
| 422 : | $endpos = strpos($unprocessed, "\x00"); | ||
| 423 : | $genrestring .= '('.substr($unprocessed, 0, $endpos).')'; | ||
| 424 : | $unprocessed = substr($unprocessed, $endpos + 1); | ||
| 425 : | } | ||
| 426 : | unset($unprocessed); | ||
| 427 : | } | ||
| 428 : | if (getid3_id3v1::LookupGenreID($genrestring)) { | ||
| 429 : | |||
| 430 : | $returnarray['genre'][] = $genrestring; | ||
| 431 : | |||
| 432 : | } else { | ||
| 433 : | |||
| 434 : | while (strpos($genrestring, '(') !== false) { | ||
| 435 : | |||
| 436 : | $startpos = strpos($genrestring, '('); | ||
| 437 : | $endpos = strpos($genrestring, ')'); | ||
| 438 : | if (substr($genrestring, $startpos + 1, 1) == '(') { | ||
| 439 : | $genrestring = substr($genrestring, 0, $startpos).substr($genrestring, $startpos + 1); | ||
| 440 : | $endpos--; | ||
| 441 : | } | ||
| 442 : | $element = substr($genrestring, $startpos + 1, $endpos - ($startpos + 1)); | ||
| 443 : | $genrestring = substr($genrestring, 0, $startpos).substr($genrestring, $endpos + 1); | ||
| 444 : | if (getid3_id3v1::LookupGenreName($element)) { // $element is a valid genre id/abbreviation | ||
| 445 : | |||
| 446 : | if (empty($returnarray['genre']) || !in_array(getid3_id3v1::LookupGenreName($element), $returnarray['genre'])) { // avoid duplicate entires | ||
| 447 : | $returnarray['genre'][] = getid3_id3v1::LookupGenreName($element); | ||
| 448 : | } | ||
| 449 : | |||
| 450 : | } else { | ||
| 451 : | |||
| 452 : | if (empty($returnarray['genre']) || !in_array($element, $returnarray['genre'])) { // avoid duplicate entires | ||
| 453 : | $returnarray['genre'][] = $element; | ||
| 454 : | } | ||
| 455 : | |||
| 456 : | } | ||
| 457 : | } | ||
| 458 : | } | ||
| 459 : | if ($genrestring) { | ||
| 460 : | if (empty($returnarray['genre']) || !in_array($genrestring, $returnarray['genre'])) { // avoid duplicate entires | ||
| 461 : | $returnarray['genre'][] = $genrestring; | ||
| 462 : | } | ||
| 463 : | } | ||
| 464 : | |||
| 465 : | return $returnarray; | ||
| 466 : | } | ||
| 467 : | |||
| 468 : | |||
| 469 : | function ParseID3v2Frame(&$parsedFrame, &$ThisFileInfo) { | ||
| 470 : | $frame_indexpoints = 0; | ||
| 471 : | // shortcuts | ||
| 472 : | $id3v2_majorversion = $ThisFileInfo['id3v2']['majorversion']; | ||
| 473 : | |||
| 474 : | $parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']); | ||
| 475 : | if (empty($parsedFrame['framenamelong'])) { | ||
| 476 : | unset($parsedFrame['framenamelong']); | ||
| 477 : | } | ||
| 478 : | $parsedFrame['framenameshort'] = $this->FrameNameShortLookup($parsedFrame['frame_name']); | ||
| 479 : | if (empty($parsedFrame['framenameshort'])) { | ||
| 480 : | unset($parsedFrame['framenameshort']); | ||
| 481 : | } | ||
| 482 : | |||
| 483 : | if ($id3v2_majorversion >= 3) { // frame flags are not part of the ID3v2.2 standard | ||
| 484 : | if ($id3v2_majorversion == 3) { | ||
| 485 : | // Frame Header Flags | ||
| 486 : | // %abc00000 %ijk00000 | ||
| 487 : | $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x8000); // a - Tag alter preservation | ||
| 488 : | $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // b - File alter preservation | ||
| 489 : | $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // c - Read only | ||
| 490 : | $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0080); // i - Compression | ||
| 491 : | $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // j - Encryption | ||
| 492 : | $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0020); // k - Grouping identity | ||
| 493 : | |||
| 494 : | } elseif ($id3v2_majorversion == 4) { | ||
| 495 : | // Frame Header Flags | ||
| 496 : | // %0abc0000 %0h00kmnp | ||
| 497 : | $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // a - Tag alter preservation | ||
| 498 : | $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // b - File alter preservation | ||
| 499 : | $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x1000); // c - Read only | ||
| 500 : | $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // h - Grouping identity | ||
| 501 : | $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0008); // k - Compression | ||
| 502 : | $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0004); // m - Encryption | ||
| 503 : | $parsedFrame['flags']['Unsynchronisation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0002); // n - Unsynchronisation | ||
| 504 : | $parsedFrame['flags']['DataLengthIndicator'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0001); // p - Data length indicator | ||
| 505 : | |||
| 506 : | // Frame-level de-unsynchronisation - ID3v2.4 | ||
| 507 : | if ($parsedFrame['flags']['Unsynchronisation']) { | ||
| 508 : | $parsedFrame['data'] = $this->DeUnsynchronise($parsedFrame['data']); | ||
| 509 : | } | ||
| 510 : | } | ||
| 511 : | |||
| 512 : | // Frame-level de-compression | ||
| 513 : | if ($parsedFrame['flags']['compression']) { | ||
| 514 : | $parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4)); | ||
| 515 : | if (!function_exists('gzuncompress')) { | ||
| 516 : | $ThisFileInfo['warning'][] = 'gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"'; | ||
| 517 : | } elseif ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) { | ||
| 518 : | $parsedFrame['data'] = $decompresseddata; | ||
| 519 : | } else { | ||
| 520 : | $ThisFileInfo['warning'][] = 'gzuncompress() failed on compressed contents of ID3v2 frame "'.$parsedFrame['frame_name'].'"'; | ||
| 521 : | } | ||
| 522 : | } | ||
| 523 : | } | ||
| 524 : | |||
| 525 : | if (isset($parsedFrame['datalength']) && ($parsedFrame['datalength'] == 0)) { | ||
| 526 : | |||
| 527 : | $warning = 'Frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset'].' has no data portion'; | ||
| 528 : | switch ($parsedFrame['frame_name']) { | ||
| 529 : | case 'WCOM': | ||
| 530 : | $warning .= ' (this is known to happen with files tagged by RioPort)'; | ||
| 531 : | break; | ||
| 532 : | |||
| 533 : | default: | ||
| 534 : | break; | ||
| 535 : | } | ||
| 536 : | $ThisFileInfo['warning'][] = $warning; | ||
| 537 : | |||
| 538 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'UFID')) || // 4.1 UFID Unique file identifier | ||
| 539 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'UFI'))) { // 4.1 UFI Unique file identifier | ||
| 540 : | // There may be more than one 'UFID' frame in a tag, | ||
| 541 : | // but only one with the same 'Owner identifier'. | ||
| 542 : | // <Header for 'Unique file identifier', ID: 'UFID'> | ||
| 543 : | // Owner identifier <text string> $00 | ||
| 544 : | // Identifier <up to 64 bytes binary data> | ||
| 545 : | |||
| 546 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00"); | ||
| 547 : | $frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos); | ||
| 548 : | $parsedFrame['ownerid'] = $frame_idstring; | ||
| 549 : | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); | ||
| 550 : | unset($parsedFrame['data']); | ||
| 551 : | |||
| 552 : | |||
| 553 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'TXXX')) || // 4.2.2 TXXX User defined text information frame | ||
| 554 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'TXX'))) { // 4.2.2 TXX User defined text information frame | ||
| 555 : | // There may be more than one 'TXXX' frame in each tag, | ||
| 556 : | // but only one with the same description. | ||
| 557 : | // <Header for 'User defined text information frame', ID: 'TXXX'> | ||
| 558 : | // Text encoding $xx | ||
| 559 : | // Description <text string according to encoding> $00 (00) | ||
| 560 : | // Value <text string according to encoding> | ||
| 561 : | |||
| 562 : | $frame_offset = 0; | ||
| 563 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 564 : | |||
| 565 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 566 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 567 : | } | ||
| 568 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 569 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 570 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 571 : | } | ||
| 572 : | $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 573 : | if (ord($frame_description) === 0) { | ||
| 574 : | $frame_description = ''; | ||
| 575 : | } | ||
| 576 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 577 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 578 : | |||
| 579 : | $parsedFrame['description'] = $frame_description; | ||
| 580 : | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); | ||
| 581 : | if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { | ||
| 582 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data'])); | ||
| 583 : | } | ||
| 584 : | unset($parsedFrame['data']); | ||
| 585 : | |||
| 586 : | |||
| 587 : | } elseif ($parsedFrame['frame_name']{0} == 'T') { // 4.2. T??[?] Text information frame | ||
| 588 : | // There may only be one text information frame of its kind in an tag. | ||
| 589 : | // <Header for 'Text information frame', ID: 'T000' - 'TZZZ', | ||
| 590 : | // excluding 'TXXX' described in 4.2.6.> | ||
| 591 : | // Text encoding $xx | ||
| 592 : | // Information <text string(s) according to encoding> | ||
| 593 : | |||
| 594 : | $frame_offset = 0; | ||
| 595 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 596 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 597 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 598 : | } | ||
| 599 : | |||
| 600 : | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 601 : | |||
| 602 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 603 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 604 : | |||
| 605 : | if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { | ||
| 606 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); | ||
| 607 : | } | ||
| 608 : | |||
| 609 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'WXXX')) || // 4.3.2 WXXX User defined URL link frame | ||
| 610 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'WXX'))) { // 4.3.2 WXX User defined URL link frame | ||
| 611 : | // There may be more than one 'WXXX' frame in each tag, | ||
| 612 : | // but only one with the same description | ||
| 613 : | // <Header for 'User defined URL link frame', ID: 'WXXX'> | ||
| 614 : | // Text encoding $xx | ||
| 615 : | // Description <text string according to encoding> $00 (00) | ||
| 616 : | // URL <text string> | ||
| 617 : | |||
| 618 : | $frame_offset = 0; | ||
| 619 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 620 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 621 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 622 : | } | ||
| 623 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 624 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 625 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 626 : | } | ||
| 627 : | $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 628 : | |||
| 629 : | if (ord($frame_description) === 0) { | ||
| 630 : | $frame_description = ''; | ||
| 631 : | } | ||
| 632 : | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); | ||
| 633 : | |||
| 634 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding)); | ||
| 635 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 636 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 637 : | } | ||
| 638 : | if ($frame_terminatorpos) { | ||
| 639 : | // there are null bytes after the data - this is not according to spec | ||
| 640 : | // only use data up to first null byte | ||
| 641 : | $frame_urldata = (string) substr($parsedFrame['data'], 0, $frame_terminatorpos); | ||
| 642 : | } else { | ||
| 643 : | // no null bytes following data, just use all data | ||
| 644 : | $frame_urldata = (string) $parsedFrame['data']; | ||
| 645 : | } | ||
| 646 : | |||
| 647 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 648 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 649 : | |||
| 650 : | $parsedFrame['url'] = $frame_urldata; | ||
| 651 : | $parsedFrame['description'] = $frame_description; | ||
| 652 : | if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { | ||
| 653 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['url']); | ||
| 654 : | } | ||
| 655 : | unset($parsedFrame['data']); | ||
| 656 : | |||
| 657 : | |||
| 658 : | } elseif ($parsedFrame['frame_name']{0} == 'W') { // 4.3. W??? URL link frames | ||
| 659 : | // There may only be one URL link frame of its kind in a tag, | ||
| 660 : | // except when stated otherwise in the frame description | ||
| 661 : | // <Header for 'URL link frame', ID: 'W000' - 'WZZZ', excluding 'WXXX' | ||
| 662 : | // described in 4.3.2.> | ||
| 663 : | // URL <text string> | ||
| 664 : | |||
| 665 : | $parsedFrame['url'] = trim($parsedFrame['data']); | ||
| 666 : | if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { | ||
| 667 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['url']; | ||
| 668 : | } | ||
| 669 : | unset($parsedFrame['data']); | ||
| 670 : | |||
| 671 : | |||
| 672 : | } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'IPLS')) || // 4.4 IPLS Involved people list (ID3v2.3 only) | ||
| 673 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'IPL'))) { // 4.4 IPL Involved people list (ID3v2.2 only) | ||
| 674 : | // There may only be one 'IPL' frame in each tag | ||
| 675 : | // <Header for 'User defined URL link frame', ID: 'IPL'> | ||
| 676 : | // Text encoding $xx | ||
| 677 : | // People list strings <textstrings> | ||
| 678 : | |||
| 679 : | $frame_offset = 0; | ||
| 680 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 681 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 682 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 683 : | } | ||
| 684 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 685 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($parsedFrame['encodingid']); | ||
| 686 : | |||
| 687 : | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 688 : | if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { | ||
| 689 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); | ||
| 690 : | } | ||
| 691 : | |||
| 692 : | |||
| 693 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MCDI')) || // 4.4 MCDI Music CD identifier | ||
| 694 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MCI'))) { // 4.5 MCI Music CD identifier | ||
| 695 : | // There may only be one 'MCDI' frame in each tag | ||
| 696 : | // <Header for 'Music CD identifier', ID: 'MCDI'> | ||
| 697 : | // CD TOC <binary data> | ||
| 698 : | |||
| 699 : | if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { | ||
| 700 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data']; | ||
| 701 : | } | ||
| 702 : | |||
| 703 : | |||
| 704 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ETCO')) || // 4.5 ETCO Event timing codes | ||
| 705 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ETC'))) { // 4.6 ETC Event timing codes | ||
| 706 : | // There may only be one 'ETCO' frame in each tag | ||
| 707 : | // <Header for 'Event timing codes', ID: 'ETCO'> | ||
| 708 : | // Time stamp format $xx | ||
| 709 : | // Where time stamp format is: | ||
| 710 : | // $01 (32-bit value) MPEG frames from beginning of file | ||
| 711 : | // $02 (32-bit value) milliseconds from beginning of file | ||
| 712 : | // Followed by a list of key events in the following format: | ||
| 713 : | // Type of event $xx | ||
| 714 : | // Time stamp $xx (xx ...) | ||
| 715 : | // The 'Time stamp' is set to zero if directly at the beginning of the sound | ||
| 716 : | // or after the previous event. All events MUST be sorted in chronological order. | ||
| 717 : | |||
| 718 : | $frame_offset = 0; | ||
| 719 : | $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 720 : | |||
| 721 : | while ($frame_offset < strlen($parsedFrame['data'])) { | ||
| 722 : | $parsedFrame['typeid'] = substr($parsedFrame['data'], $frame_offset++, 1); | ||
| 723 : | $parsedFrame['type'] = $this->ETCOEventLookup($parsedFrame['typeid']); | ||
| 724 : | $parsedFrame['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); | ||
| 725 : | $frame_offset += 4; | ||
| 726 : | } | ||
| 727 : | unset($parsedFrame['data']); | ||
| 728 : | |||
| 729 : | |||
| 730 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MLLT')) || // 4.6 MLLT MPEG location lookup table | ||
| 731 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MLL'))) { // 4.7 MLL MPEG location lookup table | ||
| 732 : | // There may only be one 'MLLT' frame in each tag | ||
| 733 : | // <Header for 'Location lookup table', ID: 'MLLT'> | ||
| 734 : | // MPEG frames between reference $xx xx | ||
| 735 : | // Bytes between reference $xx xx xx | ||
| 736 : | // Milliseconds between reference $xx xx xx | ||
| 737 : | // Bits for bytes deviation $xx | ||
| 738 : | // Bits for milliseconds dev. $xx | ||
| 739 : | // Then for every reference the following data is included; | ||
| 740 : | // Deviation in bytes %xxx.... | ||
| 741 : | // Deviation in milliseconds %xxx.... | ||
| 742 : | |||
| 743 : | $frame_offset = 0; | ||
| 744 : | $parsedFrame['framesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 2)); | ||
| 745 : | $parsedFrame['bytesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 2, 3)); | ||
| 746 : | $parsedFrame['msbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 5, 3)); | ||
| 747 : | $parsedFrame['bitsforbytesdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 8, 1)); | ||
| 748 : | $parsedFrame['bitsformsdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 9, 1)); | ||
| 749 : | $parsedFrame['data'] = substr($parsedFrame['data'], 10); | ||
| 750 : | while ($frame_offset < strlen($parsedFrame['data'])) { | ||
| 751 : | $deviationbitstream .= getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 752 : | } | ||
| 753 : | $reference_counter = 0; | ||
| 754 : | while (strlen($deviationbitstream) > 0) { | ||
| 755 : | $parsedFrame[$reference_counter]['bytedeviation'] = bindec(substr($deviationbitstream, 0, $parsedFrame['bitsforbytesdeviation'])); | ||
| 756 : | $parsedFrame[$reference_counter]['msdeviation'] = bindec(substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'], $parsedFrame['bitsformsdeviation'])); | ||
| 757 : | $deviationbitstream = substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'] + $parsedFrame['bitsformsdeviation']); | ||
| 758 : | $reference_counter++; | ||
| 759 : | } | ||
| 760 : | unset($parsedFrame['data']); | ||
| 761 : | |||
| 762 : | |||
| 763 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYTC')) || // 4.7 SYTC Synchronised tempo codes | ||
| 764 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'STC'))) { // 4.8 STC Synchronised tempo codes | ||
| 765 : | // There may only be one 'SYTC' frame in each tag | ||
| 766 : | // <Header for 'Synchronised tempo codes', ID: 'SYTC'> | ||
| 767 : | // Time stamp format $xx | ||
| 768 : | // Tempo data <binary data> | ||
| 769 : | // Where time stamp format is: | ||
| 770 : | // $01 (32-bit value) MPEG frames from beginning of file | ||
| 771 : | // $02 (32-bit value) milliseconds from beginning of file | ||
| 772 : | |||
| 773 : | $frame_offset = 0; | ||
| 774 : | $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 775 : | $timestamp_counter = 0; | ||
| 776 : | while ($frame_offset < strlen($parsedFrame['data'])) { | ||
| 777 : | $parsedFrame[$timestamp_counter]['tempo'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 778 : | if ($parsedFrame[$timestamp_counter]['tempo'] == 255) { | ||
| 779 : | $parsedFrame[$timestamp_counter]['tempo'] += ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 780 : | } | ||
| 781 : | $parsedFrame[$timestamp_counter]['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); | ||
| 782 : | $frame_offset += 4; | ||
| 783 : | $timestamp_counter++; | ||
| 784 : | } | ||
| 785 : | unset($parsedFrame['data']); | ||
| 786 : | |||
| 787 : | |||
| 788 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USLT')) || // 4.8 USLT Unsynchronised lyric/text transcription | ||
| 789 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) { // 4.9 ULT Unsynchronised lyric/text transcription | ||
| 790 : | // There may be more than one 'Unsynchronised lyrics/text transcription' frame | ||
| 791 : | // in each tag, but only one with the same language and content descriptor. | ||
| 792 : | // <Header for 'Unsynchronised lyrics/text transcription', ID: 'USLT'> | ||
| 793 : | // Text encoding $xx | ||
| 794 : | // Language $xx xx xx | ||
| 795 : | // Content descriptor <text string according to encoding> $00 (00) | ||
| 796 : | // Lyrics/text <full text string according to encoding> | ||
| 797 : | |||
| 798 : | $frame_offset = 0; | ||
| 799 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 800 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 801 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 802 : | } | ||
| 803 : | $frame_language = substr($parsedFrame['data'], $frame_offset, 3); | ||
| 804 : | $frame_offset += 3; | ||
| 805 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 806 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 807 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 808 : | } | ||
| 809 : | $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 810 : | if (ord($frame_description) === 0) { | ||
| 811 : | $frame_description = ''; | ||
| 812 : | } | ||
| 813 : | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); | ||
| 814 : | |||
| 815 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 816 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 817 : | |||
| 818 : | $parsedFrame['data'] = $parsedFrame['data']; | ||
| 819 : | $parsedFrame['language'] = $frame_language; | ||
| 820 : | $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); | ||
| 821 : | $parsedFrame['description'] = $frame_description; | ||
| 822 : | if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { | ||
| 823 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); | ||
| 824 : | } | ||
| 825 : | unset($parsedFrame['data']); | ||
| 826 : | |||
| 827 : | |||
| 828 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYLT')) || // 4.9 SYLT Synchronised lyric/text | ||
| 829 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'SLT'))) { // 4.10 SLT Synchronised lyric/text | ||
| 830 : | // There may be more than one 'SYLT' frame in each tag, | ||
| 831 : | // but only one with the same language and content descriptor. | ||
| 832 : | // <Header for 'Synchronised lyrics/text', ID: 'SYLT'> | ||
| 833 : | // Text encoding $xx | ||
| 834 : | // Language $xx xx xx | ||
| 835 : | // Time stamp format $xx | ||
| 836 : | // $01 (32-bit value) MPEG frames from beginning of file | ||
| 837 : | // $02 (32-bit value) milliseconds from beginning of file | ||
| 838 : | // Content type $xx | ||
| 839 : | // Content descriptor <text string according to encoding> $00 (00) | ||
| 840 : | // Terminated text to be synced (typically a syllable) | ||
| 841 : | // Sync identifier (terminator to above string) $00 (00) | ||
| 842 : | // Time stamp $xx (xx ...) | ||
| 843 : | |||
| 844 : | $frame_offset = 0; | ||
| 845 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 846 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 847 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 848 : | } | ||
| 849 : | $frame_language = substr($parsedFrame['data'], $frame_offset, 3); | ||
| 850 : | $frame_offset += 3; | ||
| 851 : | $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 852 : | $parsedFrame['contenttypeid'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 853 : | $parsedFrame['contenttype'] = $this->SYTLContentTypeLookup($parsedFrame['contenttypeid']); | ||
| 854 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 855 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 856 : | |||
| 857 : | $parsedFrame['language'] = $frame_language; | ||
| 858 : | $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); | ||
| 859 : | |||
| 860 : | $timestampindex = 0; | ||
| 861 : | $frame_remainingdata = substr($parsedFrame['data'], $frame_offset); | ||
| 862 : | while (strlen($frame_remainingdata)) { | ||
| 863 : | $frame_offset = 0; | ||
| 864 : | $frame_terminatorpos = strpos($frame_remainingdata, $this->TextEncodingTerminatorLookup($frame_textencoding)); | ||
| 865 : | if ($frame_terminatorpos === false) { | ||
| 866 : | $frame_remainingdata = ''; | ||
| 867 : | } else { | ||
| 868 : | if (ord(substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 869 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 870 : | } | ||
| 871 : | $parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 872 : | |||
| 873 : | $frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); | ||
| 874 : | if (($timestampindex == 0) && (ord($frame_remainingdata{0}) != 0)) { | ||
| 875 : | // timestamp probably omitted for first data item | ||
| 876 : | } else { | ||
| 877 : | $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4)); | ||
| 878 : | $frame_remainingdata = substr($frame_remainingdata, 4); | ||
| 879 : | } | ||
| 880 : | $timestampindex++; | ||
| 881 : | } | ||
| 882 : | } | ||
| 883 : | unset($parsedFrame['data']); | ||
| 884 : | |||
| 885 : | |||
| 886 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMM')) || // 4.10 COMM Comments | ||
| 887 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'COM'))) { // 4.11 COM Comments | ||
| 888 : | // There may be more than one comment frame in each tag, | ||
| 889 : | // but only one with the same language and content descriptor. | ||
| 890 : | // <Header for 'Comment', ID: 'COMM'> | ||
| 891 : | // Text encoding $xx | ||
| 892 : | // Language $xx xx xx | ||
| 893 : | // Short content descrip. <text string according to encoding> $00 (00) | ||
| 894 : | // The actual text <full text string according to encoding> | ||
| 895 : | |||
| 896 : | if (strlen($parsedFrame['data']) < 5) { | ||
| 897 : | |||
| 898 : | $ThisFileInfo['warning'][] = 'Invalid data (too short) for "'.$parsedFrame['frame_name'].'" frame at offset '.$parsedFrame['dataoffset']; | ||
| 899 : | |||
| 900 : | } else { | ||
| 901 : | |||
| 902 : | $frame_offset = 0; | ||
| 903 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 904 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 905 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 906 : | } | ||
| 907 : | $frame_language = substr($parsedFrame['data'], $frame_offset, 3); | ||
| 908 : | $frame_offset += 3; | ||
| 909 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 910 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 911 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 912 : | } | ||
| 913 : | $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 914 : | if (ord($frame_description) === 0) { | ||
| 915 : | $frame_description = ''; | ||
| 916 : | } | ||
| 917 : | $frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); | ||
| 918 : | |||
| 919 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 920 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 921 : | |||
| 922 : | $parsedFrame['language'] = $frame_language; | ||
| 923 : | $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); | ||
| 924 : | $parsedFrame['description'] = $frame_description; | ||
| 925 : | $parsedFrame['data'] = $frame_text; | ||
| 926 : | if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { | ||
| 927 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); | ||
| 928 : | } | ||
| 929 : | |||
| 930 : | } | ||
| 931 : | |||
| 932 : | } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'RVA2')) { // 4.11 RVA2 Relative volume adjustment (2) (ID3v2.4+ only) | ||
| 933 : | // There may be more than one 'RVA2' frame in each tag, | ||
| 934 : | // but only one with the same identification string | ||
| 935 : | // <Header for 'Relative volume adjustment (2)', ID: 'RVA2'> | ||
| 936 : | // Identification <text string> $00 | ||
| 937 : | // The 'identification' string is used to identify the situation and/or | ||
| 938 : | // device where this adjustment should apply. The following is then | ||
| 939 : | // repeated for every channel: | ||
| 940 : | // Type of channel $xx | ||
| 941 : | // Volume adjustment $xx xx | ||
| 942 : | // Bits representing peak $xx | ||
| 943 : | // Peak volume $xx (xx ...) | ||
| 944 : | |||
| 945 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00"); | ||
| 946 : | $frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos); | ||
| 947 : | if (ord($frame_idstring) === 0) { | ||
| 948 : | $frame_idstring = ''; | ||
| 949 : | } | ||
| 950 : | $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); | ||
| 951 : | $parsedFrame['description'] = $frame_idstring; | ||
| 952 : | while (strlen($frame_remainingdata)) { | ||
| 953 : | $frame_offset = 0; | ||
| 954 : | $frame_channeltypeid = ord(substr($frame_remainingdata, $frame_offset++, 1)); | ||
| 955 : | $parsedFrame[$frame_channeltypeid]['channeltypeid'] = $frame_channeltypeid; | ||
| 956 : | $parsedFrame[$frame_channeltypeid]['channeltype'] = $this->RVA2ChannelTypeLookup($frame_channeltypeid); | ||
| 957 : | $parsedFrame[$frame_channeltypeid]['volumeadjust'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, 2), false, true); // 16-bit signed | ||
| 958 : | $frame_offset += 2; | ||
| 959 : | $parsedFrame[$frame_channeltypeid]['bitspeakvolume'] = ord(substr($frame_remainingdata, $frame_offset++, 1)); | ||
| 960 : | $frame_bytespeakvolume = ceil($parsedFrame[$frame_channeltypeid]['bitspeakvolume'] / 8); | ||
| 961 : | $parsedFrame[$frame_channeltypeid]['peakvolume'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume)); | ||
| 962 : | $frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume); | ||
| 963 : | } | ||
| 964 : | unset($parsedFrame['data']); | ||
| 965 : | |||
| 966 : | |||
| 967 : | } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'RVAD')) || // 4.12 RVAD Relative volume adjustment (ID3v2.3 only) | ||
| 968 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'RVA'))) { // 4.12 RVA Relative volume adjustment (ID3v2.2 only) | ||
| 969 : | // There may only be one 'RVA' frame in each tag | ||
| 970 : | // <Header for 'Relative volume adjustment', ID: 'RVA'> | ||
| 971 : | // ID3v2.2 => Increment/decrement %000000ba | ||
| 972 : | // ID3v2.3 => Increment/decrement %00fedcba | ||
| 973 : | // Bits used for volume descr. $xx | ||
| 974 : | // Relative volume change, right $xx xx (xx ...) // a | ||
| 975 : | // Relative volume change, left $xx xx (xx ...) // b | ||
| 976 : | // Peak volume right $xx xx (xx ...) | ||
| 977 : | // Peak volume left $xx xx (xx ...) | ||
| 978 : | // ID3v2.3 only, optional (not present in ID3v2.2): | ||
| 979 : | // Relative volume change, right back $xx xx (xx ...) // c | ||
| 980 : | // Relative volume change, left back $xx xx (xx ...) // d | ||
| 981 : | // Peak volume right back $xx xx (xx ...) | ||
| 982 : | // Peak volume left back $xx xx (xx ...) | ||
| 983 : | // ID3v2.3 only, optional (not present in ID3v2.2): | ||
| 984 : | // Relative volume change, center $xx xx (xx ...) // e | ||
| 985 : | // Peak volume center $xx xx (xx ...) | ||
| 986 : | // ID3v2.3 only, optional (not present in ID3v2.2): | ||
| 987 : | // Relative volume change, bass $xx xx (xx ...) // f | ||
| 988 : | // Peak volume bass $xx xx (xx ...) | ||
| 989 : | |||
| 990 : | $frame_offset = 0; | ||
| 991 : | $frame_incrdecrflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 992 : | $parsedFrame['incdec']['right'] = (bool) substr($frame_incrdecrflags, 6, 1); | ||
| 993 : | $parsedFrame['incdec']['left'] = (bool) substr($frame_incrdecrflags, 7, 1); | ||
| 994 : | $parsedFrame['bitsvolume'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 995 : | $frame_bytesvolume = ceil($parsedFrame['bitsvolume'] / 8); | ||
| 996 : | $parsedFrame['volumechange']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 997 : | if ($parsedFrame['incdec']['right'] === false) { | ||
| 998 : | $parsedFrame['volumechange']['right'] *= -1; | ||
| 999 : | } | ||
| 1000 : | $frame_offset += $frame_bytesvolume; | ||
| 1001 : | $parsedFrame['volumechange']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1002 : | if ($parsedFrame['incdec']['left'] === false) { | ||
| 1003 : | $parsedFrame['volumechange']['left'] *= -1; | ||
| 1004 : | } | ||
| 1005 : | $frame_offset += $frame_bytesvolume; | ||
| 1006 : | $parsedFrame['peakvolume']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1007 : | $frame_offset += $frame_bytesvolume; | ||
| 1008 : | $parsedFrame['peakvolume']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1009 : | $frame_offset += $frame_bytesvolume; | ||
| 1010 : | if ($id3v2_majorversion == 3) { | ||
| 1011 : | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); | ||
| 1012 : | if (strlen($parsedFrame['data']) > 0) { | ||
| 1013 : | $parsedFrame['incdec']['rightrear'] = (bool) substr($frame_incrdecrflags, 4, 1); | ||
| 1014 : | $parsedFrame['incdec']['leftrear'] = (bool) substr($frame_incrdecrflags, 5, 1); | ||
| 1015 : | $parsedFrame['volumechange']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1016 : | if ($parsedFrame['incdec']['rightrear'] === false) { | ||
| 1017 : | $parsedFrame['volumechange']['rightrear'] *= -1; | ||
| 1018 : | } | ||
| 1019 : | $frame_offset += $frame_bytesvolume; | ||
| 1020 : | $parsedFrame['volumechange']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1021 : | if ($parsedFrame['incdec']['leftrear'] === false) { | ||
| 1022 : | $parsedFrame['volumechange']['leftrear'] *= -1; | ||
| 1023 : | } | ||
| 1024 : | $frame_offset += $frame_bytesvolume; | ||
| 1025 : | $parsedFrame['peakvolume']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1026 : | $frame_offset += $frame_bytesvolume; | ||
| 1027 : | $parsedFrame['peakvolume']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1028 : | $frame_offset += $frame_bytesvolume; | ||
| 1029 : | } | ||
| 1030 : | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); | ||
| 1031 : | if (strlen($parsedFrame['data']) > 0) { | ||
| 1032 : | $parsedFrame['incdec']['center'] = (bool) substr($frame_incrdecrflags, 3, 1); | ||
| 1033 : | $parsedFrame['volumechange']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1034 : | if ($parsedFrame['incdec']['center'] === false) { | ||
| 1035 : | $parsedFrame['volumechange']['center'] *= -1; | ||
| 1036 : | } | ||
| 1037 : | $frame_offset += $frame_bytesvolume; | ||
| 1038 : | $parsedFrame['peakvolume']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1039 : | $frame_offset += $frame_bytesvolume; | ||
| 1040 : | } | ||
| 1041 : | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset); | ||
| 1042 : | if (strlen($parsedFrame['data']) > 0) { | ||
| 1043 : | $parsedFrame['incdec']['bass'] = (bool) substr($frame_incrdecrflags, 2, 1); | ||
| 1044 : | $parsedFrame['volumechange']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1045 : | if ($parsedFrame['incdec']['bass'] === false) { | ||
| 1046 : | $parsedFrame['volumechange']['bass'] *= -1; | ||
| 1047 : | } | ||
| 1048 : | $frame_offset += $frame_bytesvolume; | ||
| 1049 : | $parsedFrame['peakvolume']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume)); | ||
| 1050 : | $frame_offset += $frame_bytesvolume; | ||
| 1051 : | } | ||
| 1052 : | } | ||
| 1053 : | unset($parsedFrame['data']); | ||
| 1054 : | |||
| 1055 : | |||
| 1056 : | } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'EQU2')) { // 4.12 EQU2 Equalisation (2) (ID3v2.4+ only) | ||
| 1057 : | // There may be more than one 'EQU2' frame in each tag, | ||
| 1058 : | // but only one with the same identification string | ||
| 1059 : | // <Header of 'Equalisation (2)', ID: 'EQU2'> | ||
| 1060 : | // Interpolation method $xx | ||
| 1061 : | // $00 Band | ||
| 1062 : | // $01 Linear | ||
| 1063 : | // Identification <text string> $00 | ||
| 1064 : | // The following is then repeated for every adjustment point | ||
| 1065 : | // Frequency $xx xx | ||
| 1066 : | // Volume adjustment $xx xx | ||
| 1067 : | |||
| 1068 : | $frame_offset = 0; | ||
| 1069 : | $frame_interpolationmethod = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1070 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1071 : | $frame_idstring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1072 : | if (ord($frame_idstring) === 0) { | ||
| 1073 : | $frame_idstring = ''; | ||
| 1074 : | } | ||
| 1075 : | $parsedFrame['description'] = $frame_idstring; | ||
| 1076 : | $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00")); | ||
| 1077 : | while (strlen($frame_remainingdata)) { | ||
| 1078 : | $frame_frequency = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 2)) / 2; | ||
| 1079 : | $parsedFrame['data'][$frame_frequency] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, 2), false, true); | ||
| 1080 : | $frame_remainingdata = substr($frame_remainingdata, 4); | ||
| 1081 : | } | ||
| 1082 : | $parsedFrame['interpolationmethod'] = $frame_interpolationmethod; | ||
| 1083 : | unset($parsedFrame['data']); | ||
| 1084 : | |||
| 1085 : | |||
| 1086 : | } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'EQUA')) || // 4.12 EQUA Equalisation (ID3v2.3 only) | ||
| 1087 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'EQU'))) { // 4.13 EQU Equalisation (ID3v2.2 only) | ||
| 1088 : | // There may only be one 'EQUA' frame in each tag | ||
| 1089 : | // <Header for 'Relative volume adjustment', ID: 'EQU'> | ||
| 1090 : | // Adjustment bits $xx | ||
| 1091 : | // This is followed by 2 bytes + ('adjustment bits' rounded up to the | ||
| 1092 : | // nearest byte) for every equalisation band in the following format, | ||
| 1093 : | // giving a frequency range of 0 - 32767Hz: | ||
| 1094 : | // Increment/decrement %x (MSB of the Frequency) | ||
| 1095 : | // Frequency (lower 15 bits) | ||
| 1096 : | // Adjustment $xx (xx ...) | ||
| 1097 : | |||
| 1098 : | $frame_offset = 0; | ||
| 1099 : | $parsedFrame['adjustmentbits'] = substr($parsedFrame['data'], $frame_offset++, 1); | ||
| 1100 : | $frame_adjustmentbytes = ceil($parsedFrame['adjustmentbits'] / 8); | ||
| 1101 : | |||
| 1102 : | $frame_remainingdata = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1103 : | while (strlen($frame_remainingdata) > 0) { | ||
| 1104 : | $frame_frequencystr = getid3_lib::BigEndian2Bin(substr($frame_remainingdata, 0, 2)); | ||
| 1105 : | $frame_incdec = (bool) substr($frame_frequencystr, 0, 1); | ||
| 1106 : | $frame_frequency = bindec(substr($frame_frequencystr, 1, 15)); | ||
| 1107 : | $parsedFrame[$frame_frequency]['incdec'] = $frame_incdec; | ||
| 1108 : | $parsedFrame[$frame_frequency]['adjustment'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, $frame_adjustmentbytes)); | ||
| 1109 : | if ($parsedFrame[$frame_frequency]['incdec'] === false) { | ||
| 1110 : | $parsedFrame[$frame_frequency]['adjustment'] *= -1; | ||
| 1111 : | } | ||
| 1112 : | $frame_remainingdata = substr($frame_remainingdata, 2 + $frame_adjustmentbytes); | ||
| 1113 : | } | ||
| 1114 : | unset($parsedFrame['data']); | ||
| 1115 : | |||
| 1116 : | |||
| 1117 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RVRB')) || // 4.13 RVRB Reverb | ||
| 1118 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'REV'))) { // 4.14 REV Reverb | ||
| 1119 : | // There may only be one 'RVRB' frame in each tag. | ||
| 1120 : | // <Header for 'Reverb', ID: 'RVRB'> | ||
| 1121 : | // Reverb left (ms) $xx xx | ||
| 1122 : | // Reverb right (ms) $xx xx | ||
| 1123 : | // Reverb bounces, left $xx | ||
| 1124 : | // Reverb bounces, right $xx | ||
| 1125 : | // Reverb feedback, left to left $xx | ||
| 1126 : | // Reverb feedback, left to right $xx | ||
| 1127 : | // Reverb feedback, right to right $xx | ||
| 1128 : | // Reverb feedback, right to left $xx | ||
| 1129 : | // Premix left to right $xx | ||
| 1130 : | // Premix right to left $xx | ||
| 1131 : | |||
| 1132 : | $frame_offset = 0; | ||
| 1133 : | $parsedFrame['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); | ||
| 1134 : | $frame_offset += 2; | ||
| 1135 : | $parsedFrame['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); | ||
| 1136 : | $frame_offset += 2; | ||
| 1137 : | $parsedFrame['bouncesL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1138 : | $parsedFrame['bouncesR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1139 : | $parsedFrame['feedbackLL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1140 : | $parsedFrame['feedbackLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1141 : | $parsedFrame['feedbackRR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1142 : | $parsedFrame['feedbackRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1143 : | $parsedFrame['premixLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1144 : | $parsedFrame['premixRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1145 : | unset($parsedFrame['data']); | ||
| 1146 : | |||
| 1147 : | |||
| 1148 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'APIC')) || // 4.14 APIC Attached picture | ||
| 1149 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'PIC'))) { // 4.15 PIC Attached picture | ||
| 1150 : | // There may be several pictures attached to one file, | ||
| 1151 : | // each in their individual 'APIC' frame, but only one | ||
| 1152 : | // with the same content descriptor | ||
| 1153 : | // <Header for 'Attached picture', ID: 'APIC'> | ||
| 1154 : | // Text encoding $xx | ||
| 1155 : | // ID3v2.3+ => MIME type <text string> $00 | ||
| 1156 : | // ID3v2.2 => Image format $xx xx xx | ||
| 1157 : | // Picture type $xx | ||
| 1158 : | // Description <text string according to encoding> $00 (00) | ||
| 1159 : | // Picture data <binary data> | ||
| 1160 : | |||
| 1161 : | $frame_offset = 0; | ||
| 1162 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1163 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 1164 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 1165 : | } | ||
| 1166 : | |||
| 1167 : | if ($id3v2_majorversion == 2) { | ||
| 1168 : | $frame_imagetype = substr($parsedFrame['data'], $frame_offset, 3); | ||
| 1169 : | if (strtolower($frame_imagetype) == 'ima') { | ||
| 1170 : | // complete hack for mp3Rage (www.chaoticsoftware.com) that puts ID3v2.3-formatted | ||
| 1171 : | // MIME type instead of 3-char ID3v2.2-format image type (thanks xbhoff�pacbell*net) | ||
| 1172 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1173 : | $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1174 : | if (ord($frame_mimetype) === 0) { | ||
| 1175 : | $frame_mimetype = ''; | ||
| 1176 : | } | ||
| 1177 : | $frame_imagetype = strtoupper(str_replace('image/', '', strtolower($frame_mimetype))); | ||
| 1178 : | if ($frame_imagetype == 'JPEG') { | ||
| 1179 : | $frame_imagetype = 'JPG'; | ||
| 1180 : | } | ||
| 1181 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1182 : | } else { | ||
| 1183 : | $frame_offset += 3; | ||
| 1184 : | } | ||
| 1185 : | } | ||
| 1186 : | if ($id3v2_majorversion > 2) { | ||
| 1187 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1188 : | $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1189 : | if (ord($frame_mimetype) === 0) { | ||
| 1190 : | $frame_mimetype = ''; | ||
| 1191 : | } | ||
| 1192 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1193 : | } | ||
| 1194 : | |||
| 1195 : | $frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1196 : | |||
| 1197 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 1198 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 1199 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 1200 : | } | ||
| 1201 : | $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1202 : | if (ord($frame_description) === 0) { | ||
| 1203 : | $frame_description = ''; | ||
| 1204 : | } | ||
| 1205 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 1206 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 1207 : | |||
| 1208 : | if ($id3v2_majorversion == 2) { | ||
| 1209 : | $parsedFrame['imagetype'] = $frame_imagetype; | ||
| 1210 : | } else { | ||
| 1211 : | $parsedFrame['mime'] = $frame_mimetype; | ||
| 1212 : | } | ||
| 1213 : | $parsedFrame['picturetypeid'] = $frame_picturetype; | ||
| 1214 : | $parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype); | ||
| 1215 : | $parsedFrame['description'] = $frame_description; | ||
| 1216 : | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding))); | ||
| 1217 : | |||
| 1218 : | $imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data']); | ||
| 1219 : | if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { | ||
| 1220 : | $parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]); | ||
| 1221 : | if ($imagechunkcheck[0]) { | ||
| 1222 : | $parsedFrame['image_width'] = $imagechunkcheck[0]; | ||
| 1223 : | } | ||
| 1224 : | if ($imagechunkcheck[1]) { | ||
| 1225 : | $parsedFrame['image_height'] = $imagechunkcheck[1]; | ||
| 1226 : | } | ||
| 1227 : | $parsedFrame['image_bytes'] = strlen($parsedFrame['data']); | ||
| 1228 : | } | ||
| 1229 : | |||
| 1230 : | |||
| 1231 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GEOB')) || // 4.15 GEOB General encapsulated object | ||
| 1232 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'GEO'))) { // 4.16 GEO General encapsulated object | ||
| 1233 : | // There may be more than one 'GEOB' frame in each tag, | ||
| 1234 : | // but only one with the same content descriptor | ||
| 1235 : | // <Header for 'General encapsulated object', ID: 'GEOB'> | ||
| 1236 : | // Text encoding $xx | ||
| 1237 : | // MIME type <text string> $00 | ||
| 1238 : | // Filename <text string according to encoding> $00 (00) | ||
| 1239 : | // Content description <text string according to encoding> $00 (00) | ||
| 1240 : | // Encapsulated object <binary data> | ||
| 1241 : | |||
| 1242 : | $frame_offset = 0; | ||
| 1243 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1244 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 1245 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 1246 : | } | ||
| 1247 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1248 : | $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1249 : | if (ord($frame_mimetype) === 0) { | ||
| 1250 : | $frame_mimetype = ''; | ||
| 1251 : | } | ||
| 1252 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1253 : | |||
| 1254 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 1255 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 1256 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 1257 : | } | ||
| 1258 : | $frame_filename = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1259 : | if (ord($frame_filename) === 0) { | ||
| 1260 : | $frame_filename = ''; | ||
| 1261 : | } | ||
| 1262 : | $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)); | ||
| 1263 : | |||
| 1264 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 1265 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 1266 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 1267 : | } | ||
| 1268 : | $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1269 : | if (ord($frame_description) === 0) { | ||
| 1270 : | $frame_description = ''; | ||
| 1271 : | } | ||
| 1272 : | $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)); | ||
| 1273 : | |||
| 1274 : | $parsedFrame['objectdata'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1275 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 1276 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 1277 : | |||
| 1278 : | $parsedFrame['mime'] = $frame_mimetype; | ||
| 1279 : | $parsedFrame['filename'] = $frame_filename; | ||
| 1280 : | $parsedFrame['description'] = $frame_description; | ||
| 1281 : | unset($parsedFrame['data']); | ||
| 1282 : | |||
| 1283 : | |||
| 1284 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PCNT')) || // 4.16 PCNT Play counter | ||
| 1285 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CNT'))) { // 4.17 CNT Play counter | ||
| 1286 : | // There may only be one 'PCNT' frame in each tag. | ||
| 1287 : | // When the counter reaches all one's, one byte is inserted in | ||
| 1288 : | // front of the counter thus making the counter eight bits bigger | ||
| 1289 : | // <Header for 'Play counter', ID: 'PCNT'> | ||
| 1290 : | // Counter $xx xx xx xx (xx ...) | ||
| 1291 : | |||
| 1292 : | $parsedFrame['data'] = getid3_lib::BigEndian2Int($parsedFrame['data']); | ||
| 1293 : | |||
| 1294 : | |||
| 1295 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || // 4.17 POPM Popularimeter | ||
| 1296 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'POP'))) { // 4.18 POP Popularimeter | ||
| 1297 : | // There may be more than one 'POPM' frame in each tag, | ||
| 1298 : | // but only one with the same email address | ||
| 1299 : | // <Header for 'Popularimeter', ID: 'POPM'> | ||
| 1300 : | // Email to user <text string> $00 | ||
| 1301 : | // Rating $xx | ||
| 1302 : | // Counter $xx xx xx xx (xx ...) | ||
| 1303 : | |||
| 1304 : | $frame_offset = 0; | ||
| 1305 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1306 : | $frame_emailaddress = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1307 : | if (ord($frame_emailaddress) === 0) { | ||
| 1308 : | $frame_emailaddress = ''; | ||
| 1309 : | } | ||
| 1310 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1311 : | $frame_rating = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1312 : | $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset)); | ||
| 1313 : | $parsedFrame['email'] = $frame_emailaddress; | ||
| 1314 : | $parsedFrame['rating'] = $frame_rating; | ||
| 1315 : | unset($parsedFrame['data']); | ||
| 1316 : | |||
| 1317 : | |||
| 1318 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RBUF')) || // 4.18 RBUF Recommended buffer size | ||
| 1319 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'BUF'))) { // 4.19 BUF Recommended buffer size | ||
| 1320 : | // There may only be one 'RBUF' frame in each tag | ||
| 1321 : | // <Header for 'Recommended buffer size', ID: 'RBUF'> | ||
| 1322 : | // Buffer size $xx xx xx | ||
| 1323 : | // Embedded info flag %0000000x | ||
| 1324 : | // Offset to next tag $xx xx xx xx | ||
| 1325 : | |||
| 1326 : | $frame_offset = 0; | ||
| 1327 : | $parsedFrame['buffersize'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 3)); | ||
| 1328 : | $frame_offset += 3; | ||
| 1329 : | |||
| 1330 : | $frame_embeddedinfoflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1331 : | $parsedFrame['flags']['embededinfo'] = (bool) substr($frame_embeddedinfoflags, 7, 1); | ||
| 1332 : | $parsedFrame['nexttagoffset'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); | ||
| 1333 : | unset($parsedFrame['data']); | ||
| 1334 : | |||
| 1335 : | |||
| 1336 : | } elseif (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRM')) { // 4.20 Encrypted meta frame (ID3v2.2 only) | ||
| 1337 : | // There may be more than one 'CRM' frame in a tag, | ||
| 1338 : | // but only one with the same 'owner identifier' | ||
| 1339 : | // <Header for 'Encrypted meta frame', ID: 'CRM'> | ||
| 1340 : | // Owner identifier <textstring> $00 (00) | ||
| 1341 : | // Content/explanation <textstring> $00 (00) | ||
| 1342 : | // Encrypted datablock <binary data> | ||
| 1343 : | |||
| 1344 : | $frame_offset = 0; | ||
| 1345 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1346 : | $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1347 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1348 : | |||
| 1349 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1350 : | $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1351 : | if (ord($frame_description) === 0) { | ||
| 1352 : | $frame_description = ''; | ||
| 1353 : | } | ||
| 1354 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1355 : | |||
| 1356 : | $parsedFrame['ownerid'] = $frame_ownerid; | ||
| 1357 : | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1358 : | $parsedFrame['description'] = $frame_description; | ||
| 1359 : | unset($parsedFrame['data']); | ||
| 1360 : | |||
| 1361 : | |||
| 1362 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'AENC')) || // 4.19 AENC Audio encryption | ||
| 1363 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRA'))) { // 4.21 CRA Audio encryption | ||
| 1364 : | // There may be more than one 'AENC' frames in a tag, | ||
| 1365 : | // but only one with the same 'Owner identifier' | ||
| 1366 : | // <Header for 'Audio encryption', ID: 'AENC'> | ||
| 1367 : | // Owner identifier <text string> $00 | ||
| 1368 : | // Preview start $xx xx | ||
| 1369 : | // Preview length $xx xx | ||
| 1370 : | // Encryption info <binary data> | ||
| 1371 : | |||
| 1372 : | $frame_offset = 0; | ||
| 1373 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1374 : | $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1375 : | if (ord($frame_ownerid) === 0) { | ||
| 1376 : | $frame_ownerid == ''; | ||
| 1377 : | } | ||
| 1378 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1379 : | $parsedFrame['ownerid'] = $frame_ownerid; | ||
| 1380 : | $parsedFrame['previewstart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); | ||
| 1381 : | $frame_offset += 2; | ||
| 1382 : | $parsedFrame['previewlength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); | ||
| 1383 : | $frame_offset += 2; | ||
| 1384 : | $parsedFrame['encryptioninfo'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1385 : | unset($parsedFrame['data']); | ||
| 1386 : | |||
| 1387 : | |||
| 1388 : | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'LINK')) || // 4.20 LINK Linked information | ||
| 1389 : | (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'LNK'))) { // 4.22 LNK Linked information | ||
| 1390 : | // There may be more than one 'LINK' frame in a tag, | ||
| 1391 : | // but only one with the same contents | ||
| 1392 : | // <Header for 'Linked information', ID: 'LINK'> | ||
| 1393 : | // ID3v2.3+ => Frame identifier $xx xx xx xx | ||
| 1394 : | // ID3v2.2 => Frame identifier $xx xx xx | ||
| 1395 : | // URL <text string> $00 | ||
| 1396 : | // ID and additional data <text string(s)> | ||
| 1397 : | |||
| 1398 : | $frame_offset = 0; | ||
| 1399 : | if ($id3v2_majorversion == 2) { | ||
| 1400 : | $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 3); | ||
| 1401 : | $frame_offset += 3; | ||
| 1402 : | } else { | ||
| 1403 : | $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 4); | ||
| 1404 : | $frame_offset += 4; | ||
| 1405 : | } | ||
| 1406 : | |||
| 1407 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1408 : | $frame_url = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1409 : | if (ord($frame_url) === 0) { | ||
| 1410 : | $frame_url = ''; | ||
| 1411 : | } | ||
| 1412 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1413 : | $parsedFrame['url'] = $frame_url; | ||
| 1414 : | |||
| 1415 : | $parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1416 : | if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { | ||
| 1417 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['url']); | ||
| 1418 : | } | ||
| 1419 : | unset($parsedFrame['data']); | ||
| 1420 : | |||
| 1421 : | |||
| 1422 : | } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POSS')) { // 4.21 POSS Position synchronisation frame (ID3v2.3+ only) | ||
| 1423 : | // There may only be one 'POSS' frame in each tag | ||
| 1424 : | // <Head for 'Position synchronisation', ID: 'POSS'> | ||
| 1425 : | // Time stamp format $xx | ||
| 1426 : | // Position $xx (xx ...) | ||
| 1427 : | |||
| 1428 : | $frame_offset = 0; | ||
| 1429 : | $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1430 : | $parsedFrame['position'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset)); | ||
| 1431 : | unset($parsedFrame['data']); | ||
| 1432 : | |||
| 1433 : | |||
| 1434 : | } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USER')) { // 4.22 USER Terms of use (ID3v2.3+ only) | ||
| 1435 : | // There may be more than one 'Terms of use' frame in a tag, | ||
| 1436 : | // but only one with the same 'Language' | ||
| 1437 : | // <Header for 'Terms of use frame', ID: 'USER'> | ||
| 1438 : | // Text encoding $xx | ||
| 1439 : | // Language $xx xx xx | ||
| 1440 : | // The actual text <text string according to encoding> | ||
| 1441 : | |||
| 1442 : | $frame_offset = 0; | ||
| 1443 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1444 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 1445 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 1446 : | } | ||
| 1447 : | $frame_language = substr($parsedFrame['data'], $frame_offset, 3); | ||
| 1448 : | $frame_offset += 3; | ||
| 1449 : | $parsedFrame['language'] = $frame_language; | ||
| 1450 : | $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); | ||
| 1451 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 1452 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 1453 : | |||
| 1454 : | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1455 : | if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { | ||
| 1456 : | $ThisFileInfo['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $ThisFileInfo['id3v2']['encoding'], $parsedFrame['data']); | ||
| 1457 : | } | ||
| 1458 : | unset($parsedFrame['data']); | ||
| 1459 : | |||
| 1460 : | |||
| 1461 : | } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'OWNE')) { // 4.23 OWNE Ownership frame (ID3v2.3+ only) | ||
| 1462 : | // There may only be one 'OWNE' frame in a tag | ||
| 1463 : | // <Header for 'Ownership frame', ID: 'OWNE'> | ||
| 1464 : | // Text encoding $xx | ||
| 1465 : | // Price paid <text string> $00 | ||
| 1466 : | // Date of purch. <text string> | ||
| 1467 : | // Seller <text string according to encoding> | ||
| 1468 : | |||
| 1469 : | $frame_offset = 0; | ||
| 1470 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1471 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 1472 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 1473 : | } | ||
| 1474 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 1475 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 1476 : | |||
| 1477 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1478 : | $frame_pricepaid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1479 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1480 : | |||
| 1481 : | $parsedFrame['pricepaid']['currencyid'] = substr($frame_pricepaid, 0, 3); | ||
| 1482 : | $parsedFrame['pricepaid']['currency'] = $this->LookupCurrencyUnits($parsedFrame['pricepaid']['currencyid']); | ||
| 1483 : | $parsedFrame['pricepaid']['value'] = substr($frame_pricepaid, 3); | ||
| 1484 : | |||
| 1485 : | $parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8); | ||
| 1486 : | if (!$this->IsValidDateStampString($parsedFrame['purchasedate'])) { | ||
| 1487 : | $parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4)); | ||
| 1488 : | } | ||
| 1489 : | $frame_offset += 8; | ||
| 1490 : | |||
| 1491 : | $parsedFrame['seller'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1492 : | unset($parsedFrame['data']); | ||
| 1493 : | |||
| 1494 : | |||
| 1495 : | } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMR')) { // 4.24 COMR Commercial frame (ID3v2.3+ only) | ||
| 1496 : | // There may be more than one 'commercial frame' in a tag, | ||
| 1497 : | // but no two may be identical | ||
| 1498 : | // <Header for 'Commercial frame', ID: 'COMR'> | ||
| 1499 : | // Text encoding $xx | ||
| 1500 : | // Price string <text string> $00 | ||
| 1501 : | // Valid until <text string> | ||
| 1502 : | // Contact URL <text string> $00 | ||
| 1503 : | // Received as $xx | ||
| 1504 : | // Name of seller <text string according to encoding> $00 (00) | ||
| 1505 : | // Description <text string according to encoding> $00 (00) | ||
| 1506 : | // Picture MIME type <string> $00 | ||
| 1507 : | // Seller logo <binary data> | ||
| 1508 : | |||
| 1509 : | $frame_offset = 0; | ||
| 1510 : | $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1511 : | if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) { | ||
| 1512 : | $ThisFileInfo['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding'; | ||
| 1513 : | } | ||
| 1514 : | |||
| 1515 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1516 : | $frame_pricestring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1517 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1518 : | $frame_rawpricearray = explode('/', $frame_pricestring); | ||
| 1519 : | foreach ($frame_rawpricearray as $key => $val) { | ||
| 1520 : | $frame_currencyid = substr($val, 0, 3); | ||
| 1521 : | $parsedFrame['price'][$frame_currencyid]['currency'] = $this->LookupCurrencyUnits($frame_currencyid); | ||
| 1522 : | $parsedFrame['price'][$frame_currencyid]['value'] = substr($val, 3); | ||
| 1523 : | } | ||
| 1524 : | |||
| 1525 : | $frame_datestring = substr($parsedFrame['data'], $frame_offset, 8); | ||
| 1526 : | $frame_offset += 8; | ||
| 1527 : | |||
| 1528 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1529 : | $frame_contacturl = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1530 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1531 : | |||
| 1532 : | $frame_receivedasid = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1533 : | |||
| 1534 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 1535 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 1536 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 1537 : | } | ||
| 1538 : | $frame_sellername = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1539 : | if (ord($frame_sellername) === 0) { | ||
| 1540 : | $frame_sellername = ''; | ||
| 1541 : | } | ||
| 1542 : | $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)); | ||
| 1543 : | |||
| 1544 : | $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset); | ||
| 1545 : | if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) { | ||
| 1546 : | $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 | ||
| 1547 : | } | ||
| 1548 : | $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1549 : | if (ord($frame_description) === 0) { | ||
| 1550 : | $frame_description = ''; | ||
| 1551 : | } | ||
| 1552 : | $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)); | ||
| 1553 : | |||
| 1554 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1555 : | $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1556 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1557 : | |||
| 1558 : | $frame_sellerlogo = substr($parsedFrame['data'], $frame_offset); | ||
| 1559 : | |||
| 1560 : | $parsedFrame['encodingid'] = $frame_textencoding; | ||
| 1561 : | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); | ||
| 1562 : | |||
| 1563 : | $parsedFrame['pricevaliduntil'] = $frame_datestring; | ||
| 1564 : | $parsedFrame['contacturl'] = $frame_contacturl; | ||
| 1565 : | $parsedFrame['receivedasid'] = $frame_receivedasid; | ||
| 1566 : | $parsedFrame['receivedas'] = $this->COMRReceivedAsLookup($frame_receivedasid); | ||
| 1567 : | $parsedFrame['sellername'] = $frame_sellername; | ||
| 1568 : | $parsedFrame['description'] = $frame_description; | ||
| 1569 : | $parsedFrame['mime'] = $frame_mimetype; | ||
| 1570 : | $parsedFrame['logo'] = $frame_sellerlogo; | ||
| 1571 : | unset($parsedFrame['data']); | ||
| 1572 : | |||
| 1573 : | |||
| 1574 : | } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ENCR')) { // 4.25 ENCR Encryption method registration (ID3v2.3+ only) | ||
| 1575 : | // There may be several 'ENCR' frames in a tag, | ||
| 1576 : | // but only one containing the same symbol | ||
| 1577 : | // and only one containing the same owner identifier | ||
| 1578 : | // <Header for 'Encryption method registration', ID: 'ENCR'> | ||
| 1579 : | // Owner identifier <text string> $00 | ||
| 1580 : | // Method symbol $xx | ||
| 1581 : | // Encryption data <binary data> | ||
| 1582 : | |||
| 1583 : | $frame_offset = 0; | ||
| 1584 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1585 : | $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1586 : | if (ord($frame_ownerid) === 0) { | ||
| 1587 : | $frame_ownerid = ''; | ||
| 1588 : | } | ||
| 1589 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1590 : | |||
| 1591 : | $parsedFrame['ownerid'] = $frame_ownerid; | ||
| 1592 : | $parsedFrame['methodsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1593 : | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1594 : | |||
| 1595 : | |||
| 1596 : | } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GRID')) { // 4.26 GRID Group identification registration (ID3v2.3+ only) | ||
| 1597 : | |||
| 1598 : | // There may be several 'GRID' frames in a tag, | ||
| 1599 : | // but only one containing the same symbol | ||
| 1600 : | // and only one containing the same owner identifier | ||
| 1601 : | // <Header for 'Group ID registration', ID: 'GRID'> | ||
| 1602 : | // Owner identifier <text string> $00 | ||
| 1603 : | // Group symbol $xx | ||
| 1604 : | // Group dependent data <binary data> | ||
| 1605 : | |||
| 1606 : | $frame_offset = 0; | ||
| 1607 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1608 : | $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1609 : | if (ord($frame_ownerid) === 0) { | ||
| 1610 : | $frame_ownerid = ''; | ||
| 1611 : | } | ||
| 1612 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1613 : | |||
| 1614 : | $parsedFrame['ownerid'] = $frame_ownerid; | ||
| 1615 : | $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1616 : | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1617 : | |||
| 1618 : | |||
| 1619 : | } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PRIV')) { // 4.27 PRIV Private frame (ID3v2.3+ only) | ||
| 1620 : | // The tag may contain more than one 'PRIV' frame | ||
| 1621 : | // but only with different contents | ||
| 1622 : | // <Header for 'Private frame', ID: 'PRIV'> | ||
| 1623 : | // Owner identifier <text string> $00 | ||
| 1624 : | // The private data <binary data> | ||
| 1625 : | |||
| 1626 : | $frame_offset = 0; | ||
| 1627 : | $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); | ||
| 1628 : | $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); | ||
| 1629 : | if (ord($frame_ownerid) === 0) { | ||
| 1630 : | $frame_ownerid = ''; | ||
| 1631 : | } | ||
| 1632 : | $frame_offset = $frame_terminatorpos + strlen("\x00"); | ||
| 1633 : | |||
| 1634 : | $parsedFrame['ownerid'] = $frame_ownerid; | ||
| 1635 : | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1636 : | |||
| 1637 : | |||
| 1638 : | } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SIGN')) { // 4.28 SIGN Signature frame (ID3v2.4+ only) | ||
| 1639 : | // There may be more than one 'signature frame' in a tag, | ||
| 1640 : | // but no two may be identical | ||
| 1641 : | // <Header for 'Signature frame', ID: 'SIGN'> | ||
| 1642 : | // Group symbol $xx | ||
| 1643 : | // Signature <binary data> | ||
| 1644 : | |||
| 1645 : | $frame_offset = 0; | ||
| 1646 : | $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1647 : | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); | ||
| 1648 : | |||
| 1649 : | |||
| 1650 : | } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SEEK')) { // 4.29 SEEK Seek frame (ID3v2.4+ only) | ||
| 1651 : | // There may only be one 'seek frame' in a tag | ||
| 1652 : | // <Header for 'Seek frame', ID: 'SEEK'> | ||
| 1653 : | // Minimum offset to next tag $xx xx xx xx | ||
| 1654 : | |||
| 1655 : | $frame_offset = 0; | ||
| 1656 : | $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); | ||
| 1657 : | |||
| 1658 : | |||
| 1659 : | } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { // 4.30 ASPI Audio seek point index (ID3v2.4+ only) | ||
| 1660 : | // There may only be one 'audio seek point index' frame in a tag | ||
| 1661 : | // <Header for 'Seek Point Index', ID: 'ASPI'> | ||
| 1662 : | // Indexed data start (S) $xx xx xx xx | ||
| 1663 : | // Indexed data length (L) $xx xx xx xx | ||
| 1664 : | // Number of index points (N) $xx xx | ||
| 1665 : | // Bits per index point (b) $xx | ||
| 1666 : | // Then for every index point the following data is included: | ||
| 1667 : | // Fraction at index (Fi) $xx (xx) | ||
| 1668 : | |||
| 1669 : | $frame_offset = 0; | ||
| 1670 : | $parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); | ||
| 1671 : | $frame_offset += 4; | ||
| 1672 : | $parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); | ||
| 1673 : | $frame_offset += 4; | ||
| 1674 : | $parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2)); | ||
| 1675 : | $frame_offset += 2; | ||
| 1676 : | $parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1)); | ||
| 1677 : | $frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8); | ||
| 1678 : | for ($i = 0; $i < $frame_indexpoints; $i++) { | ||
| 1679 : | $parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint)); | ||
| 1680 : | $frame_offset += $frame_bytesperpoint; | ||
| 1681 : | } | ||
| 1682 : | unset($parsedFrame['data']); | ||
| 1683 : | |||
| 1684 : | } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RGAD')) { // Replay Gain Adjustment | ||
| 1685 : | // http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html | ||
| 1686 : | // There may only be one 'RGAD' frame in a tag | ||
| 1687 : | // <Header for 'Replay Gain Adjustment', ID: 'RGAD'> | ||
| 1688 : | // Peak Amplitude $xx $xx $xx $xx | ||
| 1689 : | // Radio Replay Gain Adjustment %aaabbbcd %dddddddd | ||
| 1690 : | // Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd | ||
| 1691 : | // a - name code | ||
| 1692 : | // b - originator code | ||
| 1693 : | // c - sign bit | ||
| 1694 : | // d - replay gain adjustment | ||
| 1695 : | |||
| 1696 : | $frame_offset = 0; | ||
| 1697 : | $parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4)); | ||
| 1698 : | $frame_offset += 4; | ||
| 1699 : | $rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2)); | ||
| 1700 : | $frame_offset += 2; | ||
| 1701 : | $rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2)); | ||
| 1702 : | $frame_offset += 2; | ||
| 1703 : | $parsedFrame['raw']['track']['name'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3)); | ||
| 1704 : | $parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3)); | ||
| 1705 : | $parsedFrame['raw']['track']['signbit'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1)); | ||
| 1706 : | $parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9)); | ||
| 1707 : | $parsedFrame['raw']['album']['name'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3)); | ||
| 1708 : | $parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3)); | ||
| 1709 : | $parsedFrame['raw']['album']['signbit'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1)); | ||
| 1710 : | $parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9)); | ||
| 1711 : | $parsedFrame['track']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']); | ||
| 1712 : | $parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']); | ||
| 1713 : | $parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']); | ||
| 1714 : | $parsedFrame['album']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']); | ||
| 1715 : | $parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']); | ||
| 1716 : | $parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']); | ||
| 1717 : | |||
| 1718 : | $ThisFileInfo['replay_gain']['track']['peak'] = $parsedFrame['peakamplitude']; | ||
| 1719 : | $ThisFileInfo['replay_gain']['track']['originator'] = $parsedFrame['track']['originator']; | ||
| 1720 : | $ThisFileInfo['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment']; | ||
| 1721 : | $ThisFileInfo['replay_gain']['album']['originator'] = $parsedFrame['album']['originator']; | ||
| 1722 : | $ThisFileInfo['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment']; | ||
| 1723 : | |||
| 1724 : | unset($parsedFrame['data']); | ||
| 1725 : | |||
| 1726 : | } | ||
| 1727 : | |||
| 1728 : | return true; | ||
| 1729 : | } | ||
| 1730 : | |||
| 1731 : | |||
| 1732 : | function DeUnsynchronise($data) { | ||
| 1733 : | return str_replace("\xFF\x00", "\xFF", $data); | ||
| 1734 : | } | ||
| 1735 : | |||
| 1736 : | function LookupCurrencyUnits($currencyid) { | ||
| 1737 : | |||
| 1738 : | $begin = __LINE__; | ||
| 1739 : | |||
| 1740 : | /** This is not a comment! | ||
| 1741 : | |||
| 1742 : | |||
| 1743 : | AED Dirhams | ||
| 1744 : | AFA Afghanis | ||
| 1745 : | ALL Leke | ||
| 1746 : | AMD Drams | ||
| 1747 : | ANG Guilders | ||
| 1748 : | AOA Kwanza | ||
| 1749 : | ARS Pesos | ||
| 1750 : | ATS Schillings | ||
| 1751 : | AUD Dollars | ||
| 1752 : | AWG Guilders | ||
| 1753 : | AZM Manats | ||
| 1754 : | BAM Convertible Marka | ||
| 1755 : | BBD Dollars | ||
| 1756 : | BDT Taka | ||
| 1757 : | BEF Francs | ||
| 1758 : | BGL Leva | ||
| 1759 : | BHD Dinars | ||
| 1760 : | BIF Francs | ||
| 1761 : | BMD Dollars | ||
| 1762 : | BND Dollars | ||
| 1763 : | BOB Bolivianos | ||
| 1764 : | BRL Brazil Real | ||
| 1765 : | BSD Dollars | ||
| 1766 : | BTN Ngultrum | ||
| 1767 : | BWP Pulas | ||
| 1768 : | BYR Rubles | ||
| 1769 : | BZD Dollars | ||
| 1770 : | CAD Dollars | ||
| 1771 : | CDF Congolese Francs | ||
| 1772 : | CHF Francs | ||
| 1773 : | CLP Pesos | ||
| 1774 : | CNY Yuan Renminbi | ||
| 1775 : | COP Pesos | ||
| 1776 : | CRC Colones | ||
| 1777 : | CUP Pesos | ||
| 1778 : | CVE Escudos | ||
| 1779 : | CYP Pounds | ||
| 1780 : | CZK Koruny | ||
| 1781 : | DEM Deutsche Marks | ||
| 1782 : | DJF Francs | ||
| 1783 : | DKK Kroner | ||
| 1784 : | DOP Pesos | ||
| 1785 : | DZD Algeria Dinars | ||
| 1786 : | EEK Krooni | ||
| 1787 : | EGP Pounds | ||
| 1788 : | ERN Nakfa | ||
| 1789 : | ESP Pesetas | ||
| 1790 : | ETB Birr | ||
| 1791 : | EUR Euro | ||
| 1792 : | FIM Markkaa | ||
| 1793 : | FJD Dollars | ||
| 1794 : | FKP Pounds | ||
| 1795 : | FRF Francs | ||
| 1796 : | GBP Pounds | ||
| 1797 : | GEL Lari | ||
| 1798 : | GGP Pounds | ||
| 1799 : | GHC Cedis | ||
| 1800 : | GIP Pounds | ||
| 1801 : | GMD Dalasi | ||
| 1802 : | GNF Francs | ||
| 1803 : | GRD Drachmae | ||
| 1804 : | GTQ Quetzales | ||
| 1805 : | GYD Dollars | ||
| 1806 : | HKD Dollars | ||
| 1807 : | HNL Lempiras | ||
| 1808 : | HRK Kuna | ||
| 1809 : | HTG Gourdes | ||
| 1810 : | HUF Forints | ||
| 1811 : | IDR Rupiahs | ||
| 1812 : | IEP Pounds | ||
| 1813 : | ILS New Shekels | ||
| 1814 : | IMP Pounds | ||
| 1815 : | INR Rupees | ||
| 1816 : | IQD Dinars | ||
| 1817 : | IRR Rials | ||
| 1818 : | ISK Kronur | ||
| 1819 : | ITL Lire | ||
| 1820 : | JEP Pounds | ||
| 1821 : | JMD Dollars | ||
| 1822 : | JOD Dinars | ||
| 1823 : | JPY Yen | ||
| 1824 : | KES Shillings | ||
| 1825 : | KGS Soms | ||
| 1826 : | KHR Riels | ||
| 1827 : | KMF Francs | ||
| 1828 : | KPW Won | ||
| 1829 : | KWD Dinars | ||
| 1830 : | KYD Dollars | ||
| 1831 : | KZT Tenge | ||
| 1832 : | LAK Kips | ||
| 1833 : | LBP Pounds | ||
| 1834 : | LKR Rupees | ||
| 1835 : | LRD Dollars | ||
| 1836 : | LSL Maloti | ||
| 1837 : | LTL Litai | ||
| 1838 : | LUF Francs | ||
| 1839 : | LVL Lati | ||
| 1840 : | LYD Dinars | ||
| 1841 : | MAD Dirhams | ||
| 1842 : | MDL Lei | ||
| 1843 : | MGF Malagasy Francs | ||
| 1844 : | MKD Denars | ||
| 1845 : | MMK Kyats | ||
| 1846 : | MNT Tugriks | ||
| 1847 : | MOP Patacas | ||
| 1848 : | MRO Ouguiyas | ||
| 1849 : | MTL Liri | ||
| 1850 : | MUR Rupees | ||
| 1851 : | MVR Rufiyaa | ||
| 1852 : | MWK Kwachas | ||
| 1853 : | MXN Pesos | ||
| 1854 : | MYR Ringgits | ||
| 1855 : | MZM Meticais | ||
| 1856 : | NAD Dollars | ||
| 1857 : | NGN Nairas | ||
| 1858 : | NIO Gold Cordobas | ||
| 1859 : | NLG Guilders | ||
| 1860 : | NOK Krone | ||
| 1861 : | NPR Nepal Rupees | ||
| 1862 : | NZD Dollars | ||
| 1863 : | OMR Rials | ||
| 1864 : | PAB Balboa | ||
| 1865 : | PEN Nuevos Soles | ||
| 1866 : | PGK Kina | ||
| 1867 : | PHP Pesos | ||
| 1868 : | PKR Rupees | ||
| 1869 : | PLN Zlotych | ||
| 1870 : | PTE Escudos | ||
| 1871 : | PYG Guarani | ||
| 1872 : | QAR Rials | ||
| 1873 : | ROL Lei | ||
| 1874 : | RUR Rubles | ||
| 1875 : | RWF Rwanda Francs | ||
| 1876 : | SAR Riyals | ||
| 1877 : | SBD Dollars | ||
| 1878 : | SCR Rupees | ||
| 1879 : | SDD Dinars | ||
| 1880 : | SEK Kronor | ||
| 1881 : | SGD Dollars | ||
| 1882 : | SHP Pounds | ||
| 1883 : | SIT Tolars | ||
| 1884 : | SKK Koruny | ||
| 1885 : | SLL Leones | ||
| 1886 : | SOS Shillings | ||
| 1887 : | SPL Luigini | ||
| 1888 : | SRG Guilders | ||
| 1889 : | STD Dobras | ||
| 1890 : | SVC Colones | ||
| 1891 : | SYP Pounds | ||
| 1892 : | SZL Emalangeni | ||
| 1893 : | THB Baht | ||
| 1894 : | TJR Rubles | ||
| 1895 : | TMM Manats | ||
| 1896 : | TND Dinars | ||
| 1897 : | TOP Pa'anga | ||
| 1898 : | TRL Liras | ||
| 1899 : | TTD Dollars | ||
| 1900 : | TVD Tuvalu Dollars | ||
| 1901 : | TWD New Dollars | ||
| 1902 : | TZS Shillings | ||
| 1903 : | UAH Hryvnia | ||
| 1904 : | UGX Shillings | ||
| 1905 : | USD Dollars | ||
| 1906 : | UYU Pesos | ||
| 1907 : | UZS Sums | ||
| 1908 : | VAL Lire | ||
| 1909 : | VEB Bolivares | ||
| 1910 : | VND Dong | ||
| 1911 : | VUV Vatu | ||
| 1912 : | WST Tala | ||
| 1913 : | XAF Francs | ||
| 1914 : | XAG Ounces | ||
| 1915 : | XAU Ounces | ||
| 1916 : | XCD Dollars | ||
| 1917 : | XDR Special Drawing Rights | ||
| 1918 : | XPD Ounces | ||
| 1919 : | XPF Francs | ||
| 1920 : | XPT Ounces | ||
| 1921 : | YER Rials | ||
| 1922 : | YUM New Dinars | ||
| 1923 : | ZAR Rand | ||
| 1924 : | ZMK Kwacha | ||
| 1925 : | ZWD Zimbabwe Dollars | ||
| 1926 : | |||
| 1927 : | */ | ||
| 1928 : | |||
| 1929 : | return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units'); | ||
| 1930 : | } | ||
| 1931 : | |||
| 1932 : | |||
| 1933 : | function LookupCurrencyCountry($currencyid) { | ||
| 1934 : | |||
| 1935 : | $begin = __LINE__; | ||
| 1936 : | |||
| 1937 : | /** This is not a comment! | ||
| 1938 : | |||
| 1939 : | AED United Arab Emirates | ||
| 1940 : | AFA Afghanistan | ||
| 1941 : | ALL Albania | ||
| 1942 : | AMD Armenia | ||
| 1943 : | ANG Netherlands Antilles | ||
| 1944 : | AOA Angola | ||
| 1945 : | ARS Argentina | ||
| 1946 : | ATS Austria | ||
| 1947 : | AUD Australia | ||
| 1948 : | AWG Aruba | ||
| 1949 : | AZM Azerbaijan | ||
| 1950 : | BAM Bosnia and Herzegovina | ||
| 1951 : | BBD Barbados | ||
| 1952 : | BDT Bangladesh | ||
| 1953 : | BEF Belgium | ||
| 1954 : | BGL Bulgaria | ||
| 1955 : | BHD Bahrain | ||
| 1956 : | BIF Burundi | ||
| 1957 : | BMD Bermuda | ||
| 1958 : | BND Brunei Darussalam | ||
| 1959 : | BOB Bolivia | ||
| 1960 : | BRL Brazil | ||
| 1961 : | BSD Bahamas | ||
| 1962 : | BTN Bhutan | ||
| 1963 : | BWP Botswana | ||
| 1964 : | BYR Belarus | ||
| 1965 : | BZD Belize | ||
| 1966 : | CAD Canada | ||
| 1967 : | CDF Congo/Kinshasa | ||
| 1968 : | CHF Switzerland | ||
| 1969 : | CLP Chile | ||
| 1970 : | CNY China | ||
| 1971 : | COP Colombia | ||
| 1972 : | CRC Costa Rica | ||
| 1973 : | CUP Cuba | ||
| 1974 : | CVE Cape Verde | ||
| 1975 : | CYP Cyprus | ||
| 1976 : | CZK Czech Republic | ||
| 1977 : | DEM Germany | ||
| 1978 : | DJF Djibouti | ||
| 1979 : | DKK Denmark | ||
| 1980 : | DOP Dominican Republic | ||
| 1981 : | DZD Algeria | ||
| 1982 : | EEK Estonia | ||
| 1983 : | EGP Egypt | ||
| 1984 : | ERN Eritrea | ||
| 1985 : | ESP Spain | ||
| 1986 : | ETB Ethiopia | ||
| 1987 : | EUR Euro Member Countries | ||
| 1988 : | FIM Finland | ||
| 1989 : | FJD Fiji | ||
| 1990 : | FKP Falkland Islands (Malvinas) | ||
| 1991 : | FRF France | ||
| 1992 : | GBP United Kingdom | ||
| 1993 : | GEL Georgia | ||
| 1994 : | GGP Guernsey | ||
| 1995 : | GHC Ghana | ||
| 1996 : | GIP Gibraltar | ||
| 1997 : | GMD Gambia | ||
| 1998 : | GNF Guinea | ||
| 1999 : | GRD Greece | ||
| 2000 : | GTQ Guatemala | ||
| 2001 : | GYD Guyana | ||
| 2002 : | HKD Hong Kong | ||
| 2003 : | HNL Honduras | ||
| 2004 : | HRK Croatia | ||
| 2005 : | HTG Haiti | ||
| 2006 : | HUF Hungary | ||
| 2007 : | IDR Indonesia | ||
| 2008 : | IEP Ireland (Eire) | ||
| 2009 : | ILS Israel | ||
| 2010 : | IMP Isle of Man | ||
| 2011 : | INR India | ||
| 2012 : | IQD Iraq | ||
| 2013 : | IRR Iran | ||
| 2014 : | ISK Iceland | ||
| 2015 : | ITL Italy | ||
| 2016 : | JEP Jersey | ||
| 2017 : | JMD Jamaica | ||
| 2018 : | JOD Jordan | ||
| 2019 : | JPY Japan | ||
| 2020 : | KES Kenya | ||
| 2021 : | KGS Kyrgyzstan | ||
| 2022 : | KHR Cambodia | ||
| 2023 : | KMF Comoros | ||
| 2024 : | KPW Korea | ||
| 2025 : | KWD Kuwait | ||
| 2026 : | KYD Cayman Islands | ||
| 2027 : | KZT Kazakstan | ||
| 2028 : | LAK Laos | ||
| 2029 : | LBP Lebanon | ||
| 2030 : | LKR Sri Lanka | ||
| 2031 : | LRD Liberia | ||
| 2032 : | LSL Lesotho | ||
| 2033 : | LTL Lithuania | ||
| 2034 : | LUF Luxembourg | ||
| 2035 : | LVL Latvia | ||
| 2036 : | LYD Libya | ||
| 2037 : | MAD Morocco | ||
| 2038 : | MDL Moldova | ||
| 2039 : | MGF Madagascar | ||
| 2040 : | MKD Macedonia | ||
| 2041 : | MMK Myanmar (Burma) | ||
| 2042 : | MNT Mongolia | ||
| 2043 : | MOP Macau | ||
| 2044 : | MRO Mauritania | ||
| 2045 : | MTL Malta | ||
| 2046 : | MUR Mauritius | ||
| 2047 : | MVR Maldives (Maldive Islands) | ||
| 2048 : | MWK Malawi | ||
| 2049 : | MXN Mexico | ||
| 2050 : | MYR Malaysia | ||
| 2051 : | MZM Mozambique | ||
| 2052 : | NAD Namibia | ||
| 2053 : | NGN Nigeria | ||
| 2054 : | NIO Nicaragua | ||
| 2055 : | NLG Netherlands (Holland) | ||
| 2056 : | NOK Norway | ||
| 2057 : | NPR Nepal | ||
| 2058 : | NZD New Zealand | ||
| 2059 : | OMR Oman | ||
| 2060 : | PAB Panama | ||
| 2061 : | PEN Peru | ||
| 2062 : | PGK Papua New Guinea | ||
| 2063 : | PHP Philippines | ||
| 2064 : | PKR Pakistan | ||
| 2065 : | PLN Poland | ||
| 2066 : | PTE Portugal | ||
| 2067 : | PYG Paraguay | ||
| 2068 : | QAR Qatar | ||
| 2069 : | ROL Romania | ||
| 2070 : | RUR Russia | ||
| 2071 : | RWF Rwanda | ||
| 2072 : | SAR Saudi Arabia | ||
| 2073 : | SBD Solomon Islands | ||
| 2074 : | SCR Seychelles | ||
| 2075 : | SDD Sudan | ||
| 2076 : | SEK Sweden | ||
| 2077 : | SGD Singapore | ||
| 2078 : | SHP Saint Helena | ||
| 2079 : | SIT Slovenia | ||
| 2080 : | SKK Slovakia | ||
| 2081 : | SLL Sierra Leone | ||
| 2082 : | SOS Somalia | ||
| 2083 : | SPL Seborga | ||
| 2084 : | SRG Suriname | ||
| 2085 : | STD S�o Tome and Principe | ||
| 2086 : | SVC El Salvador | ||
| 2087 : | SYP Syria | ||
| 2088 : | SZL Swaziland | ||
| 2089 : | THB Thailand | ||
| 2090 : | TJR Tajikistan | ||
| 2091 : | TMM Turkmenistan | ||
| 2092 : | TND Tunisia | ||
| 2093 : | TOP Tonga | ||
| 2094 : | TRL Turkey | ||
| 2095 : | TTD Trinidad and Tobago | ||
| 2096 : | TVD Tuvalu | ||
| 2097 : | TWD Taiwan | ||
| 2098 : | TZS Tanzania | ||
| 2099 : | UAH Ukraine | ||
| 2100 : | UGX Uganda | ||
| 2101 : | USD United States of America | ||
| 2102 : | UYU Uruguay | ||
| 2103 : | UZS Uzbekistan | ||
| 2104 : | VAL Vatican City | ||
| 2105 : | VEB Venezuela | ||
| 2106 : | VND Viet Nam | ||
| 2107 : | VUV Vanuatu | ||
| 2108 : | WST Samoa | ||
| 2109 : | XAF Communaut� Financi�re Africaine | ||
| 2110 : | XAG Silver | ||
| 2111 : | XAU Gold | ||
| 2112 : | XCD East Caribbean | ||
| 2113 : | XDR International Monetary Fund | ||
| 2114 : | XPD Palladium | ||
| 2115 : | XPF Comptoirs Fran�ais du Pacifique | ||
| 2116 : | XPT Platinum | ||
| 2117 : | YER Yemen | ||
| 2118 : | YUM Yugoslavia | ||
| 2119 : | ZAR South Africa | ||
| 2120 : | ZMK Zambia | ||
| 2121 : | ZWD Zimbabwe | ||
| 2122 : | |||
| 2123 : | */ | ||
| 2124 : | |||
| 2125 : | return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country'); | ||
| 2126 : | } | ||
| 2127 : | |||
| 2128 : | |||
| 2129 : | |||
| 2130 : | function LanguageLookup($languagecode, $casesensitive=false) { | ||
| 2131 : | |||
| 2132 : | if (!$casesensitive) { | ||
| 2133 : | $languagecode = strtolower($languagecode); | ||
| 2134 : | } | ||
| 2135 : | |||
| 2136 : | // http://www.id3.org/id3v2.4.0-structure.txt | ||
| 2137 : | // [4. ID3v2 frame overview] | ||
| 2138 : | // The three byte language field, present in several frames, is used to | ||
| 2139 : | // describe the language of the frame's content, according to ISO-639-2 | ||
| 2140 : | // [ISO-639-2]. The language should be represented in lower case. If the | ||
| 2141 : | // language is not known the string "XXX" should be used. | ||
| 2142 : | |||
| 2143 : | |||
| 2144 : | // ISO 639-2 - http://www.id3.org/iso639-2.html | ||
| 2145 : | |||
| 2146 : | $begin = __LINE__; | ||
| 2147 : | |||
| 2148 : | /** This is not a comment! | ||
| 2149 : | |||
| 2150 : | XXX unknown | ||
| 2151 : | xxx unknown | ||
| 2152 : | aar Afar | ||
| 2153 : | abk Abkhazian | ||
| 2154 : | ace Achinese | ||
| 2155 : | ach Acoli | ||
| 2156 : | ada Adangme | ||
| 2157 : | afa Afro-Asiatic (Other) | ||
| 2158 : | afh Afrihili | ||
| 2159 : | afr Afrikaans | ||
| 2160 : | aka Akan | ||
| 2161 : | akk Akkadian | ||
| 2162 : | alb Albanian | ||
| 2163 : | ale Aleut | ||
| 2164 : | alg Algonquian Languages | ||
| 2165 : | amh Amharic | ||
| 2166 : | ang English, Old (ca. 450-1100) | ||
| 2167 : | apa Apache Languages | ||
| 2168 : | ara Arabic | ||
| 2169 : | arc Aramaic | ||
| 2170 : | arm Armenian | ||
| 2171 : | arn Araucanian | ||
| 2172 : | arp Arapaho | ||
| 2173 : | art Artificial (Other) | ||
| 2174 : | arw Arawak | ||
| 2175 : | asm Assamese | ||
| 2176 : | ath Athapascan Languages | ||
| 2177 : | ava Avaric | ||
| 2178 : | ave Avestan | ||
| 2179 : | awa Awadhi | ||
| 2180 : | aym Aymara | ||
| 2181 : | aze Azerbaijani | ||
| 2182 : | bad Banda | ||
| 2183 : | bai Bamileke Languages | ||
| 2184 : | bak Bashkir | ||
| 2185 : | bal Baluchi | ||
| 2186 : | bam Bambara | ||
| 2187 : | ban Balinese | ||
| 2188 : | baq Basque | ||
| 2189 : | bas Basa | ||
| 2190 : | bat Baltic (Other) | ||
| 2191 : | bej Beja | ||
| 2192 : | bel Byelorussian | ||
| 2193 : | bem Bemba | ||
| 2194 : | ben Bengali | ||
| 2195 : | ber Berber (Other) | ||
| 2196 : | bho Bhojpuri | ||
| 2197 : | bih Bihari | ||
| 2198 : | bik Bikol | ||
| 2199 : | bin Bini | ||
| 2200 : | bis Bislama | ||
| 2201 : | bla Siksika | ||
| 2202 : | bnt Bantu (Other) | ||
| 2203 : | bod Tibetan | ||
| 2204 : | bra Braj | ||
| 2205 : | bre Breton | ||
| 2206 : | bua Buriat | ||
| 2207 : | bug Buginese | ||
| 2208 : | bul Bulgarian | ||
| 2209 : | bur Burmese | ||
| 2210 : | cad Caddo | ||
| 2211 : | cai Central American Indian (Other) | ||
| 2212 : | car Carib | ||
| 2213 : | cat Catalan | ||
| 2214 : | cau Caucasian (Other) | ||
| 2215 : | ceb Cebuano | ||
| 2216 : | cel Celtic (Other) | ||
| 2217 : | ces Czech | ||
| 2218 : | cha Chamorro | ||
| 2219 : | chb Chibcha | ||
| 2220 : | che Chechen | ||
| 2221 : | chg Chagatai | ||
| 2222 : | chi Chinese | ||
| 2223 : | chm Mari | ||
| 2224 : | chn Chinook jargon | ||
| 2225 : | cho Choctaw | ||
| 2226 : | chr Cherokee | ||
| 2227 : | chu Church Slavic | ||
| 2228 : | chv Chuvash | ||
| 2229 : | chy Cheyenne | ||
| 2230 : | cop Coptic | ||
| 2231 : | cor Cornish | ||
| 2232 : | cos Corsican | ||
| 2233 : | cpe Creoles and Pidgins, English-based (Other) | ||
| 2234 : | cpf Creoles and Pidgins, French-based (Other) | ||
| 2235 : | cpp Creoles and Pidgins, Portuguese-based (Other) | ||
| 2236 : | cre Cree | ||
| 2237 : | crp Creoles and Pidgins (Other) | ||
| 2238 : | cus Cushitic (Other) | ||
| 2239 : | cym Welsh | ||
| 2240 : | cze Czech | ||
| 2241 : | dak Dakota | ||
| 2242 : | dan Danish | ||
| 2243 : | del Delaware | ||
| 2244 : | deu German | ||
| 2245 : | din Dinka | ||
| 2246 : | div Divehi | ||
| 2247 : | doi Dogri | ||
| 2248 : | dra Dravidian (Other) | ||
| 2249 : | dua Duala | ||
| 2250 : | dum Dutch, Middle (ca. 1050-1350) | ||
| 2251 : | dut Dutch | ||
| 2252 : | dyu Dyula | ||
| 2253 : | dzo Dzongkha | ||
| 2254 : | efi Efik | ||
| 2255 : | egy Egyptian (Ancient) | ||
| 2256 : | eka Ekajuk | ||
| 2257 : | ell Greek, Modern (1453-) | ||
| 2258 : | elx Elamite | ||
| 2259 : | eng English | ||
| 2260 : | enm English, Middle (ca. 1100-1500) | ||
| 2261 : | epo Esperanto | ||
| 2262 : | esk Eskimo (Other) | ||
| 2263 : | esl Spanish | ||
| 2264 : | est Estonian | ||
| 2265 : | eus Basque | ||
| 2266 : | ewe Ewe | ||
| 2267 : | ewo Ewondo | ||
| 2268 : | fan Fang | ||
| 2269 : | fao Faroese | ||
| 2270 : | fas Persian | ||
| 2271 : | fat Fanti | ||
| 2272 : | fij Fijian | ||
| 2273 : | fin Finnish | ||
| 2274 : | fiu Finno-Ugrian (Other) | ||
| 2275 : | fon Fon | ||
| 2276 : | fra French | ||
| 2277 : | fre French | ||
| 2278 : | frm French, Middle (ca. 1400-1600) | ||
| 2279 : | fro French, Old (842- ca. 1400) | ||
| 2280 : | fry Frisian | ||
| 2281 : | ful Fulah | ||
| 2282 : | gaa Ga | ||
| 2283 : | gae Gaelic (Scots) | ||
| 2284 : | gai Irish | ||
| 2285 : | gay Gayo | ||
| 2286 : | gdh Gaelic (Scots) | ||
| 2287 : | gem Germanic (Other) | ||
| 2288 : | geo Georgian | ||
| 2289 : | ger German | ||
| 2290 : | gez Geez | ||
| 2291 : | gil Gilbertese | ||
| 2292 : | glg Gallegan | ||
| 2293 : | gmh German, Middle High (ca. 1050-1500) | ||
| 2294 : | goh German, Old High (ca. 750-1050) | ||
| 2295 : | gon Gondi | ||
| 2296 : | got Gothic | ||
| 2297 : | grb Grebo | ||
| 2298 : | grc Greek, Ancient (to 1453) | ||
| 2299 : | gre Greek, Modern (1453-) | ||
| 2300 : | grn Guarani | ||
| 2301 : | guj Gujarati | ||
| 2302 : | hai Haida | ||
| 2303 : | hau Hausa | ||
| 2304 : | haw Hawaiian | ||
| 2305 : | heb Hebrew | ||
| 2306 : | her Herero | ||
| 2307 : | hil Hiligaynon | ||
| 2308 : | him Himachali | ||
| 2309 : | hin Hindi | ||
| 2310 : | hmo Hiri Motu | ||
| 2311 : | hun Hungarian | ||
| 2312 : | hup Hupa | ||
| 2313 : | hye Armenian | ||
| 2314 : | iba Iban | ||
| 2315 : | ibo Igbo | ||
| 2316 : | ice Icelandic | ||
| 2317 : | ijo Ijo | ||
| 2318 : | iku Inuktitut | ||
| 2319 : | ilo Iloko | ||
| 2320 : | ina Interlingua (International Auxiliary language Association) | ||
| 2321 : | inc Indic (Other) | ||
| 2322 : | ind Indonesian | ||
| 2323 : | ine Indo-European (Other) | ||
| 2324 : | ine Interlingue | ||
| 2325 : | ipk Inupiak | ||
| 2326 : | ira Iranian (Other) | ||
| 2327 : | iri Irish | ||
| 2328 : | iro Iroquoian uages | ||
| 2329 : | isl Icelandic | ||
| 2330 : | ita Italian | ||
| 2331 : | jav Javanese | ||
| 2332 : | jaw Javanese | ||
| 2333 : | jpn Japanese | ||
| 2334 : | jpr Judeo-Persian | ||
| 2335 : | jrb Judeo-Arabic | ||
| 2336 : | kaa Kara-Kalpak | ||
| 2337 : | kab Kabyle | ||
| 2338 : | kac Kachin | ||
| 2339 : | kal Greenlandic | ||
| 2340 : | kam Kamba | ||
| 2341 : | kan Kannada | ||
| 2342 : | kar Karen | ||
| 2343 : | kas Kashmiri | ||
| 2344 : | kat Georgian | ||
| 2345 : | kau Kanuri | ||
| 2346 : | kaw Kawi | ||
| 2347 : | kaz Kazakh | ||
| 2348 : | kha Khasi | ||
| 2349 : | khi Khoisan (Other) | ||
| 2350 : | khm Khmer | ||
| 2351 : | kho Khotanese | ||
| 2352 : | kik Kikuyu | ||
| 2353 : | kin Kinyarwanda | ||
| 2354 : | kir Kirghiz | ||
| 2355 : | kok Konkani | ||
| 2356 : | kom Komi | ||
| 2357 : | kon Kongo | ||
| 2358 : | kor Korean | ||
| 2359 : | kpe Kpelle | ||
| 2360 : | kro Kru | ||
| 2361 : | kru Kurukh | ||
| 2362 : | kua Kuanyama | ||
| 2363 : | kum Kumyk | ||
| 2364 : | kur Kurdish | ||
| 2365 : | kus Kusaie | ||
| 2366 : | kut Kutenai | ||
| 2367 : | lad Ladino | ||
| 2368 : | lah Lahnda | ||
| 2369 : | lam Lamba | ||
| 2370 : | lao Lao | ||
| 2371 : | lat Latin | ||
| 2372 : | lav Latvian | ||
| 2373 : | lez Lezghian | ||
| 2374 : | lin Lingala | ||
| 2375 : | lit Lithuanian | ||
| 2376 : | lol Mongo | ||
| 2377 : | loz Lozi | ||
| 2378 : | ltz Letzeburgesch | ||
| 2379 : | lub Luba-Katanga | ||
| 2380 : | lug Ganda | ||
| 2381 : | lui Luiseno | ||
| 2382 : | lun Lunda | ||
| 2383 : | luo Luo (Kenya and Tanzania) | ||
| 2384 : | mac Macedonian | ||
| 2385 : | mad Madurese | ||
| 2386 : | mag Magahi | ||
| 2387 : | mah Marshall | ||
| 2388 : | mai Maithili | ||
| 2389 : | mak Macedonian | ||
| 2390 : | mak Makasar | ||
| 2391 : | mal Malayalam | ||
| 2392 : | man Mandingo | ||
| 2393 : | mao Maori | ||
| 2394 : | map Austronesian (Other) | ||
| 2395 : | mar Marathi | ||
| 2396 : | mas Masai | ||
| 2397 : | max Manx | ||
| 2398 : | may Malay | ||
| 2399 : | men Mende | ||
| 2400 : | mga Irish, Middle (900 - 1200) | ||
| 2401 : | mic Micmac | ||
| 2402 : | min Minangkabau | ||
| 2403 : | mis Miscellaneous (Other) | ||
| 2404 : | mkh Mon-Kmer (Other) | ||
| 2405 : | mlg Malagasy | ||
| 2406 : | mlt Maltese | ||
| 2407 : | mni Manipuri | ||
| 2408 : | mno Manobo Languages | ||
| 2409 : | moh Mohawk | ||
| 2410 : | mol Moldavian | ||
| 2411 : | mon Mongolian | ||
| 2412 : | mos Mossi | ||
| 2413 : | mri Maori | ||
| 2414 : | msa Malay | ||
| 2415 : | mul Multiple Languages | ||
| 2416 : | mun Munda Languages | ||
| 2417 : | mus Creek | ||
| 2418 : | mwr Marwari | ||
| 2419 : | mya Burmese | ||
| 2420 : | myn Mayan Languages | ||
| 2421 : | nah Aztec | ||
| 2422 : | nai North American Indian (Other) | ||
| 2423 : | nau Nauru | ||
| 2424 : | nav Navajo | ||
| 2425 : | nbl Ndebele, South | ||
| 2426 : | nde Ndebele, North | ||
| 2427 : | ndo Ndongo | ||
| 2428 : | nep Nepali | ||
| 2429 : | new Newari | ||
| 2430 : | nic Niger-Kordofanian (Other) | ||
| 2431 : | niu Niuean | ||
| 2432 : | nla Dutch | ||
| 2433 : | nno Norwegian (Nynorsk) | ||
| 2434 : | non Norse, Old | ||
| 2435 : | nor Norwegian | ||
| 2436 : | nso Sotho, Northern | ||
| 2437 : | nub Nubian Languages | ||
| 2438 : | nya Nyanja | ||
| 2439 : | nym Nyamwezi | ||
| 2440 : | nyn Nyankole | ||
| 2441 : | nyo Nyoro | ||
| 2442 : | nzi Nzima | ||
| 2443 : | oci Langue d'Oc (post 1500) | ||
| 2444 : | oji Ojibwa | ||
| 2445 : | ori Oriya | ||
| 2446 : | orm Oromo | ||
| 2447 : | osa Osage | ||
| 2448 : | oss Ossetic | ||
| 2449 : | ota Turkish, Ottoman (1500 - 1928) | ||
| 2450 : | oto Otomian Languages | ||
| 2451 : | paa Papuan-Australian (Other) | ||
| 2452 : | pag Pangasinan | ||
| 2453 : | pal Pahlavi | ||
| 2454 : | pam Pampanga | ||
| 2455 : | pan Panjabi | ||
| 2456 : | pap Papiamento | ||
| 2457 : | pau Palauan | ||
| 2458 : | peo Persian, Old (ca 600 - 400 B.C.) | ||
| 2459 : | per Persian | ||
| 2460 : | phn Phoenician | ||
| 2461 : | pli Pali | ||
| 2462 : | pol Polish | ||
| 2463 : | pon Ponape | ||
| 2464 : | por Portuguese | ||
| 2465 : | pra Prakrit uages | ||
| 2466 : | pro Provencal, Old (to 1500) | ||
| 2467 : | pus Pushto | ||
| 2468 : | que Quechua | ||
| 2469 : | raj Rajasthani | ||
| 2470 : | rar Rarotongan | ||
| 2471 : | roa Romance (Other) | ||
| 2472 : | roh Rhaeto-Romance | ||
| 2473 : | rom Romany | ||
| 2474 : | ron Romanian | ||
| 2475 : | rum Romanian | ||
| 2476 : | run Rundi | ||
| 2477 : | rus Russian | ||
| 2478 : | sad Sandawe | ||
| 2479 : | sag Sango | ||
| 2480 : | sah Yakut | ||
| 2481 : | sai South American Indian (Other) | ||
| 2482 : | sal Salishan Languages | ||
| 2483 : | sam Samaritan Aramaic | ||
| 2484 : | san Sanskrit | ||
| 2485 : | sco Scots | ||
| 2486 : | scr Serbo-Croatian | ||
| 2487 : | sel Selkup | ||
| 2488 : | sem Semitic (Other) | ||
| 2489 : | sga Irish, Old (to 900) | ||
| 2490 : | shn Shan | ||
| 2491 : | sid Sidamo | ||
| 2492 : | sin Singhalese | ||
| 2493 : | sio Siouan Languages | ||
| 2494 : | sit Sino-Tibetan (Other) | ||
| 2495 : | sla Slavic (Other) | ||
| 2496 : | slk Slovak | ||
| 2497 : | slo Slovak | ||
| 2498 : | slv Slovenian | ||
| 2499 : | smi Sami Languages | ||
| 2500 : | smo Samoan | ||
| 2501 : | sna Shona | ||
| 2502 : | snd Sindhi | ||
| 2503 : | sog Sogdian | ||
| 2504 : | som Somali | ||
| 2505 : | son Songhai | ||
| 2506 : | sot Sotho, Southern | ||
| 2507 : | spa Spanish | ||
| 2508 : | sqi Albanian | ||
| 2509 : | srd Sardinian | ||
| 2510 : | srr Serer | ||
| 2511 : | ssa Nilo-Saharan (Other) | ||
| 2512 : | ssw Siswant | ||
| 2513 : | ssw Swazi | ||
| 2514 : | suk Sukuma | ||
| 2515 : | sun Sudanese | ||
| 2516 : | sus Susu | ||
| 2517 : | sux Sumerian | ||
| 2518 : | sve Swedish | ||
| 2519 : | swa Swahili | ||
| 2520 : | swe Swedish | ||
| 2521 : | syr Syriac | ||
| 2522 : | tah Tahitian | ||
| 2523 : | tam Tamil | ||
| 2524 : | tat Tatar | ||
| 2525 : | tel Telugu | ||
| 2526 : | tem Timne | ||
| 2527 : | ter Tereno | ||
| 2528 : | tgk Tajik | ||
| 2529 : | tgl Tagalog | ||
| 2530 : | tha Thai | ||
| 2531 : | tib Tibetan | ||
| 2532 : | tig Tigre | ||
| 2533 : | tir Tigrinya | ||
| 2534 : | tiv Tivi | ||
| 2535 : | tli Tlingit | ||
| 2536 : | tmh Tamashek | ||
| 2537 : | tog Tonga (Nyasa) | ||
| 2538 : | ton Tonga (Tonga Islands) | ||
| 2539 : | tru Truk | ||
| 2540 : | tsi Tsimshian | ||
| 2541 : | tsn Tswana | ||
| 2542 : | tso Tsonga | ||
| 2543 : | tuk Turkmen | ||
| 2544 : | tum Tumbuka | ||
| 2545 : | tur Turkish | ||
| 2546 : | tut Altaic (Other) | ||
| 2547 : | twi Twi | ||
| 2548 : | tyv Tuvinian | ||
| 2549 : | uga Ugaritic | ||
| 2550 : | uig Uighur | ||
| 2551 : | ukr Ukrainian | ||
| 2552 : | umb Umbundu | ||
| 2553 : | und Undetermined | ||
| 2554 : | urd Urdu | ||
| 2555 : | uzb Uzbek | ||
| 2556 : | vai Vai | ||
| 2557 : | ven Venda | ||
| 2558 : | vie Vietnamese | ||
| 2559 : | vol Volap�k | ||
| 2560 : | vot Votic | ||
| 2561 : | wak Wakashan Languages | ||
| 2562 : | wal Walamo | ||
| 2563 : | war Waray | ||
| 2564 : | was Washo | ||
| 2565 : | wel Welsh | ||
| 2566 : | wen Sorbian Languages | ||
| 2567 : | wol Wolof | ||
| 2568 : | xho Xhosa | ||
| 2569 : | yao Yao | ||
| 2570 : | yap Yap | ||
| 2571 : | yid Yiddish | ||
| 2572 : | yor Yoruba | ||
| 2573 : | zap Zapotec | ||
| 2574 : | zen Zenaga | ||
| 2575 : | zha Zhuang | ||
| 2576 : | zho Chinese | ||
| 2577 : | zul Zulu | ||
| 2578 : | zun Zuni | ||
| 2579 : | |||
| 2580 : | */ | ||
| 2581 : | |||
| 2582 : | return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode'); | ||
| 2583 : | } | ||
| 2584 : | |||
| 2585 : | |||
| 2586 : | function ETCOEventLookup($index) { | ||
| 2587 : | if (($index >= 0x17) && ($index <= 0xDF)) { | ||
| 2588 : | return 'reserved for future use'; | ||
| 2589 : | } | ||
| 2590 : | if (($index >= 0xE0) && ($index <= 0xEF)) { | ||
| 2591 : | return 'not predefined synch 0-F'; | ||
| 2592 : | } | ||
| 2593 : | if (($index >= 0xF0) && ($index <= 0xFC)) { | ||
| 2594 : | return 'reserved for future use'; | ||
| 2595 : | } | ||
| 2596 : | |||
| 2597 : | static $EventLookup = array( | ||
| 2598 : | 0x00 => 'padding (has no meaning)', | ||
| 2599 : | 0x01 => 'end of initial silence', | ||
| 2600 : | 0x02 => 'intro start', | ||
| 2601 : | 0x03 => 'main part start', | ||
| 2602 : | 0x04 => 'outro start', | ||
| 2603 : | 0x05 => 'outro end', | ||
| 2604 : | 0x06 => 'verse start', | ||
| 2605 : | 0x07 => 'refrain start', | ||
| 2606 : | 0x08 => 'interlude start', | ||
| 2607 : | 0x09 => 'theme start', | ||
| 2608 : | 0x0A => 'variation start', | ||
| 2609 : | 0x0B => 'key change', | ||
| 2610 : | 0x0C => 'time change', | ||
| 2611 : | 0x0D => 'momentary unwanted noise (Snap, Crackle & Pop)', | ||
| 2612 : | 0x0E => 'sustained noise', | ||
| 2613 : | 0x0F => 'sustained noise end', | ||
| 2614 : | 0x10 => 'intro end', | ||
| 2615 : | 0x11 => 'main part end', | ||
| 2616 : | 0x12 => 'verse end', | ||
| 2617 : | 0x13 => 'refrain end', | ||
| 2618 : | 0x14 => 'theme end', | ||
| 2619 : | 0x15 => 'profanity', | ||
| 2620 : | 0x16 => 'profanity end', | ||
| 2621 : | 0xFD => 'audio end (start of silence)', | ||
| 2622 : | 0xFE => 'audio file ends', | ||
| 2623 : | 0xFF => 'one more byte of events follows' | ||
| 2624 : | ); | ||
| 2625 : | |||
| 2626 : | return (isset($EventLookup[$index]) ? $EventLookup[$index] : ''); | ||
| 2627 : | } | ||
| 2628 : | |||
| 2629 : | function SYTLContentTypeLookup($index) { | ||
| 2630 : | static $SYTLContentTypeLookup = array( | ||
| 2631 : | 0x00 => 'other', | ||
| 2632 : | 0x01 => 'lyrics', | ||
| 2633 : | 0x02 => 'text transcription', | ||
| 2634 : | 0x03 => 'movement/part name', // (e.g. 'Adagio') | ||
| 2635 : | 0x04 => 'events', // (e.g. 'Don Quijote enters the stage') | ||
| 2636 : | 0x05 => 'chord', // (e.g. 'Bb F Fsus') | ||
| 2637 : | 0x06 => 'trivia/\'pop up\' information', | ||
| 2638 : | 0x07 => 'URLs to webpages', | ||
| 2639 : | 0x08 => 'URLs to images' | ||
| 2640 : | ); | ||
| 2641 : | |||
| 2642 : | return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : ''); | ||
| 2643 : | } | ||
| 2644 : | |||
| 2645 : | function APICPictureTypeLookup($index, $returnarray=false) { | ||
| 2646 : | static $APICPictureTypeLookup = array( | ||
| 2647 : | 0x00 => 'Other', | ||
| 2648 : | 0x01 => '32x32 pixels \'file icon\' (PNG only)', | ||
| 2649 : | 0x02 => 'Other file icon', | ||
| 2650 : | 0x03 => 'Cover (front)', | ||
| 2651 : | 0x04 => 'Cover (back)', | ||
| 2652 : | 0x05 => 'Leaflet page', | ||
| 2653 : | 0x06 => 'Media (e.g. label side of CD)', | ||
| 2654 : | 0x07 => 'Lead artist/lead performer/soloist', | ||
| 2655 : | 0x08 => 'Artist/performer', | ||
| 2656 : | 0x09 => 'Conductor', | ||
| 2657 : | 0x0A => 'Band/Orchestra', | ||
| 2658 : | 0x0B => 'Composer', | ||
| 2659 : | 0x0C => 'Lyricist/text writer', | ||
| 2660 : | 0x0D => 'Recording Location', | ||
| 2661 : | 0x0E => 'During recording', | ||
| 2662 : | 0x0F => 'During performance', | ||
| 2663 : | 0x10 => 'Movie/video screen capture', | ||
| 2664 : | 0x11 => 'A bright coloured fish', | ||
| 2665 : | 0x12 => 'Illustration', | ||
| 2666 : | 0x13 => 'Band/artist logotype', | ||
| 2667 : | 0x14 => 'Publisher/Studio logotype' | ||
| 2668 : | ); | ||
| 2669 : | if ($returnarray) { | ||
| 2670 : | return $APICPictureTypeLookup; | ||
| 2671 : | } | ||
| 2672 : | return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : ''); | ||
| 2673 : | } | ||
| 2674 : | |||
| 2675 : | function COMRReceivedAsLookup($index) { | ||
| 2676 : | static $COMRReceivedAsLookup = array( | ||
| 2677 : | 0x00 => 'Other', | ||
| 2678 : | 0x01 => 'Standard CD album with other songs', | ||
| 2679 : | 0x02 => 'Compressed audio on CD', | ||
| 2680 : | 0x03 => 'File over the Internet', | ||
| 2681 : | 0x04 => 'Stream over the Internet', | ||
| 2682 : | 0x05 => 'As note sheets', | ||
| 2683 : | 0x06 => 'As note sheets in a book with other sheets', | ||
| 2684 : | 0x07 => 'Music on other media', | ||
| 2685 : | 0x08 => 'Non-musical merchandise' | ||
| 2686 : | ); | ||
| 2687 : | |||
| 2688 : | return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : ''); | ||
| 2689 : | } | ||
| 2690 : | |||
| 2691 : | function RVA2ChannelTypeLookup($index) { | ||
| 2692 : | static $RVA2ChannelTypeLookup = array( | ||
| 2693 : | 0x00 => 'Other', | ||
| 2694 : | 0x01 => 'Master volume', | ||
| 2695 : | 0x02 => 'Front right', | ||
| 2696 : | 0x03 => 'Front left', | ||
| 2697 : | 0x04 => 'Back right', | ||
| 2698 : | 0x05 => 'Back left', | ||
| 2699 : | 0x06 => 'Front centre', | ||
| 2700 : | 0x07 => 'Back centre', | ||
| 2701 : | 0x08 => 'Subwoofer' | ||
| 2702 : | ); | ||
| 2703 : | |||
| 2704 : | return (isset($RVA2ChannelTypeLookup[$index]) ? $RVA2ChannelTypeLookup[$index] : ''); | ||
| 2705 : | } | ||
| 2706 : | |||
| 2707 : | function FrameNameLongLookup($framename) { | ||
| 2708 : | |||
| 2709 : | $begin = __LINE__; | ||
| 2710 : | |||
| 2711 : | /** This is not a comment! | ||
| 2712 : | |||
| 2713 : | AENC Audio encryption | ||
| 2714 : | APIC Attached picture | ||
| 2715 : | ASPI Audio seek point index | ||
| 2716 : | BUF Recommended buffer size | ||
| 2717 : | CNT Play counter | ||
| 2718 : | COM Comments | ||
| 2719 : | COMM Comments | ||
| 2720 : | COMR Commercial frame | ||
| 2721 : | CRA Audio encryption | ||
| 2722 : | CRM Encrypted meta frame | ||
| 2723 : | ENCR Encryption method registration | ||
| 2724 : | EQU Equalisation | ||
| 2725 : | EQU2 Equalisation (2) | ||
| 2726 : | EQUA Equalisation | ||
| 2727 : | ETC Event timing codes | ||
| 2728 : | ETCO Event timing codes | ||
| 2729 : | GEO General encapsulated object | ||
| 2730 : | GEOB General encapsulated object | ||
| 2731 : | GRID Group identification registration | ||
| 2732 : | IPL Involved people list | ||
| 2733 : | IPLS Involved people list | ||
| 2734 : | LINK Linked information | ||
| 2735 : | LNK Linked information | ||
| 2736 : | MCDI Music CD identifier | ||
| 2737 : | MCI Music CD Identifier | ||
| 2738 : | MLL MPEG location lookup table | ||
| 2739 : | MLLT MPEG location lookup table | ||
| 2740 : | OWNE Ownership frame | ||
| 2741 : | PCNT Play counter | ||
| 2742 : | PIC Attached picture | ||
| 2743 : | POP Popularimeter | ||
| 2744 : | POPM Popularimeter | ||
| 2745 : | POSS Position synchronisation frame | ||
| 2746 : | PRIV Private frame | ||
| 2747 : | RBUF Recommended buffer size | ||
| 2748 : | REV Reverb | ||
| 2749 : | RVA Relative volume adjustment | ||
| 2750 : | RVA2 Relative volume adjustment (2) | ||
| 2751 : | RVAD Relative volume adjustment | ||
| 2752 : | RVRB Reverb | ||
| 2753 : | SEEK Seek frame | ||
| 2754 : | SIGN Signature frame | ||
| 2755 : | SLT Synchronised lyric/text | ||
| 2756 : | STC Synced tempo codes | ||
| 2757 : | SYLT Synchronised lyric/text | ||
| 2758 : | SYTC Synchronised tempo codes | ||
| 2759 : | TAL Album/Movie/Show title | ||
| 2760 : | TALB Album/Movie/Show title | ||
| 2761 : | TBP BPM (Beats Per Minute) | ||
| 2762 : | TBPM BPM (beats per minute) | ||
| 2763 : | TCM Composer | ||
| 2764 : | TCO Content type | ||
| 2765 : | TCOM Composer | ||
| 2766 : | TCON Content type | ||
| 2767 : | TCOP Copyright message | ||
| 2768 : | TCR Copyright message | ||
| 2769 : | TDA Date | ||
| 2770 : | TDAT Date | ||
| 2771 : | TDEN Encoding time | ||
| 2772 : | TDLY Playlist delay | ||
| 2773 : | TDOR Original release time | ||
| 2774 : | TDRC Recording time | ||
| 2775 : | TDRL Release time | ||
| 2776 : | TDTG Tagging time | ||
| 2777 : | TDY Playlist delay | ||
| 2778 : | TEN Encoded by | ||
| 2779 : | TENC Encoded by | ||
| 2780 : | TEXT Lyricist/Text writer | ||
| 2781 : | TFLT File type | ||
| 2782 : | TFT File type | ||
| 2783 : | TIM Time | ||
| 2784 : | TIME Time | ||
| 2785 : | TIPL Involved people list | ||
| 2786 : | TIT1 Content group description | ||
| 2787 : | TIT2 Title/songname/content description | ||
| 2788 : | TIT3 Subtitle/Description refinement | ||
| 2789 : | TKE Initial key | ||
| 2790 : | TKEY Initial key | ||
| 2791 : | TLA Language(s) | ||
| 2792 : | TLAN Language(s) | ||
| 2793 : | TLE Length | ||
| 2794 : | TLEN Length | ||
| 2795 : | TMCL Musician credits list | ||
| 2796 : | TMED Media type | ||
| 2797 : | TMOO Mood | ||
| 2798 : | TMT Media type | ||
| 2799 : | TOA Original artist(s)/performer(s) | ||
| 2800 : | TOAL Original album/movie/show title | ||
| 2801 : | TOF Original filename | ||
| 2802 : | TOFN Original filename | ||
| 2803 : | TOL Original Lyricist(s)/text writer(s) | ||
| 2804 : | TOLY Original lyricist(s)/text writer(s) | ||
| 2805 : | TOPE Original artist(s)/performer(s) | ||
| 2806 : | TOR Original release year | ||
| 2807 : | TORY Original release year | ||
| 2808 : | TOT Original album/Movie/Show title | ||
| 2809 : | TOWN File owner/licensee | ||
| 2810 : | TP1 Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group | ||
| 2811 : | TP2 Band/Orchestra/Accompaniment | ||
| 2812 : | TP3 Conductor/Performer refinement | ||
| 2813 : | TP4 Interpreted, remixed, or otherwise modified by | ||
| 2814 : | TPA Part of a set | ||
| 2815 : | TPB Publisher | ||
| 2816 : | TPE1 Lead performer(s)/Soloist(s) | ||
| 2817 : | TPE2 Band/orchestra/accompaniment | ||
| 2818 : | TPE3 Conductor/performer refinement | ||
| 2819 : | TPE4 Interpreted, remixed, or otherwise modified by | ||
| 2820 : | TPOS Part of a set | ||
| 2821 : | TPRO Produced notice | ||
| 2822 : | TPUB Publisher | ||
| 2823 : | TRC ISRC (International Standard Recording Code) | ||
| 2824 : | TRCK Track number/Position in set | ||
| 2825 : | TRD Recording dates | ||
| 2826 : | TRDA Recording dates | ||
| 2827 : | TRK Track number/Position in set | ||
| 2828 : | TRSN Internet radio station name | ||
| 2829 : | TRSO Internet radio station owner | ||
| 2830 : | TSI Size | ||
| 2831 : | TSIZ Size | ||
| 2832 : | TSOA Album sort order | ||
| 2833 : | TSOP Performer sort order | ||
| 2834 : | TSOT Title sort order | ||
| 2835 : | TSRC ISRC (international standard recording code) | ||
| 2836 : | TSS Software/hardware and settings used for encoding | ||
| 2837 : | TSSE Software/Hardware and settings used for encoding | ||
| 2838 : | TSST Set subtitle | ||
| 2839 : | TT1 Content group description | ||
| 2840 : | TT2 Title/Songname/Content description | ||
| 2841 : | TT3 Subtitle/Description refinement | ||
| 2842 : | TXT Lyricist/text writer | ||
| 2843 : | TXX User defined text information frame | ||
| 2844 : | TXXX User defined text information frame | ||
| 2845 : | TYE Year | ||
| 2846 : | TYER Year | ||
| 2847 : | UFI Unique file identifier | ||
| 2848 : | UFID Unique file identifier | ||
| 2849 : | ULT Unsychronised lyric/text transcription | ||
| 2850 : | USER Terms of use | ||
| 2851 : | USLT Unsynchronised lyric/text transcription | ||
| 2852 : | WAF Official audio file webpage | ||
| 2853 : | WAR Official artist/performer webpage | ||
| 2854 : | WAS Official audio source webpage | ||
| 2855 : | WCM Commercial information | ||
| 2856 : | WCOM Commercial information | ||
| 2857 : | WCOP Copyright/Legal information | ||
| 2858 : | WCP Copyright/Legal information | ||
| 2859 : | WOAF Official audio file webpage | ||
| 2860 : | WOAR Official artist/performer webpage | ||
| 2861 : | WOAS Official audio source webpage | ||
| 2862 : | WORS Official Internet radio station homepage | ||
| 2863 : | WPAY Payment | ||
| 2864 : | WPB Publishers official webpage | ||
| 2865 : | WPUB Publishers official webpage | ||
| 2866 : | WXX User defined URL link frame | ||
| 2867 : | WXXX User defined URL link frame | ||
| 2868 : | TFEA Featured Artist | ||
| 2869 : | TSTU Recording Studio | ||
| 2870 : | rgad Replay Gain Adjustment | ||
| 2871 : | |||
| 2872 : | */ | ||
| 2873 : | |||
| 2874 : | return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long'); | ||
| 2875 : | |||
| 2876 : | // Last three: | ||
| 2877 : | // from Helium2 [www.helium2.com] | ||
| 2878 : | // from http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html | ||
| 2879 : | } | ||
| 2880 : | |||
| 2881 : | |||
| 2882 : | function FrameNameShortLookup($framename) { | ||
| 2883 : | |||
| 2884 : | $begin = __LINE__; | ||
| 2885 : | |||
| 2886 : | /** This is not a comment! | ||
| 2887 : | |||
| 2888 : | AENC audio_encryption | ||
| 2889 : | APIC attached_picture | ||
| 2890 : | ASPI audio_seek_point_index | ||
| 2891 : | BUF recommended_buffer_size | ||
| 2892 : | CNT play_counter | ||
| 2893 : | COM comments | ||
| 2894 : | COMM comments | ||
| 2895 : | COMR commercial_frame | ||
| 2896 : | CRA audio_encryption | ||
| 2897 : | CRM encrypted_meta_frame | ||
| 2898 : | ENCR encryption_method_registration | ||
| 2899 : | EQU equalisation | ||
| 2900 : | EQU2 equalisation | ||
| 2901 : | EQUA equalisation | ||
| 2902 : | ETC event_timing_codes | ||
| 2903 : | ETCO event_timing_codes | ||
| 2904 : | GEO general_encapsulated_object | ||
| 2905 : | GEOB general_encapsulated_object | ||
| 2906 : | GRID group_identification_registration | ||
| 2907 : | IPL involved_people_list | ||
| 2908 : | IPLS involved_people_list | ||
| 2909 : | LINK linked_information | ||
| 2910 : | LNK linked_information | ||
| 2911 : | MCDI music_cd_identifier | ||
| 2912 : | MCI music_cd_identifier | ||
| 2913 : | MLL mpeg_location_lookup_table | ||
| 2914 : | MLLT mpeg_location_lookup_table | ||
| 2915 : | OWNE ownership_frame | ||
| 2916 : | PCNT play_counter | ||
| 2917 : | PIC attached_picture | ||
| 2918 : | POP popularimeter | ||
| 2919 : | POPM popularimeter | ||
| 2920 : | POSS position_synchronisation_frame | ||
| 2921 : | PRIV private_frame | ||
| 2922 : | RBUF recommended_buffer_size | ||
| 2923 : | REV reverb | ||
| 2924 : | RVA relative_volume_adjustment | ||
| 2925 : | RVA2 relative_volume_adjustment | ||
| 2926 : | RVAD relative_volume_adjustment | ||
| 2927 : | RVRB reverb | ||
| 2928 : | SEEK seek_frame | ||
| 2929 : | SIGN signature_frame | ||
| 2930 : | SLT synchronised_lyric | ||
| 2931 : | STC synced_tempo_codes | ||
| 2932 : | SYLT synchronised_lyric | ||
| 2933 : | SYTC synchronised_tempo_codes | ||
| 2934 : | TAL album | ||
| 2935 : | TALB album | ||
| 2936 : | TBP bpm | ||
| 2937 : | TBPM bpm | ||
| 2938 : | TCM composer | ||
| 2939 : | TCO content_type | ||
| 2940 : | TCOM composer | ||
| 2941 : | TCON content_type | ||
| 2942 : | TCOP copyright_message | ||
| 2943 : | TCR copyright_message | ||
| 2944 : | TDA date | ||
| 2945 : | TDAT date | ||
| 2946 : | TDEN encoding_time | ||
| 2947 : | TDLY playlist_delay | ||
| 2948 : | TDOR original_release_time | ||
| 2949 : | TDRC recording_time | ||
| 2950 : | TDRL release_time | ||
| 2951 : | TDTG tagging_time | ||
| 2952 : | TDY playlist_delay | ||
| 2953 : | TEN encoded_by | ||
| 2954 : | TENC encoded_by | ||
| 2955 : | TEXT lyricist | ||
| 2956 : | TFLT file_type | ||
| 2957 : | TFT file_type | ||
| 2958 : | TIM time | ||
| 2959 : | TIME time | ||
| 2960 : | TIPL involved_people_list | ||
| 2961 : | TIT1 content_group_description | ||
| 2962 : | TIT2 title | ||
| 2963 : | TIT3 subtitle | ||
| 2964 : | TKE initial_key | ||
| 2965 : | TKEY initial_key | ||
| 2966 : | TLA language | ||
| 2967 : | TLAN language | ||
| 2968 : | TLE length | ||
| 2969 : | TLEN length | ||
| 2970 : | TMCL musician_credits_list | ||
| 2971 : | TMED media_type | ||
| 2972 : | TMOO mood | ||
| 2973 : | TMT media_type | ||
| 2974 : | TOA original_artist | ||
| 2975 : | TOAL original_album | ||
| 2976 : | TOF original_filename | ||
| 2977 : | TOFN original_filename | ||
| 2978 : | TOL original_lyricist | ||
| 2979 : | TOLY original_lyricist | ||
| 2980 : | TOPE original_artist | ||
| 2981 : | TOR original_year | ||
| 2982 : | TORY original_year | ||
| 2983 : | TOT original_album | ||
| 2984 : | TOWN file_owner | ||
| 2985 : | TP1 artist | ||
| 2986 : | TP2 band | ||
| 2987 : | TP3 conductor | ||
| 2988 : | TP4 remixer | ||
| 2989 : | TPA part_of_a_set | ||
| 2990 : | TPB publisher | ||
| 2991 : | TPE1 artist | ||
| 2992 : | TPE2 band | ||
| 2993 : | TPE3 conductor | ||
| 2994 : | TPE4 remixer | ||
| 2995 : | TPOS part_of_a_set | ||
| 2996 : | TPRO produced_notice | ||
| 2997 : | TPUB publisher | ||
| 2998 : | TRC isrc | ||
| 2999 : | TRCK track_number | ||
| 3000 : | TRD recording_dates | ||
| 3001 : | TRDA recording_dates | ||
| 3002 : | TRK track_number | ||
| 3003 : | TRSN internet_radio_station_name | ||
| 3004 : | TRSO internet_radio_station_owner | ||
| 3005 : | TSI size | ||
| 3006 : | TSIZ size | ||
| 3007 : | TSOA album_sort_order | ||
| 3008 : | TSOP performer_sort_order | ||
| 3009 : | TSOT title_sort_order | ||
| 3010 : | TSRC isrc | ||
| 3011 : | TSS encoder_settings | ||
| 3012 : | TSSE encoder_settings | ||
| 3013 : | TSST set_subtitle | ||
| 3014 : | TT1 description | ||
| 3015 : | TT2 title | ||
| 3016 : | TT3 subtitle | ||
| 3017 : | TXT lyricist | ||
| 3018 : | TXX text | ||
| 3019 : | TXXX text | ||
| 3020 : | TYE year | ||
| 3021 : | TYER year | ||
| 3022 : | UFI unique_file_identifier | ||
| 3023 : | UFID unique_file_identifier | ||
| 3024 : | ULT unsychronised_lyric | ||
| 3025 : | USER terms_of_use | ||
| 3026 : | USLT unsynchronised_lyric | ||
| 3027 : | WAF url_file | ||
| 3028 : | WAR url_artist | ||
| 3029 : | WAS url_source | ||
| 3030 : | WCM commercial_information | ||
| 3031 : | WCOM commercial_information | ||
| 3032 : | WCOP copyright | ||
| 3033 : | WCP copyright | ||
| 3034 : | WOAF url_file | ||
| 3035 : | WOAR url_artist | ||
| 3036 : | WOAS url_source | ||
| 3037 : | WORS url_station | ||
| 3038 : | WPAY url_payment | ||
| 3039 : | WPB url_publisher | ||
| 3040 : | WPUB url_publisher | ||
| 3041 : | WXX url_user | ||
| 3042 : | WXXX url_user | ||
| 3043 : | TFEA featured_artist | ||
| 3044 : | TSTU recording_studio | ||
| 3045 : | rgad replay_gain_adjustment | ||
| 3046 : | |||
| 3047 : | */ | ||
| 3048 : | |||
| 3049 : | return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short'); | ||
| 3050 : | } | ||
| 3051 : | |||
| 3052 : | function TextEncodingTerminatorLookup($encoding) { | ||
| 3053 : | // http://www.id3.org/id3v2.4.0-structure.txt | ||
| 3054 : | // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings: | ||
| 3055 : | // $00 ISO-8859-1. Terminated with $00. | ||
| 3056 : | // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00. | ||
| 3057 : | // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00. | ||
| 3058 : | // $03 UTF-8 encoded Unicode. Terminated with $00. | ||
| 3059 : | |||
| 3060 : | static $TextEncodingTerminatorLookup = array(0=>"\x00", 1=>"\x00\x00", 2=>"\x00\x00", 3=>"\x00", 255=>"\x00\x00"); | ||
| 3061 : | |||
| 3062 : | return @$TextEncodingTerminatorLookup[$encoding]; | ||
| 3063 : | } | ||
| 3064 : | |||
| 3065 : | function TextEncodingNameLookup($encoding) { | ||
| 3066 : | // http://www.id3.org/id3v2.4.0-structure.txt | ||
| 3067 : | static $TextEncodingNameLookup = array(0=>'ISO-8859-1', 1=>'UTF-16', 2=>'UTF-16BE', 3=>'UTF-8', 255=>'UTF-16BE'); | ||
| 3068 : | return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1'); | ||
| 3069 : | } | ||
| 3070 : | |||
| 3071 : | function IsValidID3v2FrameName($framename, $id3v2majorversion) { | ||
| 3072 : | switch ($id3v2majorversion) { | ||
| 3073 : | case 2: | ||
| 3074 : | return ereg('[A-Z][A-Z0-9]{2}', $framename); | ||
| 3075 : | break; | ||
| 3076 : | |||
| 3077 : | case 3: | ||
| 3078 : | case 4: | ||
| 3079 : | return ereg('[A-Z][A-Z0-9]{3}', $framename); | ||
| 3080 : | break; | ||
| 3081 : | } | ||
| 3082 : | return false; | ||
| 3083 : | } | ||
| 3084 : | |||
| 3085 : | function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) { | ||
| 3086 : | for ($i = 0; $i < strlen($numberstring); $i++) { | ||
| 3087 : | if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) { | ||
| 3088 : | if (($numberstring{$i} == '.') && $allowdecimal) { | ||
| 3089 : | // allowed | ||
| 3090 : | } elseif (($numberstring{$i} == '-') && $allownegative && ($i == 0)) { | ||
| 3091 : | // allowed | ||
| 3092 : | } else { | ||
| 3093 : | return false; | ||
| 3094 : | } | ||
| 3095 : | } | ||
| 3096 : | } | ||
| 3097 : | return true; | ||
| 3098 : | } | ||
| 3099 : | |||
| 3100 : | function IsValidDateStampString($datestamp) { | ||
| 3101 : | if (strlen($datestamp) != 8) { | ||
| 3102 : | return false; | ||
| 3103 : | } | ||
| 3104 : | if (!$this->IsANumber($datestamp, false)) { | ||
| 3105 : | return false; | ||
| 3106 : | } | ||
| 3107 : | $year = substr($datestamp, 0, 4); | ||
| 3108 : | $month = substr($datestamp, 4, 2); | ||
| 3109 : | $day = substr($datestamp, 6, 2); | ||
| 3110 : | if (($year == 0) || ($month == 0) || ($day == 0)) { | ||
| 3111 : | return false; | ||
| 3112 : | } | ||
| 3113 : | if ($month > 12) { | ||
| 3114 : | return false; | ||
| 3115 : | } | ||
| 3116 : | if ($day > 31) { | ||
| 3117 : | return false; | ||
| 3118 : | } | ||
| 3119 : | if (($day > 30) && (($month == 4) || ($month == 6) || ($month == 9) || ($month == 11))) { | ||
| 3120 : | return false; | ||
| 3121 : | } | ||
| 3122 : | if (($day > 29) && ($month == 2)) { | ||
| 3123 : | return false; | ||
| 3124 : | } | ||
| 3125 : | return true; | ||
| 3126 : | } | ||
| 3127 : | |||
| 3128 : | function ID3v2HeaderLength($majorversion) { | ||
| 3129 : | return (($majorversion == 2) ? 6 : 10); | ||
| 3130 : | } | ||
| 3131 : | |||
| 3132 : | } | ||
| 3133 : | |||
| 3134 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

