本文整理汇总了PHP中getid3_riff::RIFFfourccLookup方法的典型用法代码示例。如果您正苦于以下问题:PHP getid3_riff::RIFFfourccLookup方法的具体用法?PHP getid3_riff::RIFFfourccLookup怎么用?PHP getid3_riff::RIFFfourccLookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类getid3_riff
的用法示例。
在下文中一共展示了getid3_riff::RIFFfourccLookup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Analyze
//.........这里部分代码省略.........
// Field Name Field Type Size (bits)
// Encoded Image Width DWORD 32 // width of image in pixels
// Encoded Image Height DWORD 32 // height of image in pixels
// Reserved Flags BYTE 8 // hardcoded: 0x02
// Format Data Size WORD 16 // size of Format Data field in bytes
// Format Data array of: variable //
// * Format Data Size DWORD 32 // number of bytes in Format Data field, in bytes - defined as biSize field of BITMAPINFOHEADER structure
// * Image Width LONG 32 // width of encoded image in pixels - defined as biWidth field of BITMAPINFOHEADER structure
// * Image Height LONG 32 // height of encoded image in pixels - defined as biHeight field of BITMAPINFOHEADER structure
// * Reserved WORD 16 // hardcoded: 0x0001 - defined as biPlanes field of BITMAPINFOHEADER structure
// * Bits Per Pixel Count WORD 16 // bits per pixel - defined as biBitCount field of BITMAPINFOHEADER structure
// * Compression ID FOURCC 32 // fourcc of video codec - defined as biCompression field of BITMAPINFOHEADER structure
// * Image Size DWORD 32 // image size in bytes - defined as biSizeImage field of BITMAPINFOHEADER structure
// * Horizontal Pixels / Meter DWORD 32 // horizontal resolution of target device in pixels per meter - defined as biXPelsPerMeter field of BITMAPINFOHEADER structure
// * Vertical Pixels / Meter DWORD 32 // vertical resolution of target device in pixels per meter - defined as biYPelsPerMeter field of BITMAPINFOHEADER structure
// * Colors Used Count DWORD 32 // number of color indexes in the color table that are actually used - defined as biClrUsed field of BITMAPINFOHEADER structure
// * Important Colors Count DWORD 32 // number of color index required for displaying bitmap. if zero, all colors are required. defined as biClrImportant field of BITMAPINFOHEADER structure
// * Codec Specific Data BYTESTREAM variable // array of codec-specific data bytes
$info_asf['video_media'][$stream_number] = array();
$info_asf_video_media_current_stream =& $info_asf['video_media'][$stream_number];
getid3_lib::ReadSequence('LittleEndian2Int', $info_asf_video_media_current_stream, $stream_data['type_specific_data'], 0, array('image_width' => 4, 'image_height' => 4, 'flags' => 1, 'format_data_size' => 2));
getid3_lib::ReadSequence('LittleEndian2Int', $info_asf_video_media_current_stream['format_data'], $stream_data['type_specific_data'], 11, array('format_data_size' => 4, 'image_width' => 4, 'image_height' => 4, 'reserved' => 2, 'bits_per_pixel' => 2, 'codec_fourcc' => -4, 'image_size' => 4, 'horizontal_pels' => 4, 'vertical_pels' => 4, 'colors_used' => 4, 'colors_important' => 4));
$info_asf_video_media_current_stream['format_data']['codec_data'] = substr($stream_data['type_specific_data'], 51);
if (!empty($info_asf['stream_bitrate_properties_object']['bitrate_records'])) {
foreach ($info_asf['stream_bitrate_properties_object']['bitrate_records'] as $data_array) {
if (@$data_array['flags']['stream_number'] == $stream_number) {
$info_asf_video_media_current_stream['bitrate'] = $data_array['bitrate'];
$info_video['streams'][$stream_number]['bitrate'] = $data_array['bitrate'];
$info_video['bitrate'] += $data_array['bitrate'];
break;
}
}
}
$info_asf_video_media_current_stream['format_data']['codec'] = getid3_riff::RIFFfourccLookup($info_asf_video_media_current_stream['format_data']['codec_fourcc']);
$info_video['streams'][$stream_number]['fourcc'] = $info_asf_video_media_current_stream['format_data']['codec_fourcc'];
$info_video['streams'][$stream_number]['codec'] = $info_asf_video_media_current_stream['format_data']['codec'];
$info_video['streams'][$stream_number]['resolution_x'] = $info_asf_video_media_current_stream['image_width'];
$info_video['streams'][$stream_number]['resolution_y'] = $info_asf_video_media_current_stream['image_height'];
$info_video['streams'][$stream_number]['bits_per_sample'] = $info_asf_video_media_current_stream['format_data']['bits_per_pixel'];
break;
default:
break;
}
}
}
while (ftell($getid3->fp) < $getid3->info['avdataend']) {
$next_object_data_header = fread($getid3->fp, 24);
$offset = 0;
$next_object_guid = substr($next_object_data_header, 0, 16);
$offset += 16;
$next_object_guidtext = getid3_asf::BytestringToGUID($next_object_guid);
$next_object_size = getid3_lib::LittleEndian2Int(substr($next_object_data_header, $offset, 8));
$offset += 8;
switch ($next_object_guidtext) {
case getid3_asf::Data_Object:
// Data Object: (mandatory, one only)
// Field Name Field Type Size (bits)
// Object ID GUID 128 // GUID for Data object - getid3_asf::Data_Object
// Object Size QWORD 64 // size of Data object, including 50 bytes of Data Object header. may be 0 if FilePropertiesObject.BroadcastFlag == 1
// File ID GUID 128 // unique identifier. identical to File ID field in Header Object
// Total Data Packets QWORD 64 // number of Data Packet entries in Data Object. invalid if FilePropertiesObject.BroadcastFlag == 1
// Reserved WORD 16 // hardcoded: 0x0101
// shortcut
$info_asf['data_object'] = array();
$info_asf_data_object =& $info_asf['data_object'];
$data_object_data = $next_object_data_header . fread($getid3->fp, 50 - 24);
示例2: Analyze
public function Analyze()
{
$info =& $this->getid3->info;
// parse container
try {
$this->parseEBML($info);
} catch (Exception $e) {
$info['error'][] = 'EBML parser: ' . $e->getMessage();
}
// calculate playtime
if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) {
foreach ($info['matroska']['info'] as $key => $infoarray) {
if (isset($infoarray['Duration'])) {
// TimecodeScale is how many nanoseconds each Duration unit is
$info['playtime_seconds'] = $infoarray['Duration'] * ((isset($infoarray['TimecodeScale']) ? $infoarray['TimecodeScale'] : 1000000) / 1000000000);
break;
}
}
}
// extract tags
if (isset($info['matroska']['tags']) && is_array($info['matroska']['tags'])) {
foreach ($info['matroska']['tags'] as $key => $infoarray) {
$this->ExtractCommentsSimpleTag($infoarray);
}
}
// process tracks
if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) {
foreach ($info['matroska']['tracks']['tracks'] as $key => $trackarray) {
$track_info = array();
$track_info['dataformat'] = self::MatroskaCodecIDtoCommonName($trackarray['CodecID']);
$track_info['default'] = isset($trackarray['FlagDefault']) ? $trackarray['FlagDefault'] : true;
if (isset($trackarray['Name'])) {
$track_info['name'] = $trackarray['Name'];
}
switch ($trackarray['TrackType']) {
case 1:
// Video
$track_info['resolution_x'] = $trackarray['PixelWidth'];
$track_info['resolution_y'] = $trackarray['PixelHeight'];
if (isset($trackarray['DisplayWidth'])) {
$track_info['display_x'] = $trackarray['DisplayWidth'];
}
if (isset($trackarray['DisplayHeight'])) {
$track_info['display_y'] = $trackarray['DisplayHeight'];
}
if (isset($trackarray['DefaultDuration'])) {
$track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3);
}
//if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; }
switch ($trackarray['CodecID']) {
case 'V_MS/VFW/FOURCC':
if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.audio-video.riff.php', __FILE__, false)) {
$this->getid3->warning('Unable to parse codec private data [' . basename(__FILE__) . ':' . __LINE__ . '] because cannot include "module.audio-video.riff.php"');
break;
}
$parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']);
$track_info['codec'] = getid3_riff::RIFFfourccLookup($parsed['fourcc']);
$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
break;
}
$info['video']['streams'][] = $track_info;
break;
case 2:
// Audio
$track_info['sample_rate'] = isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0;
$track_info['channels'] = isset($trackarray['Channels']) ? $trackarray['Channels'] : 1;
$track_info['language'] = isset($trackarray['Language']) ? $trackarray['Language'] : 'eng';
if (isset($trackarray['BitDepth'])) {
$track_info['bits_per_sample'] = $trackarray['BitDepth'];
}
//if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; }
switch ($trackarray['CodecID']) {
case 'A_PCM/INT/LIT':
case 'A_PCM/INT/BIG':
$track_info['bitrate'] = $trackarray['SamplingFrequency'] * $trackarray['Channels'] * $trackarray['BitDepth'];
break;
case 'A_AC3':
case 'A_DTS':
case 'A_MPEG/L3':
//case 'A_FLAC':
if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.audio.' . $track_info['dataformat'] . '.php', __FILE__, false)) {
$this->getid3->warning('Unable to parse audio data [' . basename(__FILE__) . ':' . __LINE__ . '] because cannot include "module.audio.' . $track_info['dataformat'] . '.php"');
break;
}
if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) {
$this->getid3->warning('Unable to parse audio data [' . basename(__FILE__) . ':' . __LINE__ . '] because $info[matroska][track_data_offsets][' . $trackarray['TrackNumber'] . '] not set');
break;
}
// create temp instance
$getid3_temp = new getID3();
$getid3_temp->openfile($this->getid3->filename);
$getid3_temp->info['avdataoffset'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'];
if ($track_info['dataformat'] == 'mp3' || $track_info['dataformat'] == 'flac') {
$getid3_temp->info['avdataend'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'] + $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['length'];
}
// analyze
$class = 'getid3_' . $track_info['dataformat'];
$header_data_key = $track_info['dataformat'] == 'mp3' ? 'mpeg' : $track_info['dataformat'];
$getid3_audio = new $class($getid3_temp);
if ($track_info['dataformat'] == 'mp3') {
//.........这里部分代码省略.........
示例3: getid3_riff
//.........这里部分代码省略.........
case 0x2001:
// DTS
$thisfile_audio_dataformat = 'dts';
break;
default:
$thisfile_audio_dataformat = 'wav';
break;
}
$thisfile_audio_streams_currentstream['dataformat'] = $thisfile_audio_dataformat;
$thisfile_audio_streams_currentstream['lossless'] = $thisfile_audio['lossless'];
$thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
break;
case 'iavs':
case 'vids':
// shortcut
$thisfile_riff_raw['strh'][$i] = array();
$thisfile_riff_raw_strh_current =& $thisfile_riff_raw['strh'][$i];
$thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4);
// same as $strhfccType;
$thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4);
$thisfile_riff_raw_strh_current['dwFlags'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 8, 4));
// Contains AVITF_* flags
$thisfile_riff_raw_strh_current['wPriority'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 12, 2));
$thisfile_riff_raw_strh_current['wLanguage'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 14, 2));
$thisfile_riff_raw_strh_current['dwInitialFrames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 16, 4));
$thisfile_riff_raw_strh_current['dwScale'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 20, 4));
$thisfile_riff_raw_strh_current['dwRate'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 24, 4));
$thisfile_riff_raw_strh_current['dwStart'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 28, 4));
$thisfile_riff_raw_strh_current['dwLength'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 32, 4));
$thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 36, 4));
$thisfile_riff_raw_strh_current['dwQuality'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 40, 4));
$thisfile_riff_raw_strh_current['dwSampleSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 44, 4));
$thisfile_riff_raw_strh_current['rcFrame'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 48, 4));
$thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strh_current['fccHandler']);
$thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler'];
if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) {
$thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']);
$thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'];
}
$thisfile_video['codec'] = $thisfile_riff_video_current['codec'];
$thisfile_video['pixel_aspect_ratio'] = (double) 1;
switch ($thisfile_riff_raw_strh_current['fccHandler']) {
case 'HFYU':
// Huffman Lossless Codec
// Huffman Lossless Codec
case 'IRAW':
// Intel YUV Uncompressed
// Intel YUV Uncompressed
case 'YUY2':
// Uncompressed YUV 4:2:2
$thisfile_video['lossless'] = true;
break;
default:
$thisfile_video['lossless'] = false;
break;
}
switch ($strhfccType) {
case 'vids':
$thisfile_riff_raw_strf_strhfccType_streamindex['biSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 0, 4));
// number of bytes required by the BITMAPINFOHEADER structure
$thisfile_riff_raw_strf_strhfccType_streamindex['biWidth'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 4, 4));
// width of the bitmap in pixels
$thisfile_riff_raw_strf_strhfccType_streamindex['biHeight'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 8, 4));
// height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner
$thisfile_riff_raw_strf_strhfccType_streamindex['biPlanes'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 12, 2));
// number of color planes on the target device. In most cases this value must be set to 1
示例4: getid3_real
//.........这里部分代码省略.........
$thisfile_real_chunks_currentchunk['mime_type_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 1));
$offset += 1;
$thisfile_real_chunks_currentchunk['mime_type'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['mime_type_size']);
$offset += $thisfile_real_chunks_currentchunk['mime_type_size'];
$thisfile_real_chunks_currentchunk['type_specific_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
$offset += 4;
$thisfile_real_chunks_currentchunk['type_specific_data'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['type_specific_len']);
$offset += $thisfile_real_chunks_currentchunk['type_specific_len'];
// shortcut
$thisfile_real_chunks_currentchunk_typespecificdata =& $thisfile_real_chunks_currentchunk['type_specific_data'];
switch ($thisfile_real_chunks_currentchunk['mime_type']) {
case 'video/x-pn-realvideo':
case 'video/x-pn-multirate-realvideo':
// http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html
// shortcut
$thisfile_real_chunks_currentchunk['video_info'] = array();
$thisfile_real_chunks_currentchunk_videoinfo =& $thisfile_real_chunks_currentchunk['video_info'];
$thisfile_real_chunks_currentchunk_videoinfo['dwSize'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 0, 4));
$thisfile_real_chunks_currentchunk_videoinfo['fourcc1'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 4, 4);
$thisfile_real_chunks_currentchunk_videoinfo['fourcc2'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 8, 4);
$thisfile_real_chunks_currentchunk_videoinfo['width'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 12, 2));
$thisfile_real_chunks_currentchunk_videoinfo['height'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 14, 2));
$thisfile_real_chunks_currentchunk_videoinfo['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 16, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown1'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 18, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown2'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 20, 2));
$thisfile_real_chunks_currentchunk_videoinfo['frames_per_second'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 22, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown3'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 24, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown4'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 26, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown5'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 28, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown6'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 30, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown7'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 32, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown8'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 34, 2));
$thisfile_real_chunks_currentchunk_videoinfo['unknown9'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 36, 2));
$thisfile_real_chunks_currentchunk_videoinfo['codec'] = getid3_riff::RIFFfourccLookup($thisfile_real_chunks_currentchunk_videoinfo['fourcc2']);
$ThisFileInfo['video']['resolution_x'] = $thisfile_real_chunks_currentchunk_videoinfo['width'];
$ThisFileInfo['video']['resolution_y'] = $thisfile_real_chunks_currentchunk_videoinfo['height'];
$ThisFileInfo['video']['frame_rate'] = (double) $thisfile_real_chunks_currentchunk_videoinfo['frames_per_second'];
$ThisFileInfo['video']['codec'] = $thisfile_real_chunks_currentchunk_videoinfo['codec'];
$ThisFileInfo['video']['bits_per_sample'] = $thisfile_real_chunks_currentchunk_videoinfo['bits_per_sample'];
break;
case 'audio/x-pn-realaudio':
case 'audio/x-pn-multirate-realaudio':
$this->ParseOldRAheader($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk['parsed_audio_data']);
$ThisFileInfo['audio']['sample_rate'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['sample_rate'];
$ThisFileInfo['audio']['bits_per_sample'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['bits_per_sample'];
$ThisFileInfo['audio']['channels'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['channels'];
if (!empty($ThisFileInfo['audio']['dataformat'])) {
foreach ($ThisFileInfo['audio'] as $key => $value) {
if ($key != 'streams') {
$ThisFileInfo['audio']['streams'][$thisfile_real_chunks_currentchunk['stream_number']][$key] = $value;
}
}
}
break;
case 'logical-fileinfo':
// shortcut
$thisfile_real_chunks_currentchunk['logical_fileinfo'] = array();
$thisfile_real_chunks_currentchunk_logicalfileinfo =& $thisfile_real_chunks_currentchunk['logical_fileinfo'];
$thisfile_real_chunks_currentchunk_logicalfileinfo['logical_fileinfo_length'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 0, 4));
$thisfile_real_chunks_currentchunk_logicalfileinfo['a'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 4, 4));
$thisfile_real_chunks_currentchunk_logicalfileinfo['b'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 8, 4));
$thisfile_real_chunks_currentchunk_logicalfileinfo['c'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 12, 4));
break;
}
if (empty($ThisFileInfo['playtime_seconds'])) {
$ThisFileInfo['playtime_seconds'] = max($ThisFileInfo['playtime_seconds'], ($thisfile_real_chunks_currentchunk['duration'] + $thisfile_real_chunks_currentchunk['start_time']) / 1000);
示例5: Analyze
//.........这里部分代码省略.........
break;
case 0x161:
// Windows Media v7 / v8 / v9
// Windows Media v7 / v8 / v9
case 0x162:
// Windows Media Professional v9
// Windows Media Professional v9
case 0x163:
// Windows Media Lossess v9
$info_audio_dataformat = 'wma';
break;
case 0x2000:
// AC-3
$info_audio_dataformat = 'ac3';
break;
case 0x2001:
// DTS
$info_audio_dataformat = 'dts';
break;
default:
$info_audio_dataformat = 'wav';
break;
}
$info_audio_streams_currentstream['dataformat'] = $info_audio_dataformat;
$info_audio_streams_currentstream['lossless'] = $info_audio['lossless'];
$info_audio_streams_currentstream['bitrate_mode'] = $info_audio['bitrate_mode'];
break;
case 'iavs':
case 'vids':
// shortcut
$info_riff_raw['strh'][$i] = array();
$info_riff_raw_strh_current =& $info_riff_raw['strh'][$i];
getid3_lib::ReadSequence($this->endian_function, $info_riff_raw_strh_current, $strh_data, 0, array('fccType' => -4, 'fccHandler' => -4, 'dwFlags' => 4, 'wPriority' => 2, 'wLanguage' => 2, 'dwInitialFrames' => 4, 'dwScale' => 4, 'dwRate' => 4, 'dwStart' => 4, 'dwLength' => 4, 'dwSuggestedBufferSize' => 4, 'dwQuality' => 4, 'dwSampleSize' => 4, 'rcFrame' => 4));
$info_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($info_riff_raw_strh_current['fccHandler']);
$info_video['fourcc'] = $info_riff_raw_strh_current['fccHandler'];
if (!$info_riff_video_current['codec'] && isset($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc']) && getid3_riff::RIFFfourccLookup($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc'])) {
$info_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc']);
$info_video['fourcc'] = $info_riff_raw_strf_strh_fcc_type_stream_index['fourcc'];
}
$info_video['codec'] = $info_riff_video_current['codec'];
$info_video['pixel_aspect_ratio'] = (double) 1;
switch ($info_riff_raw_strh_current['fccHandler']) {
case 'HFYU':
// Huffman Lossless Codec
// Huffman Lossless Codec
case 'IRAW':
// Intel YUV Uncompressed
// Intel YUV Uncompressed
case 'YUY2':
// Uncompressed YUV 4:2:2
$info_video['lossless'] = true;
break;
default:
$info_video['lossless'] = false;
break;
}
switch ($strh_fcc_type) {
case 'vids':
getid3_lib::ReadSequence($this->endian_function, $info_riff_raw_strf_strh_fcc_type_stream_index, $strf_data, 0, array('biSize' => 4, 'biWidth' => 4, 'biHeight' => 4, 'biPlanes' => 2, 'biBitCount' => 2, 'fourcc' => -4, 'biSizeImage' => 4, 'biXPelsPerMeter' => 4, 'biYPelsPerMeter' => 4, 'biClrUsed' => 4, 'biClrImportant' => 4));
$info_video['bits_per_sample'] = $info_riff_raw_strf_strh_fcc_type_stream_index['biBitCount'];
if ($info_riff_video_current['codec'] == 'DV') {
$info_riff_video_current['dv_type'] = 2;
}
break;
case 'iavs':
$info_riff_video_current['dv_type'] = 1;
示例6: Analyze
//.........这里部分代码省略.........
case 0x2001:
// DTS
$thisfile_audio_dataformat = 'dts';
break;
default:
$thisfile_audio_dataformat = 'wav';
break;
}
$thisfile_audio_streams_currentstream['dataformat'] = $thisfile_audio_dataformat;
$thisfile_audio_streams_currentstream['lossless'] = $thisfile_audio['lossless'];
$thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
break;
case 'iavs':
case 'vids':
// shortcut
$thisfile_riff_raw['strh'][$i] = array();
$thisfile_riff_raw_strh_current =& $thisfile_riff_raw['strh'][$i];
$thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4);
// same as $strhfccType;
$thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4);
$thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4));
// Contains AVITF_* flags
$thisfile_riff_raw_strh_current['wPriority'] = $this->EitherEndian2Int(substr($strhData, 12, 2));
$thisfile_riff_raw_strh_current['wLanguage'] = $this->EitherEndian2Int(substr($strhData, 14, 2));
$thisfile_riff_raw_strh_current['dwInitialFrames'] = $this->EitherEndian2Int(substr($strhData, 16, 4));
$thisfile_riff_raw_strh_current['dwScale'] = $this->EitherEndian2Int(substr($strhData, 20, 4));
$thisfile_riff_raw_strh_current['dwRate'] = $this->EitherEndian2Int(substr($strhData, 24, 4));
$thisfile_riff_raw_strh_current['dwStart'] = $this->EitherEndian2Int(substr($strhData, 28, 4));
$thisfile_riff_raw_strh_current['dwLength'] = $this->EitherEndian2Int(substr($strhData, 32, 4));
$thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = $this->EitherEndian2Int(substr($strhData, 36, 4));
$thisfile_riff_raw_strh_current['dwQuality'] = $this->EitherEndian2Int(substr($strhData, 40, 4));
$thisfile_riff_raw_strh_current['dwSampleSize'] = $this->EitherEndian2Int(substr($strhData, 44, 4));
$thisfile_riff_raw_strh_current['rcFrame'] = $this->EitherEndian2Int(substr($strhData, 48, 4));
$thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strh_current['fccHandler']);
$thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler'];
if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) {
$thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']);
$thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'];
}
$thisfile_video['codec'] = $thisfile_riff_video_current['codec'];
$thisfile_video['pixel_aspect_ratio'] = (double) 1;
switch ($thisfile_riff_raw_strh_current['fccHandler']) {
case 'HFYU':
// Huffman Lossless Codec
// Huffman Lossless Codec
case 'IRAW':
// Intel YUV Uncompressed
// Intel YUV Uncompressed
case 'YUY2':
// Uncompressed YUV 4:2:2
$thisfile_video['lossless'] = true;
break;
default:
$thisfile_video['lossless'] = false;
break;
}
switch ($strhfccType) {
case 'vids':
$thisfile_riff_raw_strf_strhfccType_streamindex = getid3_riff::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), $info['fileformat'] == 'riff');
//echo '<pre>'.print_r($thisfile_riff_raw_strf_strhfccType_streamindex, true).'</pre>';
$thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount'];
if ($thisfile_riff_video_current['codec'] == 'DV') {
$thisfile_riff_video_current['dv_type'] = 2;
}
break;
case 'iavs':
示例7: Analyze
//.........这里部分代码省略.........
$getid3->info['playtime_seconds'] = $info_real_chunks_current_chunk['duration'] / 1000;
if ($info_real_chunks_current_chunk['duration'] > 0) {
$getid3->info['bitrate'] += $info_real_chunks_current_chunk['avg_bit_rate'];
}
$info_real_chunks_current_chunk['flags']['save_enabled'] = (bool) ($info_real_chunks_current_chunk['flags_raw'] & 0x1);
$info_real_chunks_current_chunk['flags']['perfect_play'] = (bool) ($info_real_chunks_current_chunk['flags_raw'] & 0x2);
$info_real_chunks_current_chunk['flags']['live_broadcast'] = (bool) ($info_real_chunks_current_chunk['flags_raw'] & 0x4);
}
break;
case 'MDPR':
// Media Properties Header
$info_real_chunks_current_chunk['object_version'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 2));
$offset += 2;
if ($info_real_chunks_current_chunk['object_version'] == 0) {
getid3_lib::ReadSequence('BigEndian2Int', $info_real_chunks_current_chunk, $chunk_data, $offset, array('stream_number' => 2, 'max_bit_rate' => 4, 'avg_bit_rate' => 4, 'max_packet_size' => 4, 'avg_packet_size' => 4, 'start_time' => 4, 'preroll' => 4, 'duration' => 4, 'stream_name_size' => 1));
$offset += 31;
$info_real_chunks_current_chunk['stream_name'] = substr($chunk_data, $offset, $info_real_chunks_current_chunk['stream_name_size']);
$offset += $info_real_chunks_current_chunk['stream_name_size'];
$info_real_chunks_current_chunk['mime_type_size'] = getid3_lib::BigEndian2Int($chunk_data[$offset++]);
$info_real_chunks_current_chunk['mime_type'] = substr($chunk_data, $offset, $info_real_chunks_current_chunk['mime_type_size']);
$offset += $info_real_chunks_current_chunk['mime_type_size'];
$info_real_chunks_current_chunk['type_specific_len'] = getid3_lib::BigEndian2Int(substr($chunk_data, $offset, 4));
$offset += 4;
$info_real_chunks_current_chunk['type_specific_data'] = substr($chunk_data, $offset, $info_real_chunks_current_chunk['type_specific_len']);
$offset += $info_real_chunks_current_chunk['type_specific_len'];
$info_real_chunks_current_chunk_typespecificdata =& $info_real_chunks_current_chunk['type_specific_data'];
switch ($info_real_chunks_current_chunk['mime_type']) {
case 'video/x-pn-realvideo':
case 'video/x-pn-multirate-realvideo':
// http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html
$info_real_chunks_current_chunk['video_info'] = array();
$info_real_chunks_current_chunk_video_info =& $info_real_chunks_current_chunk['video_info'];
getid3_lib::ReadSequence('BigEndian2Int', $info_real_chunks_current_chunk_video_info, $info_real_chunks_current_chunk_typespecificdata, 0, array('dwSize' => 4, 'fourcc1' => -4, 'fourcc2' => -4, 'width' => 2, 'height' => 2, 'bits_per_sample' => 2, 'IGNORE-unknown1' => 2, 'IGNORE-unknown2' => 2, 'frames_per_second' => 2, 'IGNORE-unknown3' => 2, 'IGNORE-unknown4' => 2, 'IGNORE-unknown5' => 2, 'IGNORE-unknown6' => 2, 'IGNORE-unknown7' => 2, 'IGNORE-unknown8' => 2, 'IGNORE-unknown9' => 2));
$info_real_chunks_current_chunk_video_info['codec'] = getid3_riff::RIFFfourccLookup($info_real_chunks_current_chunk_video_info['fourcc2']);
$getid3->info['video']['resolution_x'] = $info_real_chunks_current_chunk_video_info['width'];
$getid3->info['video']['resolution_y'] = $info_real_chunks_current_chunk_video_info['height'];
$getid3->info['video']['frame_rate'] = (double) $info_real_chunks_current_chunk_video_info['frames_per_second'];
$getid3->info['video']['codec'] = $info_real_chunks_current_chunk_video_info['codec'];
$getid3->info['video']['bits_per_sample'] = $info_real_chunks_current_chunk_video_info['bits_per_sample'];
break;
case 'audio/x-pn-realaudio':
case 'audio/x-pn-multirate-realaudio':
$this->ParseOldRAheader($info_real_chunks_current_chunk_typespecificdata, $info_real_chunks_current_chunk['parsed_audio_data']);
$getid3->info['audio']['sample_rate'] = $info_real_chunks_current_chunk['parsed_audio_data']['sample_rate'];
$getid3->info['audio']['bits_per_sample'] = $info_real_chunks_current_chunk['parsed_audio_data']['bits_per_sample'];
$getid3->info['audio']['channels'] = $info_real_chunks_current_chunk['parsed_audio_data']['channels'];
if (!empty($getid3->info['audio']['dataformat'])) {
foreach ($getid3->info['audio'] as $key => $value) {
if ($key != 'streams') {
$getid3->info['audio']['streams'][$info_real_chunks_current_chunk['stream_number']][$key] = $value;
}
}
}
break;
case 'logical-fileinfo':
$info_real_chunks_current_chunk['logical_fileinfo']['logical_fileinfo_length'] = getid3_lib::BigEndian2Int(substr($info_real_chunks_current_chunk_typespecificdata, 0, 4));
// $info_real_chunks_current_chunk['logical_fileinfo']['IGNORE-unknown1'] = getid3_lib::BigEndian2Int(substr($info_real_chunks_current_chunk_typespecificdata, 4, 4));
$info_real_chunks_current_chunk['logical_fileinfo']['num_tags'] = getid3_lib::BigEndian2Int(substr($info_real_chunks_current_chunk_typespecificdata, 8, 4));
// $info_real_chunks_current_chunk['logical_fileinfo']['IGNORE-unknown2'] = getid3_lib::BigEndian2Int(substr($info_real_chunks_current_chunk_typespecificdata, 12, 4));
break;
}
if (empty($getid3->info['playtime_seconds'])) {
$getid3->info['playtime_seconds'] = max($getid3->info['playtime_seconds'], ($info_real_chunks_current_chunk['duration'] + $info_real_chunks_current_chunk['start_time']) / 1000);
}
if ($info_real_chunks_current_chunk['duration'] > 0) {
switch ($info_real_chunks_current_chunk['mime_type']) {
示例8: getid3_asf
//.........这里部分代码省略.........
$thisfile_asf_videomedia_currentstream =& $thisfile_asf['video_media'][$streamnumber];
$videomediaoffset = 0;
$thisfile_asf_videomedia_currentstream['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['flags'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 1));
$videomediaoffset += 1;
$thisfile_asf_videomedia_currentstream['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
$videomediaoffset += 2;
$thisfile_asf_videomedia_currentstream['format_data']['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['reserved'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
$videomediaoffset += 2;
$thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
$videomediaoffset += 2;
$thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'] = substr($streamdata['type_specific_data'], $videomediaoffset, 4);
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['image_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['horizontal_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['vertical_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['colors_used'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['colors_important'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
$videomediaoffset += 4;
$thisfile_asf_videomedia_currentstream['format_data']['codec_data'] = substr($streamdata['type_specific_data'], $videomediaoffset);
$thisfile_asf_videomedia_currentstream['format_data']['codec'] = getid3_riff::RIFFfourccLookup($thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']);
$thisfile_video['fourcc'] = $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'];
$thisfile_video['codec'] = $thisfile_asf_videomedia_currentstream['format_data']['codec'];
$thisfile_video['resolution_x'] = $thisfile_asf_videomedia_currentstream['image_width'];
$thisfile_video['resolution_y'] = $thisfile_asf_videomedia_currentstream['image_height'];
$thisfile_video['bits_per_sample'] = $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'];
break;
default:
break;
}
}
}
while (ftell($fd) < $ThisFileInfo['avdataend']) {
$NextObjectDataHeader = fread($fd, 24);
$offset = 0;
$NextObjectGUID = substr($NextObjectDataHeader, 0, 16);
$offset += 16;
$NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID);
$NextObjectSize = getid3_lib::LittleEndian2Int(substr($NextObjectDataHeader, $offset, 8));
$offset += 8;
switch ($NextObjectGUID) {
case GETID3_ASF_Data_Object:
// Data Object: (mandatory, one only)
// Field Name Field Type Size (bits)
// Object ID GUID 128 // GUID for Data object - GETID3_ASF_Data_Object
// Object Size QWORD 64 // size of Data object, including 50 bytes of Data Object header. may be 0 if FilePropertiesObject.BroadcastFlag == 1
// File ID GUID 128 // unique identifier. identical to File ID field in Header Object
// Total Data Packets QWORD 64 // number of Data Packet entries in Data Object. invalid if FilePropertiesObject.BroadcastFlag == 1
// Reserved WORD 16 // hardcoded: 0x0101
// shortcut
$thisfile_asf['data_object'] = array();
$thisfile_asf_dataobject =& $thisfile_asf['data_object'];
$DataObjectData = $NextObjectDataHeader . fread($fd, 50 - 24);