本文整理匯總了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'];
// }
}