CC-3174 : showbuilder
bit rate & sample rate formatters
This commit is contained in:
parent
3ff7d1ac18
commit
4286de7b42
3 changed files with 58 additions and 0 deletions
|
@ -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";
|
||||
}
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue