CC-3174 : showbuilder

bit rate & sample rate formatters
This commit is contained in:
Naomi Aro 2012-02-24 18:22:07 +01:00
parent 3ff7d1ac18
commit 4286de7b42
3 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,24 @@
<?php
class BitrateFormatter {
/**
* @string length
*/
private $_bitrate;
/*
* @param string $bitrate (bits per second)
*/
public function __construct($bitrate)
{
$this->_bitrate = $bitrate;
}
public function format()
{
$Kbps = bcdiv($this->_bitrate, 1000, 0);
return "{$Kbps} Kbps";
}
}

View file

@ -0,0 +1,24 @@
<?php
class SamplerateFormatter {
/**
* @string sample rate
*/
private $_samplerate;
/*
* @param string $samplerate Hz
*/
public function __construct($samplerate)
{
$this->_samplerate = $samplerate;
}
public function format()
{
$kHz = bcdiv($this->_samplerate, 1000, 1);
return "{$kHz} kHz";
}
}