view e2gallerypro/e2upload/Backend/Assets/getid3/module.audio-video.real.php @ 20:1038db2374ec judyates

change address
author Robert McIntyre <rlm@mit.edu>
date Sun, 08 Sep 2013 00:47:09 -0400
parents 3f6b44aa6b35
children
line wrap: on
line source
1 <?php
2 // +----------------------------------------------------------------------+
3 // | PHP version 5 |
4 // +----------------------------------------------------------------------+
5 // | Copyright (c) 2002-2006 James Heinrich, Allan Hansen |
6 // +----------------------------------------------------------------------+
7 // | This source file is subject to version 2 of the GPL license, |
8 // | that is bundled with this package in the file license.txt and is |
9 // | available through the world-wide-web at the following url: |
10 // | http://www.gnu.org/copyleft/gpl.html |
11 // +----------------------------------------------------------------------+
12 // | getID3() - http://getid3.sourceforge.net or http://www.getid3.org |
13 // +----------------------------------------------------------------------+
14 // | Authors: James Heinrich <infoØgetid3*org> |
15 // | Allan Hansen <ahØartemis*dk> |
16 // +----------------------------------------------------------------------+
17 // | module.audio-video.real.php |
18 // | Module for analyzing Real Audio/Video files |
19 // | dependencies: module.audio-video.riff.php |
20 // +----------------------------------------------------------------------+
21 //
22 // $Id: module.audio-video.real.php,v 1.4 2006/11/02 10:48:00 ah Exp $
26 class getid3_real extends getid3_handler
27 {
29 public function Analyze() {
31 $getid3 = $this->getid3;
33 $getid3->include_module('audio-video.riff');
35 $getid3->info['fileformat'] = 'real';
36 $getid3->info['bitrate'] = 0;
37 $getid3->info['playtime_seconds'] = 0;
39 fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
40 $chunk_counter = 0;
42 while (ftell($getid3->fp) < $getid3->info['avdataend']) {
44 $chunk_data = fread($getid3->fp, 8);
45 $chunk_name = substr($chunk_data, 0, 4);
46 $chunk_size = getid3_lib::BigEndian2Int(substr($chunk_data, 4, 4));
48 if ($chunk_name == '.ra'."\xFD") {
49 $chunk_data .= fread($getid3->fp, $chunk_size - 8);
51 if ($this->ParseOldRAheader(substr($chunk_data, 0, 128), $getid3->info['real']['old_ra_header'])) {
53 $getid3->info['audio']['dataformat'] = 'real';
54 $getid3->info['audio']['lossless'] = false;
55 $getid3->info['audio']['sample_rate'] = $getid3->info['real']['old_ra_header']['sample_rate'];
56 $getid3->info['audio']['bits_per_sample'] = $getid3->info['real']['old_ra_header']['bits_per_sample'];
57 $getid3->info['audio']['channels'] = $getid3->info['real']['old_ra_header']['channels'];
59 $getid3->info['playtime_seconds'] = 60 * ($getid3->info['real']['old_ra_header']['audio_bytes'] / $getid3->info['real']['old_ra_header']['bytes_per_minute']);
60 $getid3->info['audio']['bitrate'] = 8 * ($getid3->info['real']['old_ra_header']['audio_bytes'] / $getid3->info['playtime_seconds']);
61 $getid3->info['audio']['codec'] = $this->RealAudioCodecFourCClookup($getid3->info['real']['old_ra_header']['fourcc'], $getid3->info['audio']['bitrate']);
63 foreach ($getid3->info['real']['old_ra_header']['comments'] as $key => $value_array) {
65 if (strlen(trim($value_array[0])) > 0) {
66 $getid3->info['real']['comments'][$key][] = trim($value_array[0]);
67 }
68 }
69 return true;
70 }
72 throw new getid3_exception('There was a problem parsing this RealAudio file. Please submit it for analysis to http://www.getid3.org/upload/ or info@getid3.org');
73 }
75 $getid3->info['real']['chunks'][$chunk_counter] = array ();
76 $info_real_chunks_current_chunk = &$getid3->info['real']['chunks'][$chunk_counter];
78 $info_real_chunks_current_chunk['name'] = $chunk_name;
79 $info_real_chunks_current_chunk['offset'] = ftell($getid3->fp) - 8;
80 $info_real_chunks_current_chunk['length'] = $chunk_size;
82 if (($info_real_chunks_current_chunk['offset'] + $info_real_chunks_current_chunk['length']) > $getid3->info['avdataend']) {
83 $getid3->warning('Chunk "'.$info_real_chunks_current_chunk['name'].'" at offset '.$info_real_chunks_current_chunk['offset'].' claims to be '.$info_real_chunks_current_chunk['length'].' bytes long, which is beyond end of file');
84 return false;
85 }
87 if ($chunk_size > (getid3::FREAD_BUFFER_SIZE + 8)) {
88 $chunk_data .= fread($getid3->fp, getid3::FREAD_BUFFER_SIZE - 8);
89 fseek($getid3->fp, $info_real_chunks_current_chunk['offset'] + $chunk_size, SEEK_SET);
91 } elseif(($chunk_size - 8) > 0) {
92 $chunk_data .= fread($getid3->fp, $chunk_size - 8);
93 }
94 $offset = 8;
96 switch ($chunk_name) {
98 case '.RMF': // RealMedia File Header
100 $info_real_chunks_current_chunk['object_version'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
101 $offset += 2;
103 switch ($info_real_chunks_current_chunk['object_version']) {
105 case 0:
106 $info_real_chunks_current_chunk['file_version'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 4));
107 $offset += 4;
109 $info_real_chunks_current_chunk['headers_count'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 4));
110 $offset += 4;
111 break;
113 default:
114 //$getid3->warning('Expected .RMF-object_version to be "0", actual value is "'.$info_real_chunks_current_chunk['object_version'].'" (should not be a problem)';
115 break;
117 }
118 break;
121 case 'PROP': // Properties Header
123 $info_real_chunks_current_chunk['object_version'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
124 $offset += 2;
126 if ($info_real_chunks_current_chunk['object_version'] == 0) {
128 getid3_lib::ReadSequence('BigEndian2Int', $info_real_chunks_current_chunk, $chunk_data, $offset,
129 array (
130 'max_bit_rate' => 4,
131 'avg_bit_rate' => 4,
132 'max_packet_size' => 4,
133 'avg_packet_size' => 4,
134 'num_packets' => 4,
135 'duration' => 4,
136 'preroll' => 4,
137 'index_offset' => 4,
138 'data_offset' => 4,
139 'num_streams' => 2,
140 'flags_raw' => 2
141 )
142 );
143 $offset += 40;
145 $getid3->info['playtime_seconds'] = $info_real_chunks_current_chunk['duration'] / 1000;
146 if ($info_real_chunks_current_chunk['duration'] > 0) {
147 $getid3->info['bitrate'] += $info_real_chunks_current_chunk['avg_bit_rate'];
148 }
150 $info_real_chunks_current_chunk['flags']['save_enabled'] = (bool)($info_real_chunks_current_chunk['flags_raw'] & 0x0001);
151 $info_real_chunks_current_chunk['flags']['perfect_play'] = (bool)($info_real_chunks_current_chunk['flags_raw'] & 0x0002);
152 $info_real_chunks_current_chunk['flags']['live_broadcast'] = (bool)($info_real_chunks_current_chunk['flags_raw'] & 0x0004);
153 }
154 break;
157 case 'MDPR': // Media Properties Header
159 $info_real_chunks_current_chunk['object_version'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
160 $offset += 2;
162 if ($info_real_chunks_current_chunk['object_version'] == 0) {
164 getid3_lib::ReadSequence('BigEndian2Int', $info_real_chunks_current_chunk, $chunk_data, $offset,
165 array (
166 'stream_number' => 2,
167 'max_bit_rate' => 4,
168 'avg_bit_rate' => 4,
169 'max_packet_size' => 4,
170 'avg_packet_size' => 4,
171 'start_time' => 4,
172 'preroll' => 4,
173 'duration' => 4,
174 'stream_name_size' => 1
175 )
176 );
177 $offset += 31;
179 $info_real_chunks_current_chunk['stream_name'] = substr($chunk_data, $offset, $info_real_chunks_current_chunk['stream_name_size']);
180 $offset += $info_real_chunks_current_chunk['stream_name_size'];
182 $info_real_chunks_current_chunk['mime_type_size'] = getid3_lib::BigEndian2Int($chunk_data{$offset++});
184 $info_real_chunks_current_chunk['mime_type'] = substr($chunk_data, $offset, $info_real_chunks_current_chunk['mime_type_size']);
185 $offset += $info_real_chunks_current_chunk['mime_type_size'];
187 $info_real_chunks_current_chunk['type_specific_len'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 4));
188 $offset += 4;
190 $info_real_chunks_current_chunk['type_specific_data'] = substr($chunk_data, $offset, $info_real_chunks_current_chunk['type_specific_len']);
191 $offset += $info_real_chunks_current_chunk['type_specific_len'];
193 $info_real_chunks_current_chunk_typespecificdata = &$info_real_chunks_current_chunk['type_specific_data'];
195 switch ($info_real_chunks_current_chunk['mime_type']) {
197 case 'video/x-pn-realvideo':
198 case 'video/x-pn-multirate-realvideo':
199 // http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html
201 $info_real_chunks_current_chunk['video_info'] = array ();
202 $info_real_chunks_current_chunk_video_info = &$info_real_chunks_current_chunk['video_info'];
204 getid3_lib::ReadSequence('BigEndian2Int', $info_real_chunks_current_chunk_video_info, $info_real_chunks_current_chunk_typespecificdata, 0,
205 array (
206 'dwSize' => 4,
207 'fourcc1' => -4,
208 'fourcc2' => -4,
209 'width' => 2,
210 'height' => 2,
211 'bits_per_sample' => 2,
212 'IGNORE-unknown1' => 2,
213 'IGNORE-unknown2' => 2,
214 'frames_per_second' => 2,
215 'IGNORE-unknown3' => 2,
216 'IGNORE-unknown4' => 2,
217 'IGNORE-unknown5' => 2,
218 'IGNORE-unknown6' => 2,
219 'IGNORE-unknown7' => 2,
220 'IGNORE-unknown8' => 2,
221 'IGNORE-unknown9' => 2
222 )
223 );
225 $info_real_chunks_current_chunk_video_info['codec'] = getid3_riff::RIFFfourccLookup($info_real_chunks_current_chunk_video_info['fourcc2']);
227 $getid3->info['video']['resolution_x'] = $info_real_chunks_current_chunk_video_info['width'];
228 $getid3->info['video']['resolution_y'] = $info_real_chunks_current_chunk_video_info['height'];
229 $getid3->info['video']['frame_rate'] = (float)$info_real_chunks_current_chunk_video_info['frames_per_second'];
230 $getid3->info['video']['codec'] = $info_real_chunks_current_chunk_video_info['codec'];
231 $getid3->info['video']['bits_per_sample'] = $info_real_chunks_current_chunk_video_info['bits_per_sample'];
232 break;
235 case 'audio/x-pn-realaudio':
236 case 'audio/x-pn-multirate-realaudio':
238 $this->ParseOldRAheader($info_real_chunks_current_chunk_typespecificdata, $info_real_chunks_current_chunk['parsed_audio_data']);
240 $getid3->info['audio']['sample_rate'] = $info_real_chunks_current_chunk['parsed_audio_data']['sample_rate'];
241 $getid3->info['audio']['bits_per_sample'] = $info_real_chunks_current_chunk['parsed_audio_data']['bits_per_sample'];
242 $getid3->info['audio']['channels'] = $info_real_chunks_current_chunk['parsed_audio_data']['channels'];
244 if (!empty($getid3->info['audio']['dataformat'])) {
245 foreach ($getid3->info['audio'] as $key => $value) {
246 if ($key != 'streams') {
247 $getid3->info['audio']['streams'][$info_real_chunks_current_chunk['stream_number']][$key] = $value;
248 }
249 }
250 }
251 break;
254 case 'logical-fileinfo':
256 $info_real_chunks_current_chunk['logical_fileinfo']['logical_fileinfo_length'] = getid3_lib::BigEndian2Int(substr($info_real_chunks_current_chunk_typespecificdata, 0, 4));
257 // $info_real_chunks_current_chunk['logical_fileinfo']['IGNORE-unknown1'] = getid3_lib::BigEndian2Int(substr($info_real_chunks_current_chunk_typespecificdata, 4, 4));
258 $info_real_chunks_current_chunk['logical_fileinfo']['num_tags'] = getid3_lib::BigEndian2Int(substr($info_real_chunks_current_chunk_typespecificdata, 8, 4));
259 // $info_real_chunks_current_chunk['logical_fileinfo']['IGNORE-unknown2'] = getid3_lib::BigEndian2Int(substr($info_real_chunks_current_chunk_typespecificdata, 12, 4));
260 break;
262 }
265 if (empty($getid3->info['playtime_seconds'])) {
266 $getid3->info['playtime_seconds'] = max($getid3->info['playtime_seconds'], ($info_real_chunks_current_chunk['duration'] + $info_real_chunks_current_chunk['start_time']) / 1000);
267 }
269 if ($info_real_chunks_current_chunk['duration'] > 0) {
271 switch ($info_real_chunks_current_chunk['mime_type']) {
273 case 'audio/x-pn-realaudio':
274 case 'audio/x-pn-multirate-realaudio':
276 $getid3->info['audio']['bitrate'] = (isset($getid3->info['audio']['bitrate']) ? $getid3->info['audio']['bitrate'] : 0) + $info_real_chunks_current_chunk['avg_bit_rate'];
277 $getid3->info['audio']['codec'] = $this->RealAudioCodecFourCClookup($info_real_chunks_current_chunk['parsed_audio_data']['fourcc'], $getid3->info['audio']['bitrate']);
278 $getid3->info['audio']['dataformat'] = 'real';
279 $getid3->info['audio']['lossless'] = false;
280 break;
283 case 'video/x-pn-realvideo':
284 case 'video/x-pn-multirate-realvideo':
286 $getid3->info['video']['bitrate'] = (isset($getid3->info['video']['bitrate']) ? $getid3->info['video']['bitrate'] : 0) + $info_real_chunks_current_chunk['avg_bit_rate'];
287 $getid3->info['video']['bitrate_mode'] = 'cbr';
288 $getid3->info['video']['dataformat'] = 'real';
289 $getid3->info['video']['lossless'] = false;
290 $getid3->info['video']['pixel_aspect_ratio'] = (float)1;
291 break;
294 case 'audio/x-ralf-mpeg4-generic':
296 $getid3->info['audio']['bitrate'] = (isset($getid3->info['audio']['bitrate']) ? $getid3->info['audio']['bitrate'] : 0) + $info_real_chunks_current_chunk['avg_bit_rate'];
297 $getid3->info['audio']['codec'] = 'RealAudio Lossless';
298 $getid3->info['audio']['dataformat'] = 'real';
299 $getid3->info['audio']['lossless'] = true;
300 break;
302 }
304 $getid3->info['bitrate'] = (isset($getid3->info['video']['bitrate']) ? $getid3->info['video']['bitrate'] : 0) + (isset($getid3->info['audio']['bitrate']) ? $getid3->info['audio']['bitrate'] : 0);
305 }
306 }
307 break;
310 case 'CONT': // Content Description Header (text comments)
312 $info_real_chunks_current_chunk['object_version'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
313 $offset += 2;
315 if ($info_real_chunks_current_chunk['object_version'] == 0) {
317 $info_real_chunks_current_chunk['title_len'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
318 $offset += 2;
320 $info_real_chunks_current_chunk['title'] = (string) substr($chunk_data, $offset, $info_real_chunks_current_chunk['title_len']);
321 $offset += $info_real_chunks_current_chunk['title_len'];
323 $info_real_chunks_current_chunk['artist_len'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
324 $offset += 2;
326 $info_real_chunks_current_chunk['artist'] = (string) substr($chunk_data, $offset, $info_real_chunks_current_chunk['artist_len']);
327 $offset += $info_real_chunks_current_chunk['artist_len'];
329 $info_real_chunks_current_chunk['copyright_len'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
330 $offset += 2;
332 $info_real_chunks_current_chunk['copyright'] = (string) substr($chunk_data, $offset, $info_real_chunks_current_chunk['copyright_len']);
333 $offset += $info_real_chunks_current_chunk['copyright_len'];
335 $info_real_chunks_current_chunk['comment_len'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
336 $offset += 2;
338 $info_real_chunks_current_chunk['comment'] = (string) substr($chunk_data, $offset, $info_real_chunks_current_chunk['comment_len']);
339 $offset += $info_real_chunks_current_chunk['comment_len'];
341 foreach (array ('title'=>'title', 'artist'=>'artist', 'copyright'=>'copyright', 'comment'=>'comment') as $key => $val) {
342 if ($info_real_chunks_current_chunk[$key]) {
343 $getid3->info['real']['comments'][$val][] = trim($info_real_chunks_current_chunk[$key]);
344 }
345 }
346 }
347 break;
350 case 'DATA': // Data Chunk Header
352 // do nothing
353 break;
356 case 'INDX': // Index Section Header
358 $info_real_chunks_current_chunk['object_version'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
359 $offset += 2;
361 if ($info_real_chunks_current_chunk['object_version'] == 0) {
363 getid3_lib::ReadSequence('BigEndian2Int', $info_real_chunks_current_chunk, $chunk_data, $offset,
364 array (
365 'num_indices' => 4,
366 'stream_number' => 2,
367 'next_index_header' => 4
368 )
369 );
370 $offset += 10;
372 if ($info_real_chunks_current_chunk['next_index_header'] == 0) {
373 // last index chunk found, ignore rest of file
374 break 2;
375 } else {
376 // non-last index chunk, seek to next index chunk (skipping actual index data)
377 fseek($getid3->fp, $info_real_chunks_current_chunk['next_index_header'], SEEK_SET);
378 }
379 }
380 break;
383 default:
384 $getid3->warning('Unhandled RealMedia chunk "'.$chunk_name.'" at offset '.$info_real_chunks_current_chunk['offset']);
385 break;
386 }
387 $chunk_counter++;
388 }
390 if (!empty($getid3->info['audio']['streams'])) {
392 $getid3->info['audio']['bitrate'] = 0;
394 foreach ($getid3->info['audio']['streams'] as $key => $value_array) {
395 $getid3->info['audio']['bitrate'] += $value_array['bitrate'];
396 }
397 }
399 return true;
400 }
404 public static function ParseOldRAheader($old_ra_header_data, &$parsed_array) {
406 // http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html
408 $parsed_array = array ();
409 $parsed_array['magic'] = substr($old_ra_header_data, 0, 4);
411 if ($parsed_array['magic'] != '.ra'."\xFD") {
412 return false;
413 }
415 $parsed_array['version1'] = getid3_lib::BigEndian2Int(substr($old_ra_header_data, 4, 2));
417 if ($parsed_array['version1'] < 3) {
419 return false;
420 }
422 if ($parsed_array['version1'] == 3) {
424 $parsed_array['fourcc1'] = '.ra3';
425 $parsed_array['bits_per_sample'] = 16; // hard-coded for old versions?
426 $parsed_array['sample_rate'] = 8000; // hard-coded for old versions?
428 getid3_lib::ReadSequence('BigEndian2Int', $parsed_array, $old_ra_header_data, 6,
429 array (
430 'header_size' => 2,
431 'channels' => 2, // always 1 (?)
432 'IGNORE-unknown1' => 2,
433 'IGNORE-unknown2' => 2,
434 'IGNORE-unknown3' => 2,
435 'bytes_per_minute' => 2,
436 'audio_bytes' => 4,
437 )
438 );
440 $parsed_array['comments_raw'] = substr($old_ra_header_data, 22, $parsed_array['header_size'] - 22 + 1); // not including null terminator
442 $comment_offset = 0;
444 foreach (array ('title', 'artist', 'copyright') as $name) {
445 $comment_length = getid3_lib::BigEndian2Int($parsed_array['comments_raw']{$comment_offset++});
446 $parsed_array['comments'][$name][]= substr($parsed_array['comments_raw'], $comment_offset, $comment_length);
447 $comment_offset += $comment_length;
448 }
450 $comment_offset++; // final null terminator (?)
451 $comment_offset++; // fourcc length (?) should be 4
453 $parsed_array['fourcc'] = substr($old_ra_header_data, 23 + $comment_offset, 4);
456 } elseif ($parsed_array['version1'] <= 5) {
458 getid3_lib::ReadSequence('BigEndian2Int', $parsed_array, $old_ra_header_data, 6,
459 array (
460 'IGNORE-unknown1' => 2,
461 'fourcc1' => -4,
462 'file_size' => 4,
463 'version2' => 2,
464 'header_size' => 4,
465 'codec_flavor_id' => 2,
466 'coded_frame_size' => 4,
467 'audio_bytes' => 4,
468 'bytes_per_minute' => 4,
469 'IGNORE-unknown5' => 4,
470 'sub_packet_h' => 2,
471 'frame_size' => 2,
472 'sub_packet_size' => 2,
473 'IGNORE-unknown6' => 2
474 )
475 );
477 switch ($parsed_array['version1']) {
479 case 4:
481 getid3_lib::ReadSequence('BigEndian2Int', $parsed_array, $old_ra_header_data, 48,
482 array (
483 'sample_rate' => 2,
484 'IGNORE-unknown8' => 2,
485 'bits_per_sample' => 2,
486 'channels' => 2,
487 'length_fourcc2' => 1,
488 'fourcc2' => -4,
489 'length_fourcc3' => 1,
490 'fourcc3' => -4,
491 'IGNORE-unknown9' => 1,
492 'IGNORE-unknown10' => 2,
493 )
494 );
496 $parsed_array['comments_raw'] = substr($old_ra_header_data, 69, $parsed_array['header_size'] - 69 + 16);
498 $comment_offset = 0;
500 foreach (array ('title', 'artist', 'copyright') as $name) {
501 $comment_length = getid3_lib::BigEndian2Int($parsed_array['comments_raw']{$comment_offset++});
502 $parsed_array['comments'][$name][]= substr($parsed_array['comments_raw'], $comment_offset, $comment_length);
503 $comment_offset += $comment_length;
504 }
505 break;
508 case 5:
510 getid3_lib::ReadSequence('BigEndian2Int', $parsed_array, $old_ra_header_data, 48,
511 array (
512 'sample_rate' => 4,
513 'sample_rate2' => 4,
514 'bits_per_sample' => 4,
515 'channels' => 2,
516 'genr' => -4,
517 'fourcc3' => -4,
518 )
519 );
520 $parsed_array['comments'] = array ();
521 break;
523 }
525 $parsed_array['fourcc'] = $parsed_array['fourcc3'];
527 }
529 foreach ($parsed_array['comments'] as $key => $value) {
531 if ($parsed_array['comments'][$key][0] === false) {
532 $parsed_array['comments'][$key][0] = '';
533 }
534 }
536 return true;
537 }
541 public static function RealAudioCodecFourCClookup($fourcc, $bitrate) {
543 // http://www.its.msstate.edu/net/real/reports/config/tags.stats
544 // http://www.freelists.org/archives/matroska-devel/06-2003/fullthread18.html
546 static $lookup;
548 if (empty($lookup)) {
549 $lookup['14_4'][8000] = 'RealAudio v2 (14.4kbps)';
550 $lookup['14.4'][8000] = 'RealAudio v2 (14.4kbps)';
551 $lookup['lpcJ'][8000] = 'RealAudio v2 (14.4kbps)';
552 $lookup['28_8'][15200] = 'RealAudio v2 (28.8kbps)';
553 $lookup['28.8'][15200] = 'RealAudio v2 (28.8kbps)';
554 $lookup['sipr'][4933] = 'RealAudio v4 (5kbps Voice)';
555 $lookup['sipr'][6444] = 'RealAudio v4 (6.5kbps Voice)';
556 $lookup['sipr'][8444] = 'RealAudio v4 (8.5kbps Voice)';
557 $lookup['sipr'][16000] = 'RealAudio v4 (16kbps Wideband)';
558 $lookup['dnet'][8000] = 'RealAudio v3 (8kbps Music)';
559 $lookup['dnet'][16000] = 'RealAudio v3 (16kbps Music Low Response)';
560 $lookup['dnet'][15963] = 'RealAudio v3 (16kbps Music Mid/High Response)';
561 $lookup['dnet'][20000] = 'RealAudio v3 (20kbps Music Stereo)';
562 $lookup['dnet'][32000] = 'RealAudio v3 (32kbps Music Mono)';
563 $lookup['dnet'][31951] = 'RealAudio v3 (32kbps Music Stereo)';
564 $lookup['dnet'][39965] = 'RealAudio v3 (40kbps Music Mono)';
565 $lookup['dnet'][40000] = 'RealAudio v3 (40kbps Music Stereo)';
566 $lookup['dnet'][79947] = 'RealAudio v3 (80kbps Music Mono)';
567 $lookup['dnet'][80000] = 'RealAudio v3 (80kbps Music Stereo)';
569 $lookup['dnet'][0] = 'RealAudio v3';
570 $lookup['sipr'][0] = 'RealAudio v4';
571 $lookup['cook'][0] = 'RealAudio G2';
572 $lookup['atrc'][0] = 'RealAudio 8';
573 }
575 $round_bitrate = intval(round($bitrate));
577 if (isset($lookup[$fourcc][$round_bitrate])) {
578 return $lookup[$fourcc][$round_bitrate];
579 }
581 if (isset($lookup[$fourcc][0])) {
582 return $lookup[$fourcc][0];
583 }
585 return $fourcc;
586 }
588 }
591 ?>