getid3_mp3::ClosestStandardMP3Bitrate() –

You appear to be a bot. Output may be restricted

Description

Usage

$int|float|string = getid3_mp3::ClosestStandardMP3Bitrate( $bit_rate );

Parameters

$bit_rate
( float|int ) required

Returns

int|float|string

Source

File name: wordpress/wp-includes/ID3/module.audio.mp3.php
Lines:

1 to 19 of 19
  public static function ClosestStandardMP3Bitrate($bit_rate) {
    static $standard_bit_rates = array (320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000);
    static $bit_rate_table = array (0=>'-');
    $round_bit_rate = intval(round($bit_rate, -3));
    if (!isset($bit_rate_table[$round_bit_rate])) {
      if ($round_bit_rate > max($standard_bit_rates)) {
        $bit_rate_table[$round_bit_rate] = round($bit_rate, 2 - strlen($bit_rate));
      } else {
        $bit_rate_table[$round_bit_rate] = max($standard_bit_rates);
        foreach ($standard_bit_rates as $standard_bit_rate) {
          if ($round_bit_rate >= $standard_bit_rate + (($bit_rate_table[$round_bit_rate] - $standard_bit_rate) / 2)) {
            break;
          }
          $bit_rate_table[$round_bit_rate] = $standard_bit_rate;
        }
      }
    }
    return $bit_rate_table[$round_bit_rate];
  }
 

 View on GitHub View on Trac