This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed memory buffer handling and made buffer display in megabytes ins…

…tead of bytes (by SharkHunter)
  • Loading branch information...
Happy-Neko committed Jun 22, 2012
1 parent 04ea550 commit b5dd407bacb237a607bbfeca399a6c796dff90b8
@@ -54,7 +54,7 @@
* file.
*/
public class PmsConfiguration {
- private static final Logger logger = LoggerFactory.getLogger(PmsConfiguration.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(PmsConfiguration.class);
private static final int DEFAULT_PROXY_SERVER_PORT = -1;
private static final int DEFAULT_SERVER_PORT = 5001;
@@ -71,6 +71,9 @@
private static final String KEY_AUDIO_THUMBNAILS_METHOD = "audio_thumbnails_method";
private static final String KEY_AUTO_UPDATE = "auto_update";
private static final String KEY_AVISYNTH_CONVERT_FPS = "avisynth_convertfps";
+ private static final String KEY_AVISYNTH_INTERFRAME = "avisynth_interframe";
+ private static final String KEY_AVISYNTH_INTERFRAME_GPU = "avisynth_interframegpu";
+ private static final String KEY_AVISYNTH_MULTITHREADING = "avisynth_multithreading";

This comment has been minimized.

Show comment Hide comment
@taconaut

taconaut Jun 22, 2012

Member

Are we going to use those?

@taconaut

taconaut Jun 22, 2012

Member

Are we going to use those?

This comment has been minimized.

Show comment Hide comment
@Happy-Neko

Happy-Neko Jun 22, 2012

Member

It depends on whether we'll support new AviSynth features (interframe?) from SubJunk's fork with windows build.
Personally I don know much about AviSynth and have no interest in windows-only functionality.

@Happy-Neko

Happy-Neko Jun 22, 2012

Member

It depends on whether we'll support new AviSynth features (interframe?) from SubJunk's fork with windows build.
Personally I don know much about AviSynth and have no interest in windows-only functionality.

This comment has been minimized.

Show comment Hide comment
@taconaut

taconaut Jun 22, 2012

Member

Same here. The picture looks great anyway, don't need avi synth to squeeze in frames.
I suggest we remove them from the configuration (along with folder limit)

@taconaut

taconaut Jun 22, 2012

Member

Same here. The picture looks great anyway, don't need avi synth to squeeze in frames.
I suggest we remove them from the configuration (along with folder limit)

This comment has been minimized.

Show comment Hide comment
@Happy-Neko

Happy-Neko Jun 22, 2012

Member

Yeah, since almost all modern TVs have some sort of frame interpolation features (MotionFlow etc) the benefits from this AvySynth filter is not clear. Not to mention higher CPU utilization and wasted bitrate for additional frames.

But maybe someone from more windows-centric members has other opinion.

@Happy-Neko

Happy-Neko Jun 22, 2012

Member

Yeah, since almost all modern TVs have some sort of frame interpolation features (MotionFlow etc) the benefits from this AvySynth filter is not clear. Not to mention higher CPU utilization and wasted bitrate for additional frames.

But maybe someone from more windows-centric members has other opinion.

This comment has been minimized.

Show comment Hide comment
@taconaut

taconaut Jun 22, 2012

Member

Windows is underrepresented ;) I don't expect anyone wanting to maintain is.

@taconaut

taconaut Jun 22, 2012

Member

Windows is underrepresented ;) I don't expect anyone wanting to maintain is.

private static final String KEY_AVISYNTH_SCRIPT = "avisynth_script";
private static final String KEY_BUFFER_TYPE = "buffertype";
private static final String KEY_CHAPTER_INTERVAL = "chapter_interval";
@@ -85,6 +88,7 @@
private static final String KEY_FFMPEG_SETTINGS = "ffmpeg";
private static final String KEY_FIX_25FPS_AV_MISMATCH = "fix_25fps_av_mismatch";
private static final String KEY_FORCETRANSCODE = "forcetranscode";
+ private static final String KEY_FOLDER_LIMIT="folder_limit";
private static final String KEY_HIDE_EMPTY_FOLDERS = "hide_empty_folders";
private static final String KEY_HIDE_ENGINENAMES = "hide_enginenames";
private static final String KEY_HIDE_EXTENSIONS = "hide_extensions";
@@ -177,6 +181,7 @@
private static final String KEY_UUID = "uuid";
private static final String KEY_VIDEOTRANSCODE_START_DELAY = "key_videotranscode_start_delay";
private static final String KEY_VIRTUAL_FOLDERS = "vfolders";
+ private static final String KEY_BUFFER_MAX = "buffer_max";
// the name of the subdirectory under which PMS config files are stored for this build (default: PMS).
// see Build for more details
@@ -187,7 +192,9 @@
private static String DEFAULT_AVI_SYNTH_SCRIPT;
private static final String BUFFER_TYPE_FILE = "file";
- private static final int MAX_MAX_MEMORY_BUFFER_SIZE = 400;
+ private static final int MAX_MAX_MEMORY_DEFAULT_SIZE = 400;
+ private static final int BUFFER_MEMORY_FACTOR = 368;
+ private static int MAX_MAX_MEMORY_BUFFER_SIZE = MAX_MAX_MEMORY_DEFAULT_SIZE;
private static final char LIST_SEPARATOR = ',';
private static final String KEY_FOLDERS = "folders";
private final PropertiesConfiguration configuration;
@@ -243,7 +250,7 @@ PMS_PROFILE is read (in this order) from the property pms.profile.path or the
under multiple profiles without fiddling with environment variables, properties or
command-line arguments.
- 1) if PMS_PROFILE is not set, PMS.conf is located in:
+ 1) if PMS_PROFILE is not set, PMS.conf is located in:
Windows: %ALLUSERSPROFILE%\$build
Mac OS X: $HOME/Library/Application Support/$build
@@ -351,8 +358,8 @@ it is used as the profile directory and the profile is located there under the d
* Default constructor that will attempt to load the PMS configuration file
* from the profile path.
*
- * @throws ConfigurationException
- * @throws IOException
+ * @throws org.apache.commons.configuration.ConfigurationException
+ * @throws java.io.IOException
*/
public PmsConfiguration() throws ConfigurationException, IOException {
this(true);
@@ -364,8 +371,8 @@ public PmsConfiguration() throws ConfigurationException, IOException {
* @param loadFile Set to true to attempt to load the PMS configuration
* file from the profile path. Set to false to skip
* loading.
- * @throws ConfigurationException
- * @throws IOException
+ * @throws org.apache.commons.configuration.ConfigurationException
+ * @throws java.io.IOException
*/
public PmsConfiguration(boolean loadFile) throws ConfigurationException, IOException {
configuration = new PropertiesConfiguration();
@@ -381,7 +388,7 @@ public PmsConfiguration(boolean loadFile) throws ConfigurationException, IOExcep
if (pmsSkelConfFile.isFile() && pmsSkelConfFile.canRead()) {
// load defaults from skel file, save them later to PROFILE_PATH
configuration.load(pmsSkelConfFile);
- logger.info("Default configuration loaded from " + SKEL_PROFILE_PATH);
+ LOGGER.info("Default configuration loaded from " + SKEL_PROFILE_PATH);
}
}
}
@@ -391,17 +398,21 @@ public PmsConfiguration(boolean loadFile) throws ConfigurationException, IOExcep
tempFolder = new TempFolder(getString(KEY_TEMP_FOLDER_PATH, null));
programPaths = createProgramPathsChain(configuration);
Locale.setDefault(new Locale(getLanguage()));
- // set DEFAULT_AVI_SYNTH_SCRIPT properly according to language
+
+ // Set DEFAULT_AVI_SYNTH_SCRIPT according to language
DEFAULT_AVI_SYNTH_SCRIPT =
- Messages.getString("MEncoderAviSynth.4")
- + Messages.getString("MEncoderAviSynth.5")
- + Messages.getString("MEncoderAviSynth.6")
- + Messages.getString("MEncoderAviSynth.7")
- + Messages.getString("MEncoderAviSynth.8")
- + Messages.getString("MEncoderAviSynth.9")
- + Messages.getString("MEncoderAviSynth.10")
- + Messages.getString("MEncoderAviSynth.11")
- + Messages.getString("MEncoderAviSynth.12");

This comment has been minimized.

Show comment Hide comment
@Raptor399

Raptor399 Nov 22, 2012

Member

Could it be that the removal of this line (and the corresponding label) cause problems reported on the forum?

@Raptor399

Raptor399 Nov 22, 2012

Member

Could it be that the removal of this line (and the corresponding label) cause problems reported on the forum?

+ Messages.getString("MEncoderAviSynth.4") +
+ Messages.getString("MEncoderAviSynth.5") +
+ Messages.getString("MEncoderAviSynth.6") +
+ Messages.getString("MEncoderAviSynth.7") +
+ Messages.getString("MEncoderAviSynth.8") +
+ Messages.getString("MEncoderAviSynth.10") +
+ Messages.getString("MEncoderAviSynth.11");
+
+ long usableMemory = (Runtime.getRuntime().maxMemory() / 1048576) - BUFFER_MEMORY_FACTOR;
+ if (usableMemory > MAX_MAX_MEMORY_DEFAULT_SIZE) {
+ MAX_MAX_MEMORY_BUFFER_SIZE = (int) usableMemory;
+ }
}
/**
@@ -1023,7 +1034,7 @@ public String getMencoderSubCp() {
* @return True if fontconfig should be used, false otherwise.
*/
public boolean isMencoderFontConfig() {
- return getBoolean(KEY_MENCODER_FONT_CONFIG, false);
+ return getBoolean(KEY_MENCODER_FONT_CONFIG, true);
}
/**
@@ -1518,7 +1529,7 @@ public void setUseSubtitles(boolean value) {
* @return True if PMS should hide the folder, false othewise.
*/
public boolean getHideVideoSettings() {
- return getBoolean(KEY_HIDE_VIDEO_SETTINGS, false);
+ return getBoolean(KEY_HIDE_VIDEO_SETTINGS, true);
}
/**
@@ -1567,7 +1578,31 @@ public void setAvisynthConvertFps(boolean value) {
* @return True if PMS should pass the flag.
*/
public boolean getAvisynthConvertFps() {
- return getBoolean(KEY_AVISYNTH_CONVERT_FPS, true);
+ return getBoolean(KEY_AVISYNTH_CONVERT_FPS, false);
+ }
+
+ public void setAvisynthInterFrame(boolean value) {
+ configuration.setProperty(KEY_AVISYNTH_INTERFRAME, value);
+ }
+
+ public boolean getAvisynthInterFrame() {
+ return getBoolean(KEY_AVISYNTH_INTERFRAME, false);
+ }
+
+ public void setAvisynthInterFrameGPU(boolean value) {
+ configuration.setProperty(KEY_AVISYNTH_INTERFRAME_GPU, value);
+ }
+
+ public boolean getAvisynthInterFrameGPU() {
+ return getBoolean(KEY_AVISYNTH_INTERFRAME_GPU, false);
+ }
+
+ public void setAvisynthMultiThreading(boolean value) {
+ configuration.setProperty(KEY_AVISYNTH_MULTITHREADING, value);
+ }
+
+ public boolean getAvisynthMultiThreading() {
+ return getBoolean(KEY_AVISYNTH_MULTITHREADING, false);
}
/**
@@ -1777,7 +1812,7 @@ private static String listToString(List<String> enginesAsList) {
for (String engineId : input) {
if (engineId.startsWith("avs") && !registry.isAvis() && Platform.isWindows()) {
if (!avsHackLogged) {
- logger.info("AviSynth is not installed. You cannot use " + engineId + " as a transcoding engine.");
+ LOGGER.info("AviSynth is not installed. You cannot use " + engineId + " as a transcoding engine.");
avsHackLogged = true;
}
toBeRemoved.add(engineId);
@@ -1791,7 +1826,7 @@ private static String listToString(List<String> enginesAsList) {
public void save() throws ConfigurationException {
configuration.save();
- logger.info("Configuration saved to: " + PROFILE_PATH);
+ LOGGER.info("Configuration saved to: " + PROFILE_PATH);
}
public String getFolders() {
@@ -2209,7 +2244,7 @@ public String getProfileName() {
try {
HOSTNAME = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
- logger.info("Can't determine hostname");
+ LOGGER.info("Can't determine hostname");
HOSTNAME = "unknown host";
}
}
@@ -2248,4 +2283,12 @@ public void addConfigurationListener(ConfigurationListener l) {
public void removeConfigurationListener(ConfigurationListener l) {
configuration.removeConfigurationListener(l);
}
+
+ public boolean getFolderLimit() {
+ return getBoolean(KEY_FOLDER_LIMIT, false);
+ }
+
+ public boolean initBufferMax() {
+ return getBoolean(KEY_BUFFER_MAX, false);
+ }
}
Oops, something went wrong.

0 comments on commit b5dd407

Please sign in to comment.