当前位置: 首页>>代码示例>>PHP>>正文


PHP getid3_riff::BigEndian2Float方法代码示例

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


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

示例1: Analyze


//.........这里部分代码省略.........
                 if (substr($info_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') {
                     $getid3->warning('Audio codec = ' . $info_audio['codec']);
                 }
                 $info_audio['bitrate'] = $info_riff_audio[$stream_index]['bitrate'];
                 $getid3->info['playtime_seconds'] = (double) (($info_avdataend - $info_avdataoffset) * 8 / $info_audio['bitrate']);
                 $info_audio['lossless'] = false;
                 if (isset($info_riff_wave['data'][0]['offset']) && isset($info_riff_raw['fmt ']['wFormatTag'])) {
                     switch ($info_riff_raw['fmt ']['wFormatTag']) {
                         case 0x1:
                             // PCM
                             $info_audio['lossless'] = true;
                             break;
                         case 0x2000:
                             // AC-3
                             $info_audio_dataformat = 'ac3';
                             break;
                         default:
                             // do nothing
                             break;
                     }
                 }
                 $info_audio['streams'][$stream_index]['wformattag'] = $info_audio['wformattag'];
                 $info_audio['streams'][$stream_index]['bitrate_mode'] = $info_audio['bitrate_mode'];
                 $info_audio['streams'][$stream_index]['lossless'] = $info_audio['lossless'];
                 $info_audio['streams'][$stream_index]['dataformat'] = $info_audio_dataformat;
             }
             if (isset($info_riff_wave['rgad'][0]['data'])) {
                 // shortcuts
                 $rgadData =& $info_riff_wave['rgad'][0]['data'];
                 $info_riff_raw['rgad'] = array('track' => array(), 'album' => array());
                 $info_riff_raw_rgad =& $info_riff_raw['rgad'];
                 $info_riff_raw_rgad_track =& $info_riff_raw_rgad['track'];
                 $info_riff_raw_rgad_album =& $info_riff_raw_rgad['album'];
                 $info_riff_raw_rgad['fPeakAmplitude'] = getid3_riff::BigEndian2Float(strrev(substr($rgadData, 0, 4)));
                 // LittleEndian2Float()
                 $info_riff_raw_rgad['nRadioRgAdjust'] = getid3_lib::$endian_function(substr($rgadData, 4, 2));
                 $info_riff_raw_rgad['nAudiophileRgAdjust'] = getid3_lib::$endian_function(substr($rgadData, 6, 2));
                 $n_track_rg_adjust_bit_string = str_pad(decbin($info_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT);
                 $n_album_rg_adjust_bit_string = str_pad(decbin($info_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT);
                 $info_riff_raw_rgad_track['name'] = bindec(substr($n_track_rg_adjust_bit_string, 0, 3));
                 $info_riff_raw_rgad_track['originator'] = bindec(substr($n_track_rg_adjust_bit_string, 3, 3));
                 $info_riff_raw_rgad_track['signbit'] = bindec($n_track_rg_adjust_bit_string[6]);
                 $info_riff_raw_rgad_track['adjustment'] = bindec(substr($n_track_rg_adjust_bit_string, 7, 9));
                 $info_riff_raw_rgad_album['name'] = bindec(substr($n_album_rg_adjust_bit_string, 0, 3));
                 $info_riff_raw_rgad_album['originator'] = bindec(substr($n_album_rg_adjust_bit_string, 3, 3));
                 $info_riff_raw_rgad_album['signbit'] = bindec($n_album_rg_adjust_bit_string[6]);
                 $info_riff_raw_rgad_album['adjustment'] = bindec(substr($n_album_rg_adjust_bit_string, 7, 9));
                 $info_riff['rgad']['peakamplitude'] = $info_riff_raw_rgad['fPeakAmplitude'];
                 if ($info_riff_raw_rgad_track['name'] != 0 && $info_riff_raw_rgad_track['originator'] != 0) {
                     $info_riff['rgad']['track']['name'] = getid3_lib_replaygain::NameLookup($info_riff_raw_rgad_track['name']);
                     $info_riff['rgad']['track']['originator'] = getid3_lib_replaygain::OriginatorLookup($info_riff_raw_rgad_track['originator']);
                     $info_riff['rgad']['track']['adjustment'] = getid3_lib_replaygain::AdjustmentLookup($info_riff_raw_rgad_track['adjustment'], $info_riff_raw_rgad_track['signbit']);
                 }
                 if ($info_riff_raw_rgad_album['name'] != 0 && $info_riff_raw_rgad_album['originator'] != 0) {
                     $info_riff['rgad']['album']['name'] = getid3_lib_replaygain::NameLookup($info_riff_raw_rgad_album['name']);
                     $info_riff['rgad']['album']['originator'] = getid3_lib_replaygain::OriginatorLookup($info_riff_raw_rgad_album['originator']);
                     $info_riff['rgad']['album']['adjustment'] = getid3_lib_replaygain::AdjustmentLookup($info_riff_raw_rgad_album['adjustment'], $info_riff_raw_rgad_album['signbit']);
                 }
             }
             if (isset($info_riff_wave['fact'][0]['data'])) {
                 $info_riff_raw['fact']['NumberOfSamples'] = getid3_lib::$endian_function(substr($info_riff_wave['fact'][0]['data'], 0, 4));
                 // This should be a good way of calculating exact playtime, but some sample files have had incorrect number of samples, so cannot use this method
                 // if (!empty($info_riff_raw['fmt ']['nSamplesPerSec'])) {
                 //     $getid3->info['playtime_seconds'] = (float)$info_riff_raw['fact']['NumberOfSamples'] / $info_riff_raw['fmt ']['nSamplesPerSec'];
                 // }
             }
开发者ID:jwlynch,项目名称:openacs.core,代码行数:67,代码来源:module.audio-video.riff.php


注:本文中的getid3_riff::BigEndian2Float方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。