getid3_mp3::MPEGaudioFrameLength()
{} Это метод класса: getid3_mp3{}
Хуков нет.
Возвращает
int|false
.
Использование
$result = getid3_mp3::MPEGaudioFrameLength( $bitrate, $version, $layer, $padding, $samplerate );
$bitrate *(int | строка) (обязательный) (передается по ссылке — &)* |
---|
- $version(строка) (обязательный) (передается по ссылке — &)
- -
- $layer(строка) (обязательный) (передается по ссылке — &)
- -
$padding *(true | false) (обязательный)* |
---|
- $samplerate(int) (обязательный) (передается по ссылке — &)
- -
Код getid3_mp3::MPEGaudioFrameLength() getid3 mp3::MPEGaudioFrameLength WP 5.9.3
public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) { static $AudioFrameLengthCache = array(); if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) { $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false; if ($bitrate != 'free') { if ($version == '1') { if ($layer == '1') { // For Layer I slot is 32 bits long $FrameLengthCoefficient = 48; $SlotLength = 4; } else { // Layer 2 / 3 // for Layer 2 and Layer 3 slot is 8 bits long. $FrameLengthCoefficient = 144; $SlotLength = 1; } } else { // MPEG-2 / MPEG-2.5 if ($layer == '1') { // For Layer I slot is 32 bits long $FrameLengthCoefficient = 24; $SlotLength = 4; } elseif ($layer == '2') { // for Layer 2 and Layer 3 slot is 8 bits long. $FrameLengthCoefficient = 144; $SlotLength = 1; } else { // layer 3 // for Layer 2 and Layer 3 slot is 8 bits long. $FrameLengthCoefficient = 72; $SlotLength = 1; } } // FrameLengthInBytes = ((Coefficient * BitRate) / SampleRate) + Padding if ($samplerate > 0) { $NewFramelength = ($FrameLengthCoefficient * $bitrate) / $samplerate; $NewFramelength = floor($NewFramelength / $SlotLength) * $SlotLength; // round to next-lower multiple of SlotLength (1 byte for Layer 2/3, 4 bytes for Layer I) if ($padding) { $NewFramelength += $SlotLength; } $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = (int) $NewFramelength; } } } return $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate]; }