[vlma-devel] commit: Add adapterName property to a Program. (Adrien Maglo )

git version control git at videolan.org
Thu Oct 9 23:09:33 CEST 2008


vlma | branch: master | Adrien Maglo <magsoft at videolan.org> | Thu Oct  9 22:59:04 2008 +0200| [6678b6c62e9215589c9276fa341380dfd792d700] | committer: Adrien Maglo 

Add adapterName property to a Program.

Now useful to determine a VoD stream URL.

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

 .../main/java/org/videolan/vlma/model/Program.java |   21 ++++++++++++++++++++
 .../main/java/org/videolan/vlma/OrderGiver.java    |    2 +
 .../org/videolan/vlma/monitor/OrderMonitor.java    |    3 +-
 3 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/Program.java b/vlma-api/src/main/java/org/videolan/vlma/model/Program.java
index 1b2c75d..ffc0c3d 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/Program.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/Program.java
@@ -35,6 +35,8 @@ public class Program implements Serializable {
 
     private static final long serialVersionUID = -2723021707121558896L;
 
+    private String adapterName;
+    
     private boolean broadcastState;
 
     private InetAddress ip;
@@ -68,6 +70,15 @@ public class Program implements Serializable {
     }
 
     /**
+     * Gets adapter name.
+     *
+     * @return a string containing the adapter name
+     */
+    public String getAdapterName() {
+        return adapterName;
+    }
+
+    /**
      * Gets broadcast state.
      *
      * @return The brocast state :
@@ -203,6 +214,16 @@ public class Program implements Serializable {
     }
 
     /**
+     * Sets the adapter name.
+     *
+     * @param a
+     * 			a string containing the adapter name
+     */
+    public void setAdapterName(String a) {
+        adapterName = a;
+    }
+
+    /**
      * Tells whether the media of the order is really broadcasted.
      *
      * @param broadcastState true if the media is broadcasted, false otherwise
diff --git a/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java b/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
index 7e298d1..969729d 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/OrderGiver.java
@@ -367,6 +367,7 @@ public class OrderGiver {
                         Program p = media.getProgram();
                         if(p != null) {
                             p.setPlayer(null);
+                            p.setAdapterName(null);
                             p.setBroadcastState(false);
                         }
                     }
@@ -381,6 +382,7 @@ public class OrderGiver {
                 for (Order order : newOrders) {
                     for(Media media : order.getMedias()) {
                         media.getProgram().setPlayer(order.getAdapter().getServer().getIp());
+                        media.getProgram().setAdapterName(order.getAdapter().getName());
                     }
                     SendOrder sendThread = sendThreads.get(order.getAdapter().getServer());
                     if(sendThread == null) {
diff --git a/vlma-core/src/main/java/org/videolan/vlma/monitor/OrderMonitor.java b/vlma-core/src/main/java/org/videolan/vlma/monitor/OrderMonitor.java
index e0e156f..cafe614 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/monitor/OrderMonitor.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/monitor/OrderMonitor.java
@@ -86,7 +86,7 @@ public class OrderMonitor implements Monitor {
                      * If the program must be played and is not then we have to
                      * recompute.
                      */
-                    if (!streamWatcher.isPlayed(program)) {
+                    if (!streamWatcher.isPlayed(media)) {
                         logger.info("Program " + program.getSapName() + " is currently not played.");
                         /*
                          * If the OrderGiver is not computing then it can
@@ -104,6 +104,7 @@ public class OrderMonitor implements Monitor {
                             }
                         }
                         program.setPlayer(null);
+                        program.setAdapterName(null);
                         program.setBroadcastState(false);
                         shouldCompute = true;
                     } else {



More information about the vlma-devel mailing list