Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup

  • Loading branch information...
commit 24161cee0911fd851c1c50aec59ebaced6713deb 1 parent 79d8970
chocolateboy chocolateboy authored
Showing with 23 additions and 12 deletions.
  1. +23 −12 src/main/java/net/pms/encoders/MEncoderVideo.java
35 src/main/java/net/pms/encoders/MEncoderVideo.java
View
@@ -1220,6 +1220,18 @@ else if ("ac3".equals(audioType)) {
return encodeSettings;
}
+ /*
+ * collapse the multiple internal ways of saying "subtitles are disabled" into a single method
+ * which returns true if any of the following are true:
+ *
+ * 1) configuration.isMencoderDisableSubs()
+ * 2) params.sid == null
+ * 3) avisynth()
+ */
+ private boolean isDisableSubtitles(OutputParams params) {
+ return configuration.isMencoderDisableSubs() || (params.sid == null) || avisynth();
+ }
+
@Override
public ProcessWrapper launchTranscode(
String fileName,
@@ -1470,7 +1482,9 @@ public ProcessWrapper launchTranscode(
// Ditlew - WDTV Live (+ other byte asking clients), CBR. This probably ought to be placed in addMaximumBitrateConstraints(..)
int cbr_bitrate = params.mediaRenderer.getCBRVideoBitrate();
- String cbr_settings = (cbr_bitrate > 0) ? ":vrc_buf_size=5000:vrc_minrate=" + cbr_bitrate + ":vrc_maxrate=" + cbr_bitrate + ":vbitrate=" + ((cbr_bitrate > 16000) ? cbr_bitrate * 1000 : cbr_bitrate) : "";
+ String cbr_settings = (cbr_bitrate > 0) ?
+ ":vrc_buf_size=5000:vrc_minrate=" + cbr_bitrate + ":vrc_maxrate=" + cbr_bitrate + ":vbitrate=" + ((cbr_bitrate > 16000) ? cbr_bitrate * 1000 : cbr_bitrate) :
+ "";
String encodeSettings = "-lavcopts autoaspect=1:vcodec=" + vcodec +
(wmv ? ":acodec=wmav2:abitrate=448" : (cbr_settings + ":acodec=" + (configuration.isMencoderAc3Fixed() ? "ac3_fixed" : "ac3") +
":abitrate=" + CodecUtil.getAC3Bitrate(configuration, params.aid))) +
@@ -1520,7 +1534,7 @@ public ProcessWrapper launchTranscode(
StringBuilder sb = new StringBuilder();
// Set subtitles options
- if (!configuration.isMencoderDisableSubs() && !avisynth() && params.sid != null) {
+ if (!isDisableSubtitles(params)) {
int subtitleMargin = 0;
int userMargin = 0;
@@ -1530,6 +1544,7 @@ public ProcessWrapper launchTranscode(
configuration.isMencoderAss() && // GUI: enable subtitles formating
!foundNoassParam && // GUI: codec specific options
!dvd;
+
if (apply_ass_styling) {
sb.append("-ass ");
@@ -1559,7 +1574,7 @@ public ProcessWrapper launchTranscode(
String font = CodecUtil.getDefaultFontPath();
if (isNotBlank(font)) {
// Variable "font" contains a font path instead of a font name.
- // Does "-ass-force-style" support font paths? In tests on OSX
+ // Does "-ass-force-style" support font paths? In tests on OS X
// the font path is ignored (Outline, Shadow and MarginV are
// used, though) and the "-font" definition is used instead.
// See: https://github.com/ps3mediaserver/ps3mediaserver/pull/14
@@ -1592,7 +1607,7 @@ public ProcessWrapper launchTranscode(
sb.append("-ass-force-style MarginV=").append(subtitleMargin).append(" ");
}
- // MEncoder is not compiled with fontconfig on Mac OSX, therefore
+ // MEncoder is not compiled with fontconfig on Mac OS X, therefore
// use of the "-ass" option also requires the "-font" option.
if (Platform.isMac() && sb.toString().indexOf(" -font ") < 0) {
String font = CodecUtil.getDefaultFontPath();
@@ -1641,8 +1656,8 @@ public ProcessWrapper launchTranscode(
// Common subtitle options
- // MEncoder on Mac OSX is compiled without fontconfig support.
- // Appending the flag will break execution, so skip it on Mac OSX.
+ // MEncoder on Mac OS X is compiled without fontconfig support.
+ // Appending the flag will break execution, so skip it on Mac OS X.
if (!Platform.isMac()) {
// Use fontconfig if enabled
sb.append("-").append(configuration.isMencoderFontConfig() ? "" : "no").append("fontconfig ");
@@ -1750,13 +1765,9 @@ public ProcessWrapper launchTranscode(
*
* 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()
+ * subs" options if any of the internal conditions for disabling subtitles are met.
*/
- if (configuration.isMencoderDisableSubs() || (params.sid == null) || avisynth()) {
+ if (isDisableSubtitles(params)) {
// 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");
Please sign in to comment.
Something went wrong with that request. Please try again.