Skip to content

Commit eaaaa87

Browse files
gordielachancegordielachance
authored andcommitted
moved round function
moved round function to setStart and setStop.
1 parent 2ea2938 commit eaaaa87

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/SrtParser/srtFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,8 @@ public function changeFPS($old_fps, $new_fps){
411411
$old_start = $this->subs[$keys[$i]]->getStart();
412412
$old_stop = $this->subs[$keys[$i]]->getStop();
413413

414-
$new_start = round($old_start * ($new_fps / $old_fps));
415-
$new_stop = round($old_stop * ($new_fps / $old_fps));
414+
$new_start = $old_start * ($new_fps / $old_fps);
415+
$new_stop = $old_stop * ($new_fps / $old_fps);
416416

417417
$this->subs[$keys[$i]]->setStart($new_start);
418418
$this->subs[$keys[$i]]->setStop($new_stop);

src/SrtParser/srtFileEntry.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function setStopTC($_stop){
218218
* @param int $_start
219219
*/
220220
public function setStart($_start){
221-
$this->start = $_start;
221+
$this->start = round($_start);
222222
$this->startTC = self::ms2tc($_start);
223223
}
224224

@@ -228,7 +228,7 @@ public function setStart($_start){
228228
* @param int $_stop
229229
*/
230230
public function setStop($_stop){
231-
$this->stop = $_stop;
231+
$this->stop = round($_stop);
232232
$this->stopTC = self::ms2tc($_stop);
233233
}
234234

@@ -349,8 +349,8 @@ public function scale($baseTime,$factor = 1){
349349
$new_start = $baseTime + (($this->getStart() - $baseTime) * $factor);
350350
$new_stop = $baseTime + (($this->getStop() - $baseTime) * $factor);
351351

352-
$this->setStart(round($new_start));
353-
$this->setStop(round($new_stop));
352+
$this->setStart($new_start);
353+
$this->setStop($new_stop);
354354

355355
return true;
356356
}
@@ -369,8 +369,8 @@ public function shift($time = 0){
369369
$start = $this->getStart();
370370
$stop = $this->getStop();
371371

372-
$this->setStart(round($start + $time));
373-
$this->setStop(round($stop + $time));
372+
$this->setStart($start + $time);
373+
$this->setStop($stop + $time);
374374

375375
return true;
376376

0 commit comments

Comments
 (0)