-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve checking of audio clip times in Media Overlays
- Integrate code from the DAISY Consortium to parse and compare SMIL clock values - Update check: move the clipBegin/clipEnd equality test into Java code so it works even with different SMIL clock syntaxes - New check: clipBegin is not temporally after clipEnd - Add and update associated tests
- Loading branch information
1 parent
794b7ce
commit 11b652e
Showing
11 changed files
with
587 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* This class was originally created by the DAISY Consortium | ||
* for another project, licensed under LGPL v2.1. | ||
* It is now integrated in EPUBCheck and relicensed under | ||
* EPUBCheck’s primary license. | ||
* See https://github.com/w3c/epubcheck/pull/1173 | ||
*/ | ||
package com.adobe.epubcheck.overlay; | ||
|
||
public class ClipTime { | ||
|
||
private final Double timeInMs; | ||
|
||
public ClipTime() { | ||
timeInMs = null; | ||
} | ||
|
||
public ClipTime(double timeInMs) { | ||
this.timeInMs = new Double(timeInMs); | ||
} | ||
|
||
public double getTimeInMs() { | ||
if(notSet()) { | ||
return 0; | ||
} else { | ||
return timeInMs; | ||
} | ||
} | ||
|
||
public ClipTime roundedToMilliSeconds() { | ||
return new ClipTime(Math.round(this.getTimeInMs())); | ||
} | ||
|
||
public ClipTime floorToMilliSeconds() { | ||
return new ClipTime(Math.floor(this.getTimeInMs())); | ||
} | ||
|
||
public boolean notSet() { | ||
if(this.timeInMs == null) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
public ClipTime add(ClipTime timeToAdd) { | ||
return new ClipTime(this.getTimeInMs() + timeToAdd.getTimeInMs()); | ||
} | ||
|
||
public ClipTime subtract(ClipTime timeToSubtract) { | ||
return new ClipTime(this.getTimeInMs() - timeToSubtract.getTimeInMs()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.