Skip to content
Browse files

subtitles: cleanup + ensure external subs aren't automatically loaded…

… when subs are disabled
  • Loading branch information...
1 parent 9ec4d24 commit 79d8970d503607dc01c51db44d9efa51ae81c6f5 @chocolateboy chocolateboy committed
Showing with 36 additions and 33 deletions.
  1. +35 −32 src/main/java/net/pms/encoders/MEncoderVideo.java
  2. +1 −1 src/main/java/net/pms/encoders/Player.java
View
67 src/main/java/net/pms/encoders/MEncoderVideo.java
@@ -1746,19 +1746,44 @@ public ProcessWrapper launchTranscode(
}
/*
- * TODO: Move the following block up with the rest of the
- * subtitle stuff
+ * handle subtitles
+ *
+ * try to reconcile the fact that the handling of "Definitely disable subtitles" is spread out
+ * over net.pms.encoders.Player.setAudioAndSubs and here by setting both of MEncoder's "disable
+ * subs" options if any of the criteria for disabling subtitles are met:
+ *
+ * 1) configuration.isMencoderDisableSubs()
+ * 2) params.sid == null
+ * 3) avisynth()
*/
-
- // handle embedded subtitles
- if ((params.sid != null) && params.sid.isEmbedded()) { // note: isEmbedded() and isExternal() are mutually exclusive
- if (configuration.isMencoderDisableSubs()) {
- // MKV: in some circumstances, MEncoder automatically selects an internal sub unless we explicitly disable (internal) subtitles
- // http://www.ps3mediaserver.org/forum/viewtopic.php?f=14&t=15891
- cmdList.add("-nosub");
- } else {
+ if (configuration.isMencoderDisableSubs() || (params.sid == null) || avisynth()) {
+ // MKV: in some circumstances, MEncoder automatically selects an internal sub unless we explicitly disable (internal) subtitles
+ // http://www.ps3mediaserver.org/forum/viewtopic.php?f=14&t=15891
+ cmdList.add("-nosub");
+ // make sure external subs are not automatically loaded
+ cmdList.add("-noautosub");
+ } else {
+ // note: isEmbedded() and isExternal() are mutually exclusive
+ if (params.sid.isEmbedded()) { // internal (embedded) subs
cmdList.add("-sid");
cmdList.add("" + params.sid.getId());
+ } else { // external subtitles
+ assert params.sid.isExternal(); // confirm the mutual exclusion
+
+ if (params.sid.getType() == SubtitleType.VOBSUB) {
+ cmdList.add("-vobsub");
+ cmdList.add(externalSubtitlesFileName.substring(0, externalSubtitlesFileName.length() - 4));
+ cmdList.add("-slang");
+ cmdList.add("" + params.sid.getLang());
+ } else {
+ cmdList.add("-sub");
+ cmdList.add(externalSubtitlesFileName.replace(",", "\\,")); // Commas in MEncoder separate multiple subtitle files
+
+ if (params.sid.isExternalFileUtf()) {
+ // append -utf8 option for UTF-8 external subtitles
+ cmdList.add("-utf8");
+ }
+ }
}
}
@@ -1782,28 +1807,6 @@ public ProcessWrapper launchTranscode(
cmdList.add("-ofps");
cmdList.add(ofps);
- /*
- * TODO: Move the following block up with the rest of the
- * subtitle stuff
- */
- // external subtitles file
- if (!configuration.isMencoderDisableSubs() && !avisynth() && params.sid != null && params.sid.isExternal()) {
- if (params.sid.getType() == SubtitleType.VOBSUB) {
- cmdList.add("-vobsub");
- cmdList.add(externalSubtitlesFileName.substring(0, externalSubtitlesFileName.length() - 4));
- cmdList.add("-slang");
- cmdList.add("" + params.sid.getLang());
- } else {
- cmdList.add("-sub");
- cmdList.add(externalSubtitlesFileName.replace(",", "\\,")); // Commas in MEncoder separate multiple subtitle files
-
- if (params.sid.isExternalFileUtf()) {
- // append -utf8 option for UTF-8 external subtitles
- cmdList.add("-utf8");
- }
- }
- }
-
if (fileName.toLowerCase().endsWith(".evo")) {
cmdList.add("-psprobe");
cmdList.add("10000");
View
2 src/main/java/net/pms/encoders/Player.java
@@ -284,7 +284,7 @@ public void setAudioAndSubs(String fileName, DLNAMediaInfo media, OutputParams p
boolean forcedSubsFound = false;
// Priority to external subtitles
for (DLNAMediaSubtitle sub : media.getSubtitleTracksList()) {
- if (matchedSub !=null && matchedSub.getLang() !=null && matchedSub.getLang().equals("off")) {
+ if (matchedSub != null && matchedSub.getLang() != null && matchedSub.getLang().equals("off")) {
StringTokenizer st = new StringTokenizer(configuration.getMencoderForcedSubTags(), ",");
while (st != null && sub.getFlavor() != null && st.hasMoreTokens()) {

0 comments on commit 79d8970

Please sign in to comment.
Something went wrong with that request. Please try again.