[vlma-devel] commit: Several announcements at the same time. (Adrien Grand )

git version control git at videolan.org
Fri Jun 27 02:08:08 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Thu Jun 26 19:04:27 2008 +0200| [b453ed76ab7bebac0472cfde8ee370cd8d44608a]

Several announcements at the same time.

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

 .../main/java/org/videolan/vlma/daemon/VLMad.java  |    3 +-
 .../org/videolan/vlma/model/StreamingStrategy.java |   37 +++++++++++++++-----
 .../org/videolan/vlma/model/order/FilesOrder.java  |    2 +-
 .../org/videolan/vlma/model/order/SatOrder.java    |    2 +-
 .../org/videolan/vlma/model/order/StreamOrder.java |    2 +-
 .../org/videolan/vlma/model/order/TNTOrder.java    |    2 +-
 6 files changed, 34 insertions(+), 14 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 2347523..20ab17d 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
@@ -90,7 +90,8 @@ public class VLMad {
         String announcement = VLMa.getInstance().getString("vlma.announcement.protocol");
         String protocol = VLMa.getInstance().getString("vlma.streaming.protocol");
         logger.debug("Initializing streaming strategy");
-        streamingStrategy.setAnnouncement(StreamingStrategy.Announcement.valueOf(announcement));
+        for (String s : announcement.split(","))
+            streamingStrategy.addAnnouncement(StreamingStrategy.Announcement.valueOf(s));
         streamingStrategy.setProtocol(StreamingStrategy.Protocol.valueOf(protocol));
         Daemon daemon = (Daemon) ac.getBean("daemon");
         daemon.setIpsDevel(IPsDevelvalue);
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 d472914..2ab3357 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
@@ -21,6 +21,8 @@
 package org.videolan.vlma.model;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * VLMa streaming strategy.
@@ -34,30 +36,44 @@ public class StreamingStrategy implements Cloneable, Serializable {
     }
 
     public static enum Announcement {
-        NONE, SAP
+        SAP
     }
 
     private static final Protocol DEFAULT_PROTOCOL = Protocol.UDP;
-    private static final Announcement DEFAULT_ANNOUNCEMENT = Announcement.SAP;
 
     private Protocol protocol = DEFAULT_PROTOCOL;
-    private Announcement announcement = DEFAULT_ANNOUNCEMENT;
+    private List<Announcement> announcements = new ArrayList<Announcement>();
 
     /**
-     * @return the announcement
+     * Gets the announcement list.
+     *
+     * @return the announcements
      */
-    public Announcement getAnnouncement() {
-        return announcement;
+    public List<Announcement> getAnnouncements() {
+        return announcements;
     }
 
     /**
-     * @param announcement the announcement to set
+     * Adds an announcement.
+     *
+     * @param announcement the announcement to add
      */
-    public void setAnnouncement(Announcement announcement) {
-        this.announcement = announcement;
+    public void addAnnouncement(Announcement announcement) {
+        this.announcements.add(announcement);
     }
 
     /**
+     * Verifies whether or not an announcement is enabled.
+     *
+     * @return true if and only if the announcement is enabled
+     */
+    public boolean isEnabled(Announcement announcement) {
+        return announcements.contains(announcement);
+    }
+
+    /**
+     * Gets the protocol.
+     *
      * @return the protocol
      */
     public Protocol getProtocol() {
@@ -65,6 +81,8 @@ public class StreamingStrategy implements Cloneable, Serializable {
     }
 
     /**
+     * Sets the protocol.
+     *
      * @param protocol the protocol to set
      */
     public void setProtocol(Protocol protocol) {
@@ -75,4 +93,5 @@ public class StreamingStrategy implements Cloneable, Serializable {
     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 5fb519a..4936d1f 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), getDst(ch)));
-            if (ch.getProgram().getStreamingStrategy().getAnnouncement().equals(StreamingStrategy.Announcement.SAP)) {
+            if (ch.getProgram().getStreamingStrategy().isEnabled(StreamingStrategy.Announcement.SAP)) {
                 output.append(String.format(",sap,name=\"%s\",group=\"%s\")", ch.getProgram().getSapName(), ch.getProgram().getSapGroup()));
             }
             output.append("}");
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 3563318..ac5ce9a 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
@@ -68,7 +68,7 @@ public class SatOrder extends Order {
                 }
                 command += String.format("dst=standard{mux=ts,access=%s,dst=%s",
                         getAccess(ch), getDst(ch));
-                if (ch.getProgram().getStreamingStrategy().getAnnouncement().equals(StreamingStrategy.Announcement.SAP)) {
+                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 b3c84e8..ca99b25 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
@@ -44,7 +44,7 @@ public class StreamOrder extends Order {
 
             StringBuffer output = new StringBuffer();
             output.append(String.format("#standard{mux=ts,access=%s,dst=%s", getAccess(ch), getDst(ch)));
-            if (ch.getProgram().getStreamingStrategy().getAnnouncement().equals(StreamingStrategy.Announcement.SAP)) {
+            if (ch.getProgram().getStreamingStrategy().isEnabled(StreamingStrategy.Announcement.SAP)) {
                 output.append(String.format(",sap,name=\"%s\",group=\"%s\")", ch.getProgram().getSapName(), ch.getProgram().getSapGroup()));
             }
             output.append("}");
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 4ada1b4..2b58a22 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
@@ -58,7 +58,7 @@ public class TNTOrder extends Order {
                 }
                 command += String.format("dst=standard{mux=ts,access=%s,dst=%s",
                         getAccess(ch), getDst(ch));
-                if (ch.getProgram().getStreamingStrategy().getAnnouncement().equals(StreamingStrategy.Announcement.SAP)) {
+                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