[vlma-devel] commit: More configurable variables. (Adrien Grand )
git version control
git at videolan.org
Thu May 1 19:46:22 CEST 2008
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Thu May 1 19:47:19 2008 +0200| [92700898b520d3be38afc5fe4c0edeaaa95b8cef]
More configurable variables.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=92700898b520d3be38afc5fe4c0edeaaa95b8cef
---
.../videolan/vlma/common/media/FilesChannel.java | 9 +++++--
.../org/videolan/vlma/common/media/SatChannel.java | 17 +++++++++-----
.../org/videolan/vlma/common/media/TNTChannel.java | 9 +++++--
.../org/videolan/vlma/common/order/Command.java | 5 ++-
.../java/org/videolan/vlma/common/order/Order.java | 23 +++++++++++--------
.../videolan/vlma/common/program/ProgramImpl.java | 2 +-
6 files changed, 40 insertions(+), 25 deletions(-)
diff --git a/core/src/main/java/org/videolan/vlma/common/media/FilesChannel.java b/core/src/main/java/org/videolan/vlma/common/media/FilesChannel.java
index 3e0cf23..0e4f6cf 100644
--- a/core/src/main/java/org/videolan/vlma/common/media/FilesChannel.java
+++ b/core/src/main/java/org/videolan/vlma/common/media/FilesChannel.java
@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import org.videolan.vlma.common.VLMa;
import org.videolan.vlma.common.program.Program;
import org.videolan.vlma.common.server.Server;
@@ -36,7 +37,7 @@ import org.videolan.vlma.common.server.Server;
*/
public class FilesChannel extends AbstractMedia {
- public static final String SAP_GROUP = "Files";
+ public static final String DEFAULT_FILES_SAP_GROUP = "Files";
private static final Logger logger = Logger.getLogger(FilesChannel.class);
@@ -76,8 +77,10 @@ public class FilesChannel extends AbstractMedia {
*
*/
protected void updateSapGroup() {
- if (program != null)
- program.setSapGroup(SAP_GROUP);
+ if (program != null) {
+ String sapGroup = VLMa.getInstance().getString("vlma.sap.files.group", DEFAULT_FILES_SAP_GROUP);
+ program.setSapGroup(sapGroup);
+ }
}
diff --git a/core/src/main/java/org/videolan/vlma/common/media/SatChannel.java b/core/src/main/java/org/videolan/vlma/common/media/SatChannel.java
index 33eab5d..2a9018b 100644
--- a/core/src/main/java/org/videolan/vlma/common/media/SatChannel.java
+++ b/core/src/main/java/org/videolan/vlma/common/media/SatChannel.java
@@ -22,6 +22,7 @@ package org.videolan.vlma.common.media;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import org.videolan.vlma.common.VLMa;
import org.videolan.vlma.common.program.Program;
/**
@@ -54,9 +55,9 @@ public class SatChannel extends AbstractMedia {
private String coverage;
- public static final String SAT_SAP_GROUP = "Satellite";
+ public static final String DEFAULT_SAT_SAP_GROUP = "Satellite";
- public static final String RADIO_SAP_GROUP = "Radio";
+ public static final String DEFAULT_RADIO_SAP_GROUP = "Radio";
/**
* Gets the channel category (TV, radio, encrypted, etc.).
@@ -95,11 +96,15 @@ public class SatChannel extends AbstractMedia {
*
*/
protected void updateSapGroup() {
+ String sapGroup;
if (program != null) {
- if (category.equals("R-DIG"))
- program.setSapGroup(RADIO_SAP_GROUP);
- else
- program.setSapGroup(SAT_SAP_GROUP);
+ if (category.equals("R-DIG")) {
+ sapGroup = VLMa.getInstance().getString("vlma.sap.satellite.group", DEFAULT_SAT_SAP_GROUP);
+ program.setSapGroup(sapGroup);
+ } else {
+ sapGroup = VLMa.getInstance().getString("vlma.sap.radio.group", DEFAULT_RADIO_SAP_GROUP);
+ program.setSapGroup(sapGroup);
+ }
}
}
diff --git a/core/src/main/java/org/videolan/vlma/common/media/TNTChannel.java b/core/src/main/java/org/videolan/vlma/common/media/TNTChannel.java
index 82dba09..e31e3f0 100644
--- a/core/src/main/java/org/videolan/vlma/common/media/TNTChannel.java
+++ b/core/src/main/java/org/videolan/vlma/common/media/TNTChannel.java
@@ -22,6 +22,7 @@ package org.videolan.vlma.common.media;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import org.videolan.vlma.common.VLMa;
import org.videolan.vlma.common.program.Program;
/**
@@ -32,7 +33,7 @@ import org.videolan.vlma.common.program.Program;
public class TNTChannel extends AbstractMedia {
- public static final String SAP_GROUP = "TNT";
+ public static final String DEFAULT_TNT_SAP_GROUP = "TNT";
private static final Logger logger = Logger.getLogger(TNTChannel.class);
@@ -59,8 +60,10 @@ public class TNTChannel extends AbstractMedia {
*
*/
protected void updateSapGroup() {
- if (program != null)
- program.setSapGroup(SAP_GROUP);
+ if (program != null) {
+ String sapGroup = VLMa.getInstance().getString("vlma.sap.tnt.group", DEFAULT_TNT_SAP_GROUP);
+ program.setSapGroup(sapGroup);
+ }
}
/**
diff --git a/core/src/main/java/org/videolan/vlma/common/order/Command.java b/core/src/main/java/org/videolan/vlma/common/order/Command.java
index ed2da3a..ae37f19 100644
--- a/core/src/main/java/org/videolan/vlma/common/order/Command.java
+++ b/core/src/main/java/org/videolan/vlma/common/order/Command.java
@@ -25,6 +25,7 @@ import java.util.Date;
import java.util.LinkedList;
import java.util.List;
+import org.videolan.vlma.common.VLMa;
import org.videolan.vlma.common.server.Server;
public class Command implements Serializable {
@@ -32,7 +33,7 @@ public class Command implements Serializable {
/**
* Max size allowed for the command list.
*/
- private static final int COMMANDS_SIZE = 500;
+ public static final int DEFAULT_COMMANDS_SIZE = 500;
private static LinkedList<Command> commands = new LinkedList<Command>();
@@ -54,7 +55,7 @@ public class Command implements Serializable {
public static void add(Command command) {
commands.addFirst(command);
- if (commands.size() > COMMANDS_SIZE) {
+ if (commands.size() > VLMa.getInstance().getInt("vlma.ui.command.queue.size", DEFAULT_COMMANDS_SIZE)) {
commands.removeLast();
}
}
diff --git a/core/src/main/java/org/videolan/vlma/common/order/Order.java b/core/src/main/java/org/videolan/vlma/common/order/Order.java
index 2b4838d..9128fdb 100644
--- a/core/src/main/java/org/videolan/vlma/common/order/Order.java
+++ b/core/src/main/java/org/videolan/vlma/common/order/Order.java
@@ -59,22 +59,22 @@ public class Order {
/**
* Time to wait for during telnet connections.
*/
- private static final int TELNET_DEFAULT_WAIT = 100;
+ private static final int DEFAULT_TELNET_WAIT = 100;
/**
* Time to wait for the response.
*/
- private static final int TELNET_DEFAULT_DELAY = 1000;
+ private static final int DEFAULT_TELNET_DELAY = 1000;
/**
* Default TTL for the diffusion.
*/
- private static final int VLC_TTL = 12;
+ private static final int DEFAULT_STREAM_TTL = 12;
/**
* The default bandwidth.
*/
- private static final int VLC_DVB_BANDWIDTH = 8;
+ private static final int DEFAULT_DVB_BANDWIDTH = 8;
private static LinkedList<Command> commands = new LinkedList<Command>();
@@ -197,10 +197,10 @@ public class Order {
logger.log(Level.DEBUG, "Send command " + command + " to "
+ server.getName());
telnetOut.println(command);
- int d = TELNET_DEFAULT_DELAY;
- while (!telnetIn.ready() && (d -= TELNET_DEFAULT_WAIT) > 0) {
+ int d = VLMa.getInstance().getInt("vlc.telnet.delay", DEFAULT_TELNET_DELAY);
+ while (!telnetIn.ready() && (d -= DEFAULT_TELNET_WAIT) > 0) {
try {
- Thread.sleep(TELNET_DEFAULT_WAIT);
+ Thread.sleep(DEFAULT_TELNET_WAIT);
} catch (InterruptedException e) {
}
}
@@ -231,7 +231,8 @@ public class Order {
telnetCommand("setup " + getVLMCommandName() + " option vvv");
telnetCommand("setup " + getVLMCommandName() + " option color");
telnetCommand("setup " + getVLMCommandName() + " option ttl="
- + Integer.toString(VLC_TTL));
+ + Integer.toString(VLMa.getInstance()
+ .getInt("vlc.stream.ttl", DEFAULT_STREAM_TTL)));
// The media to stream is a satellite channel
if (medias.getMediaClass() == SatChannel.class) {
@@ -245,7 +246,8 @@ public class Order {
+ " option dvb-adapter=" + getAdapter().getName());
telnetCommand("setup " + getVLMCommandName()
+ " option dvb-bandwidth="
- + Integer.toString(VLC_DVB_BANDWIDTH));
+ + Integer.toString(VLMa.getInstance()
+ .getInt("vlc.stream.dvb-bandwidth", DEFAULT_DVB_BANDWIDTH)));
if (ch.getPolarisation() == 'H') {
telnetCommand("setup " + getVLMCommandName()
+ " option dvb-voltage=18");
@@ -298,7 +300,8 @@ public class Order {
+ " option dvb-adapter=" + getAdapter().getName());
telnetCommand("setup " + getVLMCommandName()
+ " option dvb-bandwidth="
- + Integer.toString(VLC_DVB_BANDWIDTH));
+ + Integer.toString(VLMa.getInstance()
+ .getInt("vlc.stream.dvb-bandwidth", DEFAULT_DVB_BANDWIDTH)));
String ids = "";
String command = "";
diff --git a/core/src/main/java/org/videolan/vlma/common/program/ProgramImpl.java b/core/src/main/java/org/videolan/vlma/common/program/ProgramImpl.java
index b73f9ed..31bf7ef 100644
--- a/core/src/main/java/org/videolan/vlma/common/program/ProgramImpl.java
+++ b/core/src/main/java/org/videolan/vlma/common/program/ProgramImpl.java
@@ -48,7 +48,7 @@ public class ProgramImpl implements Program, Serializable {
private String sapGroup;
- private transient boolean broadcastState;
+ private boolean broadcastState;
/**
* Gets the SAP group.
More information about the vlma-devel
mailing list