Refactor MediaInfo

This commit is contained in:
Reinhard Pointner 2016-08-10 04:36:38 +08:00
parent 0ef31fc19d
commit c6514b817a
2 changed files with 2 additions and 3 deletions

View File

@ -1024,7 +1024,7 @@ public class MediaBindingBean {
mediaInfo = sharedMediaInfoObjects.computeIfAbsent(inferredMediaFile, f -> { mediaInfo = sharedMediaInfoObjects.computeIfAbsent(inferredMediaFile, f -> {
try { try {
return new MediaInfo().open(f); return new MediaInfo().open(f);
} catch (Exception e) { } catch (IOException e) {
throw new MediaInfoException(e.getMessage()); throw new MediaInfoException(e.getMessage());
} }
}); });

View File

@ -318,8 +318,7 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
sub.setSubContent(readFile(subtitleFile)); sub.setSubContent(readFile(subtitleFile));
} }
try (MediaInfo mi = new MediaInfo()) { try (MediaInfo mi = new MediaInfo().open(videoFile)) {
mi.open(videoFile);
sub.setMovieFPS(mi.get(StreamKind.Video, 0, "FrameRate")); sub.setMovieFPS(mi.get(StreamKind.Video, 0, "FrameRate"));
sub.setMovieTimeMS(mi.get(StreamKind.General, 0, "Duration")); sub.setMovieTimeMS(mi.get(StreamKind.General, 0, "Duration"));
} catch (Throwable e) { } catch (Throwable e) {