Audio Clip (#314)
* add missing headers * add audio clip filter and improve timecode * php 5.4 :( * prevent audio from being reencoded * php 5.x: Really? * fix tests... I need to concentrate...
This commit is contained in:
parent
ce99075059
commit
ecd50cd5f1
6 changed files with 201 additions and 0 deletions
|
|
@ -89,4 +89,32 @@ class TimeCode
|
|||
|
||||
return new static($hours, $minutes, $seconds, $frames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this timecode in seconds
|
||||
* @return int
|
||||
*/
|
||||
public function toSeconds() {
|
||||
$seconds = 0;
|
||||
|
||||
$seconds += $this->hours * 60 * 60;
|
||||
$seconds += $this->minutes * 60;
|
||||
$seconds += $this->seconds;
|
||||
|
||||
// TODO: Handle frames?
|
||||
|
||||
return (int) $seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function wether `$timecode` is after this one
|
||||
*
|
||||
* @param TimeCode $timecode The Timecode to compare
|
||||
* @return bool
|
||||
*/
|
||||
public function isAfter(TimeCode $timecode) {
|
||||
// convert everything to seconds and compare
|
||||
return ($this->toSeconds() > $timecode->toSeconds());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue