[vlma-devel] commit: Adapt the MediaProgramAdd page to support VoD streaming strategy. ( 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 23:01:24 2008 +0200| [52c51a3cdc110d6e6c0d0652595dc27424962cb3] | committer: Adrien Maglo 

Adapt the MediaProgramAdd page to support VoD streaming strategy.

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

 .../videolan/vlma/web/media/MediaProgramAdd.java   |    9 ++++++++-
 .../vlma/web/media/MediaProgramAddController.java  |   12 ++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAdd.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAdd.java
index 5b46a20..5af0c58 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAdd.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAdd.java
@@ -30,6 +30,9 @@ public class MediaProgramAdd {
     private String sap;
 
     private String priority;
+    
+    /* Available protocols for the media to stream */
+    private StreamingStrategy.Protocol[] protocols;
 
     private StreamingStrategy.Protocol protocol;
 
@@ -50,7 +53,11 @@ public class MediaProgramAdd {
     }
 
     public StreamingStrategy.Protocol[] getProtocols() {
-        return StreamingStrategy.Protocol.values();
+        return protocols;
+    }
+    
+    public void setProtocols(StreamingStrategy.Protocol[] ps) {
+        protocols = ps;
     }
 
     public StreamingStrategy.Encapsulation[] getMuxs() {
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
index 6bc5fb8..11b591f 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
@@ -22,7 +22,9 @@ package org.videolan.vlma.web.media;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.servlet.ServletException;
@@ -39,6 +41,7 @@ import org.videolan.vlma.model.Media;
 import org.videolan.vlma.model.Program;
 import org.videolan.vlma.model.SatChannel;
 import org.videolan.vlma.model.StreamChannel;
+import org.videolan.vlma.model.StreamingStrategy;
 
 public class MediaProgramAddController extends SimpleFormController {
 
@@ -131,6 +134,15 @@ public class MediaProgramAddController extends SimpleFormController {
         MediaProgramAdd mediasProgramAdd = new MediaProgramAdd();
         int mediaId = Integer.parseInt(request.getParameter("media"));
         Media media = data.getMedia(mediaId);
+
+        /* Remove the VoD streaming strategy if the media is not a file channel */
+        List<StreamingStrategy.Protocol> availableProtocols =
+        	Arrays.asList(StreamingStrategy.Protocol.values());
+        if( media.getClass() != FilesChannel.class )
+        	availableProtocols.remove(StreamingStrategy.Protocol.VOD);
+        mediasProgramAdd.setProtocols(
+        		(StreamingStrategy.Protocol[])availableProtocols.toArray());
+
         Program program;
         if (media.getProgram() == null) {
             program = data.newProgram();



More information about the vlma-devel mailing list