[vlma-devel] commit: Now the function getUrlOfProgram() takes a media in argument and is also return the url of a VoD stream. ( 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:52:43 2008 +0200| [3592a046d75fdac923f6372aa858def5cdcd6773] | committer: Adrien Maglo 

Now the function getUrlOfProgram() takes a media in argument and is also return the url of a VoD stream.

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

 vlma-api/src/main/java/org/videolan/vlma/Data.java |    2 +-
 .../src/main/java/org/videolan/vlma/DataImpl.java  |   25 +++++++++++++------
 .../web/service/AbstractPlaylistController.java    |    2 +-
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/Data.java b/vlma-api/src/main/java/org/videolan/vlma/Data.java
index a0ae09a..7ae072f 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/Data.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/Data.java
@@ -287,7 +287,7 @@ public interface Data extends Remote {
      * @return the program URL
      * @throws RemoteException
      */
-    String getUrlOfProgram(Program program) throws RemoteException;
+    String getUrlOfProgram(Media media) throws RemoteException;
 
     /**
      * Updates the list of a satellite channels using an URL like
diff --git a/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java b/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
index f6ec2c1..5c7d672 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
@@ -227,14 +227,23 @@ public class DataImpl implements Data {
      *
      *************************************************************************/
 
-    public String getUrlOfProgram(Program program) {
-        if (program != null) {
-            if (program.getStreamingStrategy().getProtocol().equals(StreamingStrategy.Protocol.HTTP)) {
-                return "http://" + program.getPlayer().getHostAddress() + ":" + configuration.getInt("vlma.streaming.http.port") + "/" + program.hashCode();
-            } else if (program.getStreamingStrategy().getProtocol().equals(StreamingStrategy.Protocol.UDP_MULTICAST)) {
-                return "udp://@" + program.getIp().getHostAddress();
-            }
-        }
+    public String getUrlOfProgram(Media media) {
+    	if( media != null )
+    	{
+	    	Program program = media.getProgram();
+	        if (program != null) {
+	            if (program.getStreamingStrategy().getProtocol().equals(StreamingStrategy.Protocol.HTTP)) {
+	                return "http://" + program.getPlayer().getHostAddress() + ":" + configuration.getInt("vlma.streaming.http.port") + "/" + program.hashCode();
+	            } else if (program.getStreamingStrategy().getProtocol().equals(StreamingStrategy.Protocol.UDP_MULTICAST)) {
+	                return "udp://@" + program.getIp().getHostAddress();
+	            } else if (program.getStreamingStrategy().getProtocol().equals(StreamingStrategy.Protocol.VOD)) {
+	            	Integer rtspPort = configuration.getInt("vlma.streaming.rtsp.port");
+	                return "rtsp://" + program.getPlayer().getHostAddress()
+						   + ":" + rtspPort + "/flux-"
+						   + program.getAdapterName() + media.getId();
+	            }
+	        }
+    	}
         return null;
     }
 
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/service/AbstractPlaylistController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/service/AbstractPlaylistController.java
index 8542320..321d0bd 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/service/AbstractPlaylistController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/service/AbstractPlaylistController.java
@@ -60,7 +60,7 @@ public class AbstractPlaylistController implements Controller {
             if (media.getProgram() != null
                     && media.getProgram().getPlayer() != null
                     && media.getProgram().getStreamingStrategy().isEnabled(announcement)) {
-                medias.put(media, data.getUrlOfProgram(media.getProgram()));
+                medias.put(media, data.getUrlOfProgram(media));
             }
         }
         mav.addObject("medias", medias);



More information about the vlma-devel mailing list