Skip to content

Commit 0e8d173

Browse files
Eukliosbramp
authored andcommitted
Add additional N/A checks to FFmpegUtils
1 parent b5a564c commit 0e8d173

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/net/bramp/ffmpeg/FFmpegUtils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,15 @@ public static String toTimecode(long duration, TimeUnit units) {
7474
* format "hour:minute:second", where second can be a decimal number.
7575
*
7676
* @param time the timecode to parse.
77-
* @return the number of nanoseconds.
77+
* @return the number of nanoseconds or -1 if time is 'N/A'
7878
*/
7979
public static long fromTimecode(String time) {
8080
checkNotEmpty(time, "time must not be empty string");
81+
82+
if (time.equals("N/A")) {
83+
return -1;
84+
}
85+
8186
Matcher m = TIME_REGEX.matcher(time);
8287
if (!m.find()) {
8388
throw new IllegalArgumentException("invalid time '" + time + "'");
@@ -97,6 +102,8 @@ public static long fromTimecode(String time) {
97102
* @return the bitrate in bits per second or -1 if bitrate is 'N/A'
98103
*/
99104
public static long parseBitrate(String bitrate) {
105+
checkNotEmpty(bitrate, "bitrate must not be empty string");
106+
100107
if ("N/A".equals(bitrate)) {
101108
return -1;
102109
}

0 commit comments

Comments
 (0)