• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP getid3_riff类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getid3_riff的典型用法代码示例。如果您正苦于以下问题:PHP getid3_riff类的具体用法?PHP getid3_riff怎么用?PHP getid3_riff使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了getid3_riff类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: Analyze

 public function Analyze()
 {
     $getid3 = $this->getid3;
     $getid3->include_module('audio-video.riff');
     fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
     $shn_header = fread($getid3->fp, 8);
     // Magic bytes: "ajkg"
     $getid3->info['fileformat'] = 'shn';
     $getid3->info['audio']['dataformat'] = 'shn';
     $getid3->info['audio']['lossless'] = true;
     $getid3->info['audio']['bitrate_mode'] = 'vbr';
     $getid3->info['shn']['version'] = getid3_lib::LittleEndian2Int($shn_header[4]);
     fseek($getid3->fp, $getid3->info['avdataend'] - 12, SEEK_SET);
     $seek_table_signature_test = fread($getid3->fp, 12);
     $getid3->info['shn']['seektable']['present'] = (bool) (substr($seek_table_signature_test, 4, 8) == 'SHNAMPSK');
     if ($getid3->info['shn']['seektable']['present']) {
         $getid3->info['shn']['seektable']['length'] = getid3_lib::LittleEndian2Int(substr($seek_table_signature_test, 0, 4));
         $getid3->info['shn']['seektable']['offset'] = $getid3->info['avdataend'] - $getid3->info['shn']['seektable']['length'];
         fseek($getid3->fp, $getid3->info['shn']['seektable']['offset'], SEEK_SET);
         $seek_table_magic = fread($getid3->fp, 4);
         if ($seek_table_magic != 'SEEK') {
             throw new getid3_exception('Expecting "SEEK" at offset ' . $getid3->info['shn']['seektable']['offset'] . ', found "' . $seek_table_magic . '"');
         }
         $seek_table_data = fread($getid3->fp, $getid3->info['shn']['seektable']['length'] - 16);
         $getid3->info['shn']['seektable']['entry_count'] = floor(strlen($seek_table_data) / 80);
     }
     $commandline = 'shorten -x ' . escapeshellarg(realpath($getid3->filename)) . ' - | head -c 64';
     $output = `{$commandline}`;
     if (@$output && substr($output, 12, 4) == 'fmt ') {
         $fmt_size = getid3_lib::LittleEndian2Int(substr($output, 16, 4));
         $decoded_wav_format_ex = getid3_riff::RIFFparseWAVEFORMATex(substr($output, 20, $fmt_size));
         $getid3->info['audio']['channels'] = $decoded_wav_format_ex['channels'];
         $getid3->info['audio']['bits_per_sample'] = $decoded_wav_format_ex['bits_per_sample'];
         $getid3->info['audio']['sample_rate'] = $decoded_wav_format_ex['sample_rate'];
         if (substr($output, 20 + $fmt_size, 4) == 'data') {
             $getid3->info['playtime_seconds'] = getid3_lib::LittleEndian2Int(substr($output, 20 + 4 + $fmt_size, 4)) / $decoded_wav_format_ex['raw']['nAvgBytesPerSec'];
         } else {
             throw new getid3_exception('shorten failed to decode DATA chunk to expected location, cannot determine playtime');
         }
         $getid3->info['audio']['bitrate'] = ($getid3->info['avdataend'] - $getid3->info['avdataoffset']) / $getid3->info['playtime_seconds'] * 8;
     } else {
         throw new getid3_exception('shorten failed to decode file to WAV for parsing');
         return false;
     }
     return true;
 }
开发者ID:pheski,项目名称:Scribite,代码行数:46,代码来源:module.audio.shorten.php


示例2: ParseRIFFdata

 public function ParseRIFFdata(&$RIFFdata)
 {
     $info =& $this->getid3->info;
     if ($RIFFdata) {
         $tempfile = tempnam(GETID3_TEMP_DIR, 'getID3');
         $fp_temp = fopen($tempfile, 'wb');
         $RIFFdataLength = strlen($RIFFdata);
         $NewLengthString = getid3_lib::LittleEndian2String($RIFFdataLength, 4);
         for ($i = 0; $i < 4; $i++) {
             $RIFFdata[$i + 4] = $NewLengthString[$i];
         }
         fwrite($fp_temp, $RIFFdata);
         fclose($fp_temp);
         $getid3_temp = new getID3();
         $getid3_temp->openfile($tempfile);
         $getid3_temp->info['filesize'] = $RIFFdataLength;
         $getid3_temp->info['filenamepath'] = $info['filenamepath'];
         $getid3_temp->info['tags'] = $info['tags'];
         $getid3_temp->info['warning'] = $info['warning'];
         $getid3_temp->info['error'] = $info['error'];
         $getid3_temp->info['comments'] = $info['comments'];
         $getid3_temp->info['audio'] = isset($info['audio']) ? $info['audio'] : array();
         $getid3_temp->info['video'] = isset($info['video']) ? $info['video'] : array();
         $getid3_riff = new getid3_riff($getid3_temp);
         $getid3_riff->Analyze();
         $info['riff'] = $getid3_temp->info['riff'];
         $info['warning'] = $getid3_temp->info['warning'];
         $info['error'] = $getid3_temp->info['error'];
         $info['tags'] = $getid3_temp->info['tags'];
         $info['comments'] = $getid3_temp->info['comments'];
         unset($getid3_riff, $getid3_temp);
         unlink($tempfile);
     }
     return false;
 }
开发者ID:harrisonsmith,项目名称:active-progression,代码行数:35,代码来源:module.audio-video.riff.php


示例3: 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::CodecIDtoCommonName($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'];
                     $track_info['display_unit'] = self::displayUnit(isset($trackarray['DisplayUnit']) ? $trackarray['DisplayUnit'] : 0);
                     $track_info['display_x'] = isset($trackarray['DisplayWidth']) ? $trackarray['DisplayWidth'] : $trackarray['PixelWidth'];
                     $track_info['display_y'] = isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight'];
                     if (isset($trackarray['PixelCropBottom'])) {
                         $track_info['crop_bottom'] = $trackarray['PixelCropBottom'];
                     }
                     if (isset($trackarray['PixelCropTop'])) {
                         $track_info['crop_top'] = $trackarray['PixelCropTop'];
                     }
                     if (isset($trackarray['PixelCropLeft'])) {
                         $track_info['crop_left'] = $trackarray['PixelCropLeft'];
                     }
                     if (isset($trackarray['PixelCropRight'])) {
                         $track_info['crop_right'] = $trackarray['PixelCropRight'];
                     }
                     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':
                             getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.audio-video.riff.php', __FILE__, true);
                             $parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']);
                             $track_info['codec'] = getid3_riff::fourccLookup($parsed['fourcc']);
                             $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
                             break;
                             /*case 'V_MPEG4/ISO/AVC':
                             		$h264['profile']    = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 1, 1));
                             		$h264['level']      = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 3, 1));
                             		$rn                 = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 4, 1));
                             		$h264['NALUlength'] = ($rn & 3) + 1;
                             		$rn                 = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 5, 1));
                             		$nsps               = ($rn & 31);
                             		$offset             = 6;
                             		for ($i = 0; $i < $nsps; $i ++) {
                             			$length        = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2));
                             			$h264['SPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length);
                             			$offset       += 2 + $length;
                             		}
                             		$npps               = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 1));
                             		$offset            += 1;
                             		for ($i = 0; $i < $npps; $i ++) {
                             			$length        = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2));
                             			$h264['PPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length);
                             			$offset       += 2 + $length;
                             		}
                             		$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $h264;
                             		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'];
                     }
//.........这里部分代码省略.........
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:101,代码来源:module.audio-video.matroska.php


示例4: Analyze


//.........这里部分代码省略.........
                                                         $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
                                                         $sub_subelement_end = $offset + $sub_subelement_length;
                                                         switch ($sub_subelement_id) {
                                                             case EBML_ID_PIXELWIDTH:
                                                             case EBML_ID_PIXELHEIGHT:
                                                             case EBML_ID_STEREOMODE:
                                                             case EBML_ID_PIXELCROPBOTTOM:
                                                             case EBML_ID_PIXELCROPTOP:
                                                             case EBML_ID_PIXELCROPLEFT:
                                                             case EBML_ID_PIXELCROPRIGHT:
                                                             case EBML_ID_DISPLAYWIDTH:
                                                             case EBML_ID_DISPLAYHEIGHT:
                                                             case EBML_ID_DISPLAYUNIT:
                                                             case EBML_ID_ASPECTRATIOTYPE:
                                                                 $track_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length));
                                                                 break;
                                                             case EBML_ID_FLAGINTERLACED:
                                                                 $track_entry[$sub_subelement_idname] = (bool) getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length));
                                                                 break;
                                                             case EBML_ID_GAMMAVALUE:
                                                                 $track_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length));
                                                                 break;
                                                             case EBML_ID_COLOURSPACE:
                                                                 $track_entry[$sub_subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length), "");
                                                                 break;
                                                             default:
                                                                 $this->warnings[] = 'Unhandled track.video element [' . basename(__FILE__) . ':' . __LINE__ . '] (' . $sub_subelement_id . '::' . $sub_subelement_idname . ') at ' . $sub_subelement_offset;
                                                                 break;
                                                         }
                                                         $offset = $sub_subelement_end;
                                                     }
                                                     if (isset($track_entry[$this->EBMLidName(EBML_ID_CODECID)]) && $track_entry[$this->EBMLidName(EBML_ID_CODECID)] == 'V_MS/VFW/FOURCC' && isset($track_entry[$this->EBMLidName(EBML_ID_CODECPRIVATE)])) {
                                                         if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.audio-video.riff.php', __FILE__, false)) {
                                                             $track_entry['codec_private_parsed'] = getid3_riff::ParseBITMAPINFOHEADER($track_entry[$this->EBMLidName(EBML_ID_CODECPRIVATE)]);
                                                         } else {
                                                             $this->warnings[] = 'Unable to parse codec private data [' . basename(__FILE__) . ':' . __LINE__ . '] because cannot include "module.audio-video.riff.php"';
                                                         }
                                                     }
                                                     break;
                                                 case EBML_ID_AUDIO:
                                                     while ($offset < $subelement_end) {
                                                         $this->EnsureBufferHasEnoughData($EBMLdata, $offset, $EBMLdata_offset);
                                                         $sub_subelement_offset = $offset;
                                                         $sub_subelement_id = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
                                                         $sub_subelement_idname = $this->EBMLidName($sub_subelement_id);
                                                         $sub_subelement_length = $this->readEBMLint($EBMLdata, $offset, $EBMLdata_offset);
                                                         $sub_subelement_end = $offset + $sub_subelement_length;
                                                         switch ($sub_subelement_id) {
                                                             case EBML_ID_CHANNELS:
                                                             case EBML_ID_BITDEPTH:
                                                                 $track_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Int(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length));
                                                                 break;
                                                             case EBML_ID_SAMPLINGFREQUENCY:
                                                             case EBML_ID_OUTPUTSAMPLINGFREQUENCY:
                                                                 $track_entry[$sub_subelement_idname] = getid3_lib::BigEndian2Float(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length));
                                                                 break;
                                                             case EBML_ID_CHANNELPOSITIONS:
                                                                 $track_entry[$sub_subelement_idname] = trim(substr($EBMLdata, $offset - $EBMLdata_offset, $sub_subelement_length), "");
                                                                 break;
                                                             default:
                                                                 $this->warnings[] = 'Unhandled track.audio element [' . basename(__FILE__) . ':' . __LINE__ . '] (' . $sub_subelement_id . '::' . $sub_subelement_idname . ') at ' . $sub_subelement_offset;
                                                                 break;
                                                         }
                                                         $offset = $sub_subelement_end;
                                                     }
                                                     break;
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:67,代码来源:module.audio-video.matroska.php


示例5: ParseOptimFROGheader45


//.........这里部分代码省略.........
                         }
                     }
                 }
                 $ThisFileInfo['audio']['channels'] = $thisfile_ofr_thisblock['channels'];
                 $ThisFileInfo['audio']['sample_rate'] = $thisfile_ofr_thisblock['sample_rate'];
                 $ThisFileInfo['audio']['bits_per_sample'] = $this->OptimFROGbitsPerSampleTypeLookup($thisfile_ofr_thisblock['raw']['sample_type']);
                 break;
             case 'COMP':
                 // unlike other block types, there CAN be multiple COMP blocks
                 $COMPdata['offset'] = $BlockOffset;
                 $COMPdata['size'] = $BlockSize;
                 if ($ThisFileInfo['avdataoffset'] == 0) {
                     $ThisFileInfo['avdataoffset'] = $BlockOffset;
                 }
                 // Only interested in first 14 bytes (only first 12 needed for v4.50 alpha), not actual audio data
                 $BlockData .= fread($fd, 14);
                 fseek($fd, $BlockSize - 14, SEEK_CUR);
                 $COMPdata['crc_32'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4));
                 $offset += 4;
                 $COMPdata['sample_count'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4));
                 $offset += 4;
                 $COMPdata['raw']['sample_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1));
                 $COMPdata['sample_type'] = $this->OptimFROGsampleTypeLookup($COMPdata['raw']['sample_type']);
                 $offset += 1;
                 $COMPdata['raw']['channel_configuration'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1));
                 $COMPdata['channel_configuration'] = $this->OptimFROGchannelConfigurationLookup($COMPdata['raw']['channel_configuration']);
                 $offset += 1;
                 $COMPdata['raw']['algorithm_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2));
                 //$COMPdata['algorithm']                    = OptimFROGalgorithmNameLookup($COMPdata['raw']['algorithm_id']);
                 $offset += 2;
                 if ($ThisFileInfo['ofr']['OFR ']['size'] > 12) {
                     // OFR 4.504b or higher
                     $COMPdata['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2));
                     $COMPdata['encoder'] = $this->OptimFROGencoderNameLookup($COMPdata['raw']['encoder_id']);
                     $offset += 2;
                 }
                 if ($COMPdata['crc_32'] == 0x454e4f4e) {
                     // ASCII value of 'NONE' - placeholder value in v4.50a
                     $COMPdata['crc_32'] = false;
                 }
                 $thisfile_ofr_thisblock[] = $COMPdata;
                 break;
             case 'HEAD':
                 $thisfile_ofr_thisblock['offset'] = $BlockOffset;
                 $thisfile_ofr_thisblock['size'] = $BlockSize;
                 $RIFFdata .= fread($fd, $BlockSize);
                 break;
             case 'TAIL':
                 $thisfile_ofr_thisblock['offset'] = $BlockOffset;
                 $thisfile_ofr_thisblock['size'] = $BlockSize;
                 if ($BlockSize > 0) {
                     $RIFFdata .= fread($fd, $BlockSize);
                 }
                 break;
             case 'RECV':
                 // block contains no useful meta data - simply note and skip
                 $thisfile_ofr_thisblock['offset'] = $BlockOffset;
                 $thisfile_ofr_thisblock['size'] = $BlockSize;
                 fseek($fd, $BlockSize, SEEK_CUR);
                 break;
             case 'APET':
                 // APEtag v2
                 $thisfile_ofr_thisblock['offset'] = $BlockOffset;
                 $thisfile_ofr_thisblock['size'] = $BlockSize;
                 $ThisFileInfo['warning'][] = 'APEtag processing inside OptimFROG not supported in this version (' . GETID3_VERSION . ') of getID3()';
                 fseek($fd, $BlockSize, SEEK_CUR);
                 break;
             case 'MD5 ':
                 // APEtag v2
                 $thisfile_ofr_thisblock['offset'] = $BlockOffset;
                 $thisfile_ofr_thisblock['size'] = $BlockSize;
                 if ($BlockSize == 16) {
                     $thisfile_ofr_thisblock['md5_binary'] = fread($fd, $BlockSize);
                     $thisfile_ofr_thisblock['md5_string'] = getid3_lib::PrintHexBytes($thisfile_ofr_thisblock['md5_binary'], true, false, false);
                     $ThisFileInfo['md5_data_source'] = $thisfile_ofr_thisblock['md5_string'];
                 } else {
                     $ThisFileInfo['warning'][] = 'Expecting block size of 16 in "MD5 " chunk, found ' . $BlockSize . ' instead';
                     fseek($fd, $BlockSize, SEEK_CUR);
                 }
                 break;
             default:
                 $thisfile_ofr_thisblock['offset'] = $BlockOffset;
                 $thisfile_ofr_thisblock['size'] = $BlockSize;
                 $ThisFileInfo['warning'][] = 'Unhandled OptimFROG block type "' . $BlockName . '" at offset ' . $thisfile_ofr_thisblock['offset'];
                 fseek($fd, $BlockSize, SEEK_CUR);
                 break;
         }
     }
     if (isset($ThisFileInfo['ofr']['TAIL']['offset'])) {
         $ThisFileInfo['avdataend'] = $ThisFileInfo['ofr']['TAIL']['offset'];
     }
     $ThisFileInfo['playtime_seconds'] = (double) $ThisFileInfo['ofr']['OFR ']['total_samples'] / ($ThisFileInfo['audio']['channels'] * $ThisFileInfo['audio']['sample_rate']);
     $ThisFileInfo['audio']['bitrate'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) * 8 / $ThisFileInfo['playtime_seconds'];
     // move the data chunk after all other chunks (if any)
     // so that the RIFF parser doesn't see EOF when trying
     // to skip over the data chunk
     $RIFFdata = substr($RIFFdata, 0, 36) . substr($RIFFdata, 44) . substr($RIFFdata, 36, 8);
     getid3_riff::ParseRIFFdata($RIFFdata, $ThisFileInfo);
     return true;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:module.audio.optimfrog.php


示例6: parseEBML


//.........这里部分代码省略.........
                                                     $track_entry[$subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($subelement['data']);
                                                     break;
                                                 case EBML_ID_VIDEO:
                                                     while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
                                                         switch ($sub_subelement['id']) {
                                                             case EBML_ID_PIXELWIDTH:
                                                             case EBML_ID_PIXELHEIGHT:
                                                             case EBML_ID_STEREOMODE:
                                                             case EBML_ID_PIXELCROPBOTTOM:
                                                             case EBML_ID_PIXELCROPTOP:
                                                             case EBML_ID_PIXELCROPLEFT:
                                                             case EBML_ID_PIXELCROPRIGHT:
                                                             case EBML_ID_DISPLAYWIDTH:
                                                             case EBML_ID_DISPLAYHEIGHT:
                                                             case EBML_ID_DISPLAYUNIT:
                                                             case EBML_ID_ASPECTRATIOTYPE:
                                                                 $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
                                                                 break;
                                                             case EBML_ID_FLAGINTERLACED:
                                                                 $track_entry[$sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_subelement['data']);
                                                                 break;
                                                             case EBML_ID_GAMMAVALUE:
                                                                 $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']);
                                                                 break;
                                                             case EBML_ID_COLOURSPACE:
                                                                 $track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
                                                                 break;
                                                             default:
                                                                 $this->unhandledElement('track.video', __LINE__, $sub_subelement);
                                                         }
                                                     }
                                                     if (isset($track_entry[$this->EBMLidName(EBML_ID_CODECID)]) && $track_entry[$this->EBMLidName(EBML_ID_CODECID)] == 'V_MS/VFW/FOURCC' && isset($track_entry[$this->EBMLidName(EBML_ID_CODECPRIVATE)])) {
                                                         if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.audio-video.riff.php', __FILE__, false)) {
                                                             $track_entry['codec_private_parsed'] = getid3_riff::ParseBITMAPINFOHEADER($track_entry[$this->EBMLidName(EBML_ID_CODECPRIVATE)]);
                                                         } else {
                                                             $this->getid3->warning('Unable to parse codec private data [' . basename(__FILE__) . ':' . __LINE__ . '] because cannot include "module.audio-video.riff.php"');
                                                         }
                                                     }
                                                     break;
                                                 case EBML_ID_AUDIO:
                                                     while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
                                                         switch ($sub_subelement['id']) {
                                                             case EBML_ID_CHANNELS:
                                                             case EBML_ID_BITDEPTH:
                                                                 $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
                                                                 break;
                                                             case EBML_ID_SAMPLINGFREQUENCY:
                                                             case EBML_ID_OUTPUTSAMPLINGFREQUENCY:
                                                                 $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']);
                                                                 break;
                                                             case EBML_ID_CHANNELPOSITIONS:
                                                                 $track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
                                                                 break;
                                                             default:
                                                                 $this->unhandledElement('track.audio', __LINE__, $sub_subelement);
                                                         }
                                                     }
                                                     break;
                                                 case EBML_ID_CONTENTENCODINGS:
                                                     while ($this->getEBMLelement($sub_subelement, $subelement['end'])) {
                                                         switch ($sub_subelement['id']) {
                                                             case EBML_ID_CONTENTENCODING:
                                                                 while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CONTENTCOMPRESSION, EBML_ID_CONTENTENCRYPTION))) {
                                                                     switch ($sub_sub_subelement['id']) {
                                                                         case EBML_ID_CONTENTENCODINGORDER:
                                                                         case EBML_ID_CONTENTENCODINGSCOPE:
开发者ID:MZeora,项目名称:Dead-Crows,代码行数:67,代码来源:module.audio-video.matroska.php


示例7: RIFFparseWAVEFORMATex

 function RIFFparseWAVEFORMATex($WaveFormatExData)
 {
     // shortcut
     $WaveFormatEx['raw'] = array();
     $WaveFormatEx_raw =& $WaveFormatEx['raw'];
     $WaveFormatEx_raw['wFormatTag'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 0, 2));
     $WaveFormatEx_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 2, 2));
     $WaveFormatEx_raw['nSamplesPerSec'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 4, 4));
     $WaveFormatEx_raw['nAvgBytesPerSec'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 8, 4));
     $WaveFormatEx_raw['nBlockAlign'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 12, 2));
     $WaveFormatEx_raw['wBitsPerSample'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 14, 2));
     if (strlen($WaveFormatExData) > 16) {
         $WaveFormatEx_raw['cbSize'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 16, 2));
     }
     $WaveFormatEx['codec'] = getid3_riff::RIFFwFormatTagLookup($WaveFormatEx_raw['wFormatTag']);
     $WaveFormatEx['channels'] = $WaveFormatEx_raw['nChannels'];
     $WaveFormatEx['sample_rate'] = $WaveFormatEx_raw['nSamplesPerSec'];
     $WaveFormatEx['bitrate'] = $WaveFormatEx_raw['nAvgBytesPerSec'] * 8;
     $WaveFormatEx['bits_per_sample'] = $WaveFormatEx_raw['wBitsPerSample'];
     return $WaveFormatEx;
 }
开发者ID:ioanok,项目名称:symfoxid,代码行数:21,代码来源:module.audio-video.riff.php


示例8: Analyze


//.........这里部分代码省略.........
                         // ID_SHAPING_WEIGHTS
                     // ID_SHAPING_WEIGHTS
                     case 0x8:
                         // ID_FLOAT_INFO
                     // ID_FLOAT_INFO
                     case 0x9:
                         // ID_INT32_INFO
                     // ID_INT32_INFO
                     case 0xa:
                         // ID_WV_BITSTREAM
                     // ID_WV_BITSTREAM
                     case 0xb:
                         // ID_WVC_BITSTREAM
                     // ID_WVC_BITSTREAM
                     case 0xc:
                         // ID_WVX_BITSTREAM
                     // ID_WVX_BITSTREAM
                     case 0xd:
                         // ID_CHANNEL_INFO
                         fseek($this->getid3->fp, $metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size'], SEEK_SET);
                         break;
                     default:
                         $info['warning'][] = 'Unexpected metablock type "0x' . str_pad(dechex($metablock['function_id']), 2, '0', STR_PAD_LEFT) . '" at offset ' . $metablock['offset'];
                         fseek($this->getid3->fp, $metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size'], SEEK_SET);
                         break;
                 }
                 switch ($metablock['function_id']) {
                     case 0x21:
                         // ID_RIFF_HEADER
                         getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.audio-video.riff.php', __FILE__, true);
                         $original_wav_filesize = getid3_lib::LittleEndian2Int(substr($metablock['data'], 4, 4));
                         $getid3_temp = new getID3();
                         $getid3_temp->openfile($this->getid3->filename);
                         $getid3_riff = new getid3_riff($getid3_temp);
                         $getid3_riff->ParseRIFFdata($metablock['data']);
                         $metablock['riff'] = $getid3_temp->info['riff'];
                         $info['audio']['sample_rate'] = $getid3_temp->info['riff']['raw']['fmt ']['nSamplesPerSec'];
                         unset($getid3_riff, $getid3_temp);
                         $metablock['riff']['original_filesize'] = $original_wav_filesize;
                         $info['wavpack']['riff_trailer_size'] = $original_wav_filesize - $metablock['riff']['WAVE']['data'][0]['size'] - $metablock['riff']['header_size'];
                         $info['playtime_seconds'] = $info['wavpack']['blockheader']['total_samples'] / $info['audio']['sample_rate'];
                         // Safe RIFF header in case there's a RIFF footer later
                         $metablockRIFFheader = $metablock['data'];
                         break;
                     case 0x22:
                         // ID_RIFF_TRAILER
                         $metablockRIFFfooter = $metablockRIFFheader . $metablock['data'];
                         getid3_lib::IncludeDependency(GETID3_INCLUDEPATH . 'module.audio-video.riff.php', __FILE__, true);
                         $startoffset = $metablock['offset'] + ($metablock['large_block'] ? 4 : 2);
                         $getid3_temp = new getID3();
                         $getid3_temp->openfile($this->getid3->filename);
                         $getid3_temp->info['avdataend'] = $info['avdataend'];
                         $getid3_temp->info['fileformat'] = 'riff';
                         $getid3_riff = new getid3_riff($getid3_temp);
                         $metablock['riff'] = $getid3_riff->ParseRIFF($startoffset, $startoffset + $metablock['size']);
                         if (!empty($metablock['riff']['INFO'])) {
                             $getid3_riff->RIFFcommentsParse($metablock['riff']['INFO'], $metablock['comments']);
                             $info['tags']['riff'] = $metablock['comments'];
                         }
                         unset($getid3_temp, $getid3_riff);
                         break;
                     case 0x23:
                         // ID_REPLAY_GAIN
                         $info['warning'][] = 'WavPack "Replay Gain" contents not yet handled by getID3() in metablock at offset ' . $metablock['offset'];
                         break;
                     case 0x24:
开发者ID:ricofreak,项目名称:omekaArchiveProject,代码行数:67,代码来源:module.audio.wavpack.php


示例9: 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') {
//.........这里部分代码省略.........
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:101,代码来源:module.audio-video.matroska.php


示例10: 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'];
                  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP global_common类代码示例发布时间:2022-05-23
下一篇:
PHP getid3_lib类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap