[vlma-devel] commit: Let people choose the encapsulation format. (Adrien Grand )

git version control git at videolan.org
Sat Jun 28 22:51:01 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Jun 28 21:48:37 2008 +0200| [90cedf08ec97a16489f0f86db815f2125d1d1c1c]

Let people choose the encapsulation format.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=90cedf08ec97a16489f0f86db815f2125d1d1c1c
---

 .../main/java/org/videolan/vlma/daemon/VLMad.java  |    6 +++-
 vlma-daemon/src/main/resources/config.properties   |    5 ++-
 .../org/videolan/vlma/model/StreamingStrategy.java |   28 ++++++++++++++++++-
 .../org/videolan/vlma/model/order/FilesOrder.java  |    2 +-
 .../java/org/videolan/vlma/model/order/Order.java  |   10 +++++++
 .../org/videolan/vlma/model/order/SatOrder.java    |    4 +-
 .../org/videolan/vlma/model/order/StreamOrder.java |    2 +-
 .../org/videolan/vlma/model/order/TNTOrder.java    |    4 +-
 8 files changed, 49 insertions(+), 12 deletions(-)

diff --git a/vlma-daemon/src/main/java/org/videolan/vlma/daemon/VLMad.java b/vlma-daemon/src/main/java/org/videolan/vlma/daemon/VLMad.java
index 72cbdcb..1c68805 100644
--- a/vlma-daemon/src/main/java/org/videolan/vlma/daemon/VLMad.java
+++ b/vlma-daemon/src/main/java/org/videolan/vlma/daemon/VLMad.java
@@ -62,12 +62,14 @@ public class VLMad {
         logger.debug("Loading Spring application context");
         ApplicationContext ac = new ClassPathXmlApplicationContext("daemon.xml");
         StreamingStrategy streamingStrategy = (StreamingStrategy) ac.getBean("streamingStrategy");
-        String announcement = VLMa.getInstance().getString("vlma.announcement.protocol");
-        String protocol = VLMa.getInstance().getString("vlma.streaming.protocol");
+        String announcement = VLMa.getInstance().getString("vlma.announcement");
+        String protocol = VLMa.getInstance().getString("vlma.streaming");
+        String encapsulation = VLMa.getInstance().getString("vlma.encapsulation");
         logger.debug("Initializing streaming strategy");
         for (String s : announcement.split(","))
             streamingStrategy.addAnnouncement(StreamingStrategy.Announcement.valueOf(s));
         streamingStrategy.setProtocol(StreamingStrategy.Protocol.valueOf(protocol));
+        streamingStrategy.setEncapsulation(StreamingStrategy.Encapsulation.valueOf(encapsulation));
         IpBank ipBank = (IpBank) ac.getBean("ipBank");
         try {
             ipBank.setMin((Inet4Address) Inet4Address.getByName(VLMa.getInstance().getString("vlma.streaming.udp.ipbank.min")));
diff --git a/vlma-daemon/src/main/resources/config.properties b/vlma-daemon/src/main/resources/config.properties
index b035492..1c5407b 100644
--- a/vlma-daemon/src/main/resources/config.properties
+++ b/vlma-daemon/src/main/resources/config.properties
@@ -14,12 +14,13 @@ vlc.telnet.delay = 1000
 vlc.telnet.password = admin
 vlc.telnet.port = 4212
 vlma.data=${user.home}/.vlma
-vlma.announcement.protocol = SAP
+vlma.announcement = SAP
 vlma.announcement.sap.files.group = Files
 vlma.announcement.sap.radio.group = Radio
 vlma.announcement.sap.stream.group = Stream
 vlma.announcement.sap.satellite.group = Satellite
 vlma.announcement.sap.tnt.group = TNT
+vlma.encapsulation = TS
 vlma.notification.irc.chan =
 vlma.notification.irc.host = irc.freenode.net
 vlma.notification.irc.nick = vlma
@@ -32,7 +33,7 @@ vlma.notification.msn.login =
 vlma.notification.msn.pass =
 vlma.notification.msn.recipients =
 vlma.streaming.http.port = 8001
-vlma.streaming.protocol = UDP
+vlma.streaming = UDP
 vlma.streaming.udp.ipbank.min = 239.127.0.1
 vlma.streaming.udp.ipbank.max = 239.127.255.255
 vlma.ui.command.queue.size = 500
diff --git a/vlma-model/src/main/java/org/videolan/vlma/model/StreamingStrategy.java b/vlma-model/src/main/java/org/videolan/vlma/model/StreamingStrategy.java
index bd5503e..3386615 100644
--- a/vlma-model/src/main/java/org/videolan/vlma/model/StreamingStrategy.java
+++ b/vlma-model/src/main/java/org/videolan/vlma/model/StreamingStrategy.java
@@ -32,17 +32,23 @@ import java.util.Set;
 public class StreamingStrategy implements Cloneable, Serializable {
 
     public static enum Protocol {
-        UDP, HTTP
+        UDP, HTTP;
     }
 
     public static enum Announcement {
-        SAP, PODCAST
+        SAP, PODCAST;
+    }
+
+    public static enum Encapsulation {
+        TS, PS, MPEG1, OGG, ASF, ASFH, AVI, MPJPEG;
     }
 
     private static final Protocol DEFAULT_PROTOCOL = Protocol.UDP;
+    private static final Encapsulation DEFAULT_ENCAPSULATION = Encapsulation.TS;
 
     private Protocol protocol = DEFAULT_PROTOCOL;
     private Set<Announcement> announcements = new HashSet<Announcement>();
+    private Encapsulation encapsulation = DEFAULT_ENCAPSULATION;
 
     /**
      * Gets the announcement list.
@@ -89,6 +95,24 @@ public class StreamingStrategy implements Cloneable, Serializable {
         this.protocol = protocol;
     }
 
+    /**
+     * Gets the encapsulation.
+     *
+     * @return the encapsulation
+     */
+    public Encapsulation getEncapsulation() {
+        return encapsulation;
+    }
+
+    /**
+     * Sets the encapsulation.
+     *
+     * @param encapsulation the encapsulation to set
+     */
+    public void setEncapsulation(Encapsulation encapsulation) {
+        this.encapsulation = encapsulation;
+    }
+
     @Override
     public Object clone() throws CloneNotSupportedException {
         return (StreamingStrategy) super.clone();
diff --git a/vlma-model/src/main/java/org/videolan/vlma/model/order/FilesOrder.java b/vlma-model/src/main/java/org/videolan/vlma/model/order/FilesOrder.java
index 3564cdb..6c8ac8a 100644
--- a/vlma-model/src/main/java/org/videolan/vlma/model/order/FilesOrder.java
+++ b/vlma-model/src/main/java/org/videolan/vlma/model/order/FilesOrder.java
@@ -46,7 +46,7 @@ public class FilesOrder extends Order {
             }
 
             StringBuffer output = new StringBuffer();
-            output.append(String.format("#standard{mux=ts,access=%s,dst=%s", getAccess(ch.getProgram()), getDst(ch.getProgram())));
+            output.append(String.format("#standard{mux=%s,access=%s,dst=%s", getMux(ch.getProgram()), getAccess(ch.getProgram()), getDst(ch.getProgram())));
             if (ch.getProgram().getStreamingStrategy().isEnabled(StreamingStrategy.Announcement.SAP)) {
                 output.append(String.format(",sap,name=\"%s\",group=\"%s\")", ch.getProgram().getSapName(), ch.getProgram().getSapGroup()));
             }
diff --git a/vlma-model/src/main/java/org/videolan/vlma/model/order/Order.java b/vlma-model/src/main/java/org/videolan/vlma/model/order/Order.java
index 53e9930..feb2af9 100644
--- a/vlma-model/src/main/java/org/videolan/vlma/model/order/Order.java
+++ b/vlma-model/src/main/java/org/videolan/vlma/model/order/Order.java
@@ -214,6 +214,16 @@ public abstract class Order {
         return null;
     }
 
+    /**
+     * Gets the program encapsulation.
+     *
+     * @param program the program to stream
+     * @return the encapsulation
+     */
+    public String getMux(Program program) {
+        return program.getStreamingStrategy().getEncapsulation().toString().toLowerCase();
+    }
+
     protected void stopCommand(String commandName) throws IOException {
         telnetCommand("control " + commandName + " disabled");
         telnetCommand("control " + commandName + " stop");
diff --git a/vlma-model/src/main/java/org/videolan/vlma/model/order/SatOrder.java b/vlma-model/src/main/java/org/videolan/vlma/model/order/SatOrder.java
index a03502e..dd895f4 100644
--- a/vlma-model/src/main/java/org/videolan/vlma/model/order/SatOrder.java
+++ b/vlma-model/src/main/java/org/videolan/vlma/model/order/SatOrder.java
@@ -66,8 +66,8 @@ public class SatOrder extends Order {
                 if (command != "") {
                     command += ",";
                 }
-                command += String.format("dst=standard{mux=ts,access=%s,dst=%s",
-                        getAccess(ch.getProgram()), getDst(ch.getProgram()));
+                command += String.format("dst=standard{mux=%s,access=%s,dst=%s",
+                        getMux(ch.getProgram()), getAccess(ch.getProgram()), getDst(ch.getProgram()));
                 if (ch.getProgram().getStreamingStrategy().isEnabled(StreamingStrategy.Announcement.SAP)) {
                     command += String.format(",sap,name=\"%s\",group=\"%s\"",
                             ch.getProgram().getSapName(), ch.getProgram().getSapGroup());
diff --git a/vlma-model/src/main/java/org/videolan/vlma/model/order/StreamOrder.java b/vlma-model/src/main/java/org/videolan/vlma/model/order/StreamOrder.java
index 67ba2ea..cc56548 100755
--- a/vlma-model/src/main/java/org/videolan/vlma/model/order/StreamOrder.java
+++ b/vlma-model/src/main/java/org/videolan/vlma/model/order/StreamOrder.java
@@ -43,7 +43,7 @@ public class StreamOrder extends Order {
                     " input \"" + ch.getStreamURL() + "\"");
 
             StringBuffer output = new StringBuffer();
-            output.append(String.format("#standard{mux=ts,access=%s,dst=%s", getAccess(ch.getProgram()), getDst(ch.getProgram())));
+            output.append(String.format("#standard{mux=%s,access=%s,dst=%s", getMux(ch.getProgram()),getAccess(ch.getProgram()), getDst(ch.getProgram())));
             if (ch.getProgram().getStreamingStrategy().isEnabled(StreamingStrategy.Announcement.SAP)) {
                 output.append(String.format(",sap,name=\"%s\",group=\"%s\")", ch.getProgram().getSapName(), ch.getProgram().getSapGroup()));
             }
diff --git a/vlma-model/src/main/java/org/videolan/vlma/model/order/TNTOrder.java b/vlma-model/src/main/java/org/videolan/vlma/model/order/TNTOrder.java
index b91bb7d..1b114d5 100644
--- a/vlma-model/src/main/java/org/videolan/vlma/model/order/TNTOrder.java
+++ b/vlma-model/src/main/java/org/videolan/vlma/model/order/TNTOrder.java
@@ -56,8 +56,8 @@ public class TNTOrder extends Order {
                 if (command != "") {
                     command += ",";
                 }
-                command += String.format("dst=standard{mux=ts,access=%s,dst=%s",
-                        getAccess(ch.getProgram()), getDst(ch.getProgram()));
+                command += String.format("dst=standard{mux=%s,access=%s,dst=%s",
+                        getMux(ch.getProgram()), getAccess(ch.getProgram()), getDst(ch.getProgram()));
                 if (ch.getProgram().getStreamingStrategy().isEnabled(StreamingStrategy.Announcement.SAP)) {
                     command += String.format(",sap,name=\"%s\",group=\"%s\"",
                             ch.getProgram().getSapName(), ch.getProgram().getSapGroup());



More information about the vlma-devel mailing list