Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More config migration. Eclipse launch config file so PMS gets 768m al…

…located to it (as per PMS.exe) - tcox
  • Loading branch information...
commit dad9aa115686ccd4c029c971f04c0c731377e946 1 parent 0312394
tcox2 tcox2 authored
15 ps3mediaserver/PMS.launch
View
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/ps3mediaserver/net/pms/PMS.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.pms.PMS"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ps3mediaserver"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx768M -Djava.net.preferIPv4Stack=true -Djava.encoding=UTF-8"/>
+</launchConfiguration>
130 ps3mediaserver/net/pms/PMS.java
View
@@ -124,19 +124,19 @@ public void setFolders(String folders) {
}
public void setTurbomode(boolean turbomode) {
- this.turbomode = turbomode;
+ configuration.setTurboModeEnabled(turbomode);
}
public void setAudiochannels(int audiochannels) {
- this.audiochannels = audiochannels;
+ configuration.setAudioChannelCount(audiochannels);
}
public void setAudiobitrate(int audiobitrate) {
- this.audiobitrate = audiobitrate;
+ configuration.setAudioBitrate(audiobitrate);
}
public void setThumbnails(boolean thumbnails) {
- this.thumbnails = thumbnails;
+ configuration.setThumbnailsEnabled(thumbnails);
}
public IFrame getFrame() {
@@ -195,14 +195,12 @@ public void setPs3found(boolean ps3found) {
return allPlayers;
}
- private boolean usecache;
-
public boolean isUsecache() {
- return usecache;
+ return configuration.getUseCache();
}
public void setUsecache(boolean usecache) {
- this.usecache = usecache;
+ configuration.setUseCache(usecache);
}
private boolean tsmuxer_forcefps;
@@ -215,13 +213,12 @@ public void setTsmuxer_forcefps(boolean tsmuxer_forcefps) {
this.tsmuxer_forcefps = tsmuxer_forcefps;
}
- private String maximumbitrate;
- public String getMaximumbitrate() {
- return maximumbitrate;
+ public int getMaximumbitrate() {
+ return configuration.getMaximumBitrate();
}
public void setMaximumbitrate(String maximumbitrate) {
- this.maximumbitrate = maximumbitrate;
+ configuration.setMaximumBitrate(maximumbitrate);
}
private boolean mencoder_intelligent_sync = true;
@@ -234,7 +231,6 @@ public void setMencoder_intelligent_sync(boolean mencoder_intelligent_sync) {
}
private ProxyServer proxyServer;
- private boolean turbomode;
private String charsetencoding = "ISO-8859-1"; //$NON-NLS-1$
public String getEncoding() {
@@ -242,7 +238,7 @@ public String getEncoding() {
}
public boolean isTurbomode() {
- return turbomode;
+ return configuration.isTurboModeEnabled();
}
public ProxyServer getProxy() {
@@ -320,14 +316,12 @@ public void setWebvideoengines(String webvideoengines) {
this.webvideoengines = webvideoengines;
}
*/
- private boolean hidevideosettings;
-
public boolean isHidevideosettings() {
- return hidevideosettings;
+ return configuration.getHideVideoSettings();
}
public void setHidevideosettings(boolean hidevideosettings) {
- this.hidevideosettings = hidevideosettings;
+ configuration.setHideVideoSettings(hidevideosettings);
}
private String alternativeffmpegPath;
@@ -381,14 +375,12 @@ public void setEnginesAsList(ArrayList<String> enginesAsList) {
return enginesAsList;
}
- private boolean minimized;
-
public boolean isMinimized() {
- return minimized;
+ return configuration.isMinimized();
}
public void setMinimized(boolean minimized) {
- this.minimized = minimized;
+ configuration.setMinimized(minimized);
}
public String getMPlayerPath() {
@@ -408,16 +400,13 @@ public String getTsmuxerPath() {
return configuration.getTsmuxerPath();
}
- private int audiochannels;
-
public int getAudiochannels() {
- return audiochannels;
+ return configuration.getAudioChannelCount();
}
- private int audiobitrate;
public int getAudiobitrate() {
- return audiobitrate;
+ return configuration.getAudioBitrate();
}
@@ -425,33 +414,27 @@ public boolean isWindows() {
return Platform.isWindows();
}
- boolean thumbnails;
-
public boolean isThumbnails() {
- return thumbnails;
+ return configuration.getThumbnailsEnabled();
}
- private boolean usesubs = true;
public void setUsesubs(boolean usesubs) {
- this.usesubs = usesubs;
+ configuration.setUseSubtitles(usesubs);
}
public boolean isUsesubs() {
- return usesubs;
+ return configuration.getUseSubtitles();
}
private int maxaudiobuffer;
private int minstreambuffer;
-
- private int nbcores;
-
public int getNbcores() {
- return nbcores;
+ return configuration.getNumberOfCpuCores();
}
public void setNbcores(int nbcores) {
- this.nbcores = nbcores;
+ configuration.setNumberOfCpuCores(nbcores);
}
private int proxy;
@@ -503,24 +486,20 @@ public void setMencoder_nooutofsync(boolean mencoder_nooutofsync) {
this.mencoder_nooutofsync = mencoder_nooutofsync;
}
- private boolean avisynth_convertfps = true;
-
public void setAvisynth_convertfps(boolean avisynth_convertfps) {
- this.avisynth_convertfps = avisynth_convertfps;
+ configuration.setAvisynthConvertFps(avisynth_convertfps);
}
public boolean isAvisynth_convertfps() {
- return avisynth_convertfps;
+ return configuration.getAvisynthConvertFps();
}
- private String avisynth_script;
-
public String getAvisynth_script() {
- return avisynth_script;
+ return configuration.getAvisynthScript();
}
- public void setAvisynth_script(String avisynth_script) {
- this.avisynth_script = avisynth_script;
+ public void setAvisynth_script(String value) {
+ configuration.setAvisynthScript(value);
}
private boolean isTrue(String s) {
@@ -546,16 +525,8 @@ private void loadConf() throws Exception {
minstreambuffer = Integer.parseInt(value.trim());
} else if (key.equals("maxaudiobuffer") && value.length() > 0) { //$NON-NLS-1$
maxaudiobuffer = Integer.parseInt(value.trim());
- } else if (key.equals("audiochannels") && value.length() > 0) { //$NON-NLS-1$
- audiochannels = Integer.parseInt(value.trim());
- } else if (key.equals("audiobitrate") && value.length() > 0) { //$NON-NLS-1$
- audiobitrate = Integer.parseInt(value.trim());
- } else if (key.equals("maximumbitrate") && value.length() > 0) { //$NON-NLS-1$
- maximumbitrate = value.trim();
} else if (key.equals("level") && value.length() > 0) { //$NON-NLS-1$
level = Integer.parseInt(value.trim());
- } else if (key.equals("nbcores") && value.length() > 0) { //$NON-NLS-1$
- nbcores = Integer.parseInt(value.trim());
} else if (key.equals("charsetencoding") && value.length() > 0) { //$NON-NLS-1$
charsetencoding = value.trim();
} else if (key.equals("ffmpeg") && value.length() > 0) { //$NON-NLS-1$
@@ -566,22 +537,10 @@ private void loadConf() throws Exception {
skiploopfilter = isTrue(value.trim());
} else if (key.equals("mencoder_nooutofsync") && value.length() > 0) { //$NON-NLS-1$
mencoder_nooutofsync = isTrue(value.trim());
- } else if (key.equals("minimized") && value.length() > 0) { //$NON-NLS-1$
- minimized = isTrue(value.trim());
- } else if (key.equals("thumbnails") && value.length() > 0) { //$NON-NLS-1$
- thumbnails = isTrue(value.trim());
- } else if (key.equals("hidevideosettings") && value.length() > 0) { //$NON-NLS-1$
- hidevideosettings = isTrue(value.trim());
} else if (key.equals("mencoder_intelligent_sync") && value.length() > 0) { //$NON-NLS-1$
mencoder_intelligent_sync = isTrue(value.trim());
- } else if (key.equals("usecache") && value.length() > 0) { //$NON-NLS-1$
- usecache = isTrue(value.trim());
} else if (key.equals("mencoder_encode") && value.length() > 0) { //$NON-NLS-1$
mencoder_main= value.trim();
- } else if (key.equals("autoloadsrt") && value.length() > 0) { //$NON-NLS-1$
- usesubs = isTrue(value.trim());
- } else if (key.equals("turbomode") && value.length() > 0) { //$NON-NLS-1$
- turbomode = isTrue(value.trim());
} else if (key.equals("engines") && value.length() > 0) { //$NON-NLS-1$
engines = value.trim();
if (!engines.equals("none")) { //$NON-NLS-1$
@@ -592,16 +551,12 @@ private void loadConf() throws Exception {
enginesAsList.add(engine);
}
}
- } else if (key.equals("avisynth_convertfps") && value.length() > 0) { //$NON-NLS-1$
- avisynth_convertfps = isTrue(value.trim());
} else if (key.equals("transcode_block_multiple_connections") && value.length() > 0) { //$NON-NLS-1$
transcode_block_multiple_connections = isTrue(value.trim());
} else if (key.equals("tsmuxer_forcefps") && value.length() > 0) { //$NON-NLS-1$
tsmuxer_forcefps = isTrue(value.trim());
} else if (key.equals("folders") && value.length() > 0) { //$NON-NLS-1$
folders = value.trim();
- } else if (key.equals("avisynth_script") && value.length() > 0) { //$NON-NLS-1$
- avisynth_script = value.trim();
} else if (key.equals("buffertype") && value.length() > 0) { //$NON-NLS-1$
filebuffer = value.trim().equals("file"); //$NON-NLS-1$
} else if (key.equals("alternativeffmpegpath") && value.length() > 0) { //$NON-NLS-1$
@@ -897,11 +852,12 @@ public boolean enable() {
}
});
- vf.addChild(new VirtualVideoAction(Messages.getString("PMS.6"), usesubs) { //$NON-NLS-1$
+ vf.addChild(new VirtualVideoAction(Messages.getString("PMS.6"), configuration.getUseSubtitles()) { //$NON-NLS-1$
public boolean enable() {
- usesubs = !usesubs;
-
- return usesubs;
+ boolean oldValue = configuration.getUseSubtitles();
+ boolean newValue = ! oldValue;
+ configuration.setUseSubtitles( newValue );
+ return newValue;
}
});
@@ -1243,25 +1199,25 @@ public void save() {
saveFile.println("hostname=" + (configuration.getServerHostname()!=null?configuration.getServerHostname():"")); //$NON-NLS-1$ //$NON-NLS-2$
saveFile.println("port=" + (configuration.getServerPort()!=5001?configuration.getServerPort():"")); //$NON-NLS-1$ //$NON-NLS-2$
saveFile.println("language=" + configuration.getLanguage()); //$NON-NLS-1$
- saveFile.println("thumbnails=" + getTrue(thumbnails)); //$NON-NLS-1$
+ saveFile.println("thumbnails=" + configuration.getThumbnailsEnabled()); //$NON-NLS-1$
saveFile.println("thumbnail_seek_pos=" + configuration.getThumbnailSeekPos()); //$NON-NLS-1$
- saveFile.println("nbcores=" + nbcores); //$NON-NLS-1$
- saveFile.println("turbomode=" + getTrue(turbomode)); //$NON-NLS-1$
- saveFile.println("minimized=" + getTrue(minimized)); //$NON-NLS-1$
- saveFile.println("hidevideosettings=" + getTrue(hidevideosettings)); //$NON-NLS-1$
- saveFile.println("usecache=" + getTrue(usecache)); //$NON-NLS-1$
+ saveFile.println("nbcores=" + configuration.getNumberOfCpuCores()); //$NON-NLS-1$
+ saveFile.println("turbomode=" + configuration.isTurboModeEnabled()); //$NON-NLS-1$
+ saveFile.println("minimized=" + configuration.isMinimized()); //$NON-NLS-1$
+ saveFile.println("hidevideosettings=" + configuration.getHideVideoSettings()); //$NON-NLS-1$
+ saveFile.println("usecache=" + configuration.getUseCache()); //$NON-NLS-1$
saveFile.println("charsetencoding=" + (charsetencoding!=null?charsetencoding:"")); //$NON-NLS-1$ //$NON-NLS-2$
saveFile.println("engines=" + engines); //$NON-NLS-1$
- saveFile.println("autoloadsrt=" + getTrue(usesubs)); //$NON-NLS-1$
- saveFile.println("avisynth_convertfps=" + getTrue(avisynth_convertfps)); //$NON-NLS-1$
- saveFile.println("avisynth_script=" + (avisynth_script!=null?avisynth_script:"")); //$NON-NLS-1$ //$NON-NLS-2$
+ saveFile.println("autoloadsrt=" + configuration.getUseSubtitles()); //$NON-NLS-1$
+ saveFile.println("avisynth_convertfps=" + configuration.getAvisynthConvertFps()); //$NON-NLS-1$
+ saveFile.println("avisynth_script=" + configuration.getAvisynthScript()); //$NON-NLS-1$ //$NON-NLS-2$
saveFile.println("transcode_block_multiple_connections=" + getTrue(transcode_block_multiple_connections)); //$NON-NLS-1$
saveFile.println("tsmuxer_forcefps=" + getTrue(tsmuxer_forcefps)); //$NON-NLS-1$
saveFile.println("tsmuxer_preremux_pcm=" + configuration.isTsmuxerPreremuxPcm()); //$NON-NLS-1$
saveFile.println("tsmuxer_preremux_ac3=" + configuration.isTsmuxerPreremuxAc3()); //$NON-NLS-1$
- saveFile.println("audiochannels=" + audiochannels); //$NON-NLS-1$
- saveFile.println("audiobitrate=" + audiobitrate); //$NON-NLS-1$
- saveFile.println("maximumbitrate=" + maximumbitrate); //$NON-NLS-1$
+ saveFile.println("audiochannels=" + configuration.getAudioChannelCount()); //$NON-NLS-1$
+ saveFile.println("audiobitrate=" + configuration.getAudioBitrate()); //$NON-NLS-1$
+ saveFile.println("maximumbitrate=" + configuration.getMaximumBitrate()); //$NON-NLS-1$
saveFile.println("skiploopfilter=" + getTrue(skiploopfilter)); //$NON-NLS-1$
saveFile.println("enable_archive_browsing=" + configuration.isArchiveBrowsing()); //$NON-NLS-1$
saveFile.println("mencoder_fontconfig=" + configuration.isMencoderFontConfig()); //$NON-NLS-1$
115 ps3mediaserver/net/pms/configuration/PmsConfiguration.java
View
@@ -49,9 +49,32 @@
private static final String KEY_MENCODER_SCALEX = "mencoder_scalex";
private static final String KEY_MENCODER_SCALEY = "mencoder_scaley";
private static final String KEY_OPEN_ARCHIVES = "enable_archive_browsing";
+ private static final String KEY_AUDIO_CHANNEL_COUNT = "audiochannels";
+ private static final String KEY_MAX_BITRATE = "maximumbitrate";
+ private static final String KEY_THUMBNAILS_ENABLED = "thumbnails";
+ private static final String KEY_NUMBER_OF_CPU_CORES = "nbcores";
+ private static final String KEY_TURBO_MODE_ENABLED = "turbomode";
+ private static final String KEY_MINIMIZED = "minimized";
+ private static final String KEY_USE_SUBTITLES = "autoloadsrt";
+ private static final String KEY_HIDE_VIDEO_SETTINGS = "hidevideosettings";
+ private static final String KEY_USE_CACHE = "usecache";
+ private static final String KEY_AVISYNTH_CONVERT_FPS = "avisynth_convertfps";
+ private static final String KEY_AVISYNTH_SCRIPT = "avisynth_script";
private static final int DEFAULT_SERVER_PORT = 5001;
private static final int DEFAULT_PROXY_SERVER_PORT = -1;
+ private static final int UNLIMITED_BITRATE = 0;
+
+ private static final String DEFAULT_AVI_SYNTH_SCRIPT =
+ "#AviSynth script is now fully customisable !\n"
+ + "#You must use the following variables (\"clip\" being the avisynth variable of the movie):\n"
+ + "#<movie>: insert the complete DirectShowSource instruction [ clip=DirectShowSource(movie, convertfps) ]"
+ + "#<sub>: insert the complete TextSub/VobSub instruction if there's any detected srt/sub/idx/ass subtitle file"
+ + "#<moviefilename>: variable of the movie filename, if you want to do all this by yourself"
+ + "#Be careful, the custom script MUST return the clip object"
+ + "<movie>"
+ + "<sub>"
+ + "return clip";
private static final int MAX_MAX_MEMORY_BUFFER_SIZE = 630;
@@ -449,4 +472,96 @@ public int getMencoderScaleY() {
public void setMencoderScaleY(int value) {
configuration.setProperty(KEY_MENCODER_SCALEY, value);
}
+
+ public int getAudioChannelCount() {
+ return getInt(KEY_AUDIO_CHANNEL_COUNT, 6);
+ }
+
+ public void setAudioChannelCount(int value) {
+ configuration.setProperty(KEY_AUDIO_CHANNEL_COUNT, value);
+ }
+
+ public void setAudioBitrate(int value) {
+ configuration.setProperty(KEY_AUDIO_BITRATE, value);
+ }
+
+ public int getMaximumBitrate() {
+ return getInt(KEY_MAX_BITRATE, UNLIMITED_BITRATE);
+ }
+
+ public void setMaximumBitrate(String value) {
+ configuration.setProperty(KEY_MAX_BITRATE, value);
+ }
+
+ public boolean getThumbnailsEnabled() {
+ return getBoolean(KEY_THUMBNAILS_ENABLED, true);
+ }
+
+ public void setThumbnailsEnabled(boolean value) {
+ configuration.setProperty(KEY_THUMBNAILS_ENABLED, value);
+ }
+
+ public int getNumberOfCpuCores() {
+ return getInt(KEY_NUMBER_OF_CPU_CORES, 1);
+ }
+
+ public void setNumberOfCpuCores(int value) {
+ configuration.setProperty(KEY_NUMBER_OF_CPU_CORES, value);
+ }
+
+ public boolean isTurboModeEnabled() {
+ return getBoolean(KEY_TURBO_MODE_ENABLED, false);
+ }
+
+ public void setTurboModeEnabled(boolean value) {
+ configuration.setProperty(KEY_TURBO_MODE_ENABLED, value);
+ }
+
+ public boolean isMinimized() {
+ return getBoolean(KEY_MINIMIZED, false);
+ }
+
+ public void setMinimized(boolean value) {
+ configuration.setProperty(KEY_MINIMIZED, value);
+ }
+
+ public boolean getUseSubtitles() {
+ return getBoolean(KEY_USE_SUBTITLES, true);
+ }
+
+ public void setUseSubtitles(boolean value) {
+ configuration.setProperty(KEY_USE_SUBTITLES, value);
+ }
+
+ public boolean getHideVideoSettings() {
+ return getBoolean(KEY_HIDE_VIDEO_SETTINGS, false);
+ }
+
+ public void setHideVideoSettings(boolean value) {
+ configuration.setProperty(KEY_HIDE_VIDEO_SETTINGS, value);
+ }
+
+ public boolean getUseCache() {
+ return getBoolean(KEY_USE_CACHE, false);
+ }
+
+ public void setUseCache(boolean value) {
+ configuration.setProperty(KEY_USE_CACHE, value);
+ }
+
+ public void setAvisynthConvertFps(boolean value) {
+ configuration.setProperty(KEY_AVISYNTH_CONVERT_FPS, value);
+ }
+
+ public boolean getAvisynthConvertFps() {
+ return getBoolean(KEY_AVISYNTH_CONVERT_FPS, true);
+ }
+
+ public String getAvisynthScript() {
+ return getString(KEY_AVISYNTH_SCRIPT, DEFAULT_AVI_SYNTH_SCRIPT);
+ }
+
+ public void setAvisynthScript(String value) {
+ configuration.setProperty(KEY_AVISYNTH_SCRIPT, value);
+ }
}
2  ps3mediaserver/net/pms/encoders/MEncoderVideo.java
View
@@ -786,7 +786,7 @@ public ProcessWrapper launchTranscode(String fileName, DLNAMediaInfo media, Outp
//}
if (PMS.get().getMencoderMainSettings() != null) {
String encodeSettings = "-lavcopts autoaspect=1:vcodec=mpeg2video:acodec=ac3:abitrate=" + PMS.get().getAudiobitrate() + ":threads=" + PMS.get().getNbcores() + ":" + PMS.get().getMencoderMainSettings(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String m = PMS.get().getMaximumbitrate();
+ String m = "" + PMS.get().getMaximumbitrate();
int bufs = 0;
if (m.contains("(") && m.contains(")")) { //$NON-NLS-1$ //$NON-NLS-2$
bufs = Integer.parseInt(m.substring(m.indexOf("(")+1, m.indexOf(")"))); //$NON-NLS-1$ //$NON-NLS-2$
Please sign in to comment.
Something went wrong with that request. Please try again.