[vlc-devel] commit: VOD support for Java bindings (Adrien Grand )

git version control git at videolan.org
Sun Jul 20 23:31:13 CEST 2008


vlc | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Jul 20 18:18:36 2008 +0200| [e2644877773f5a1e61b6fd833295d5c09e125803]

VOD support for Java bindings

I've updated the first patch to take into account recent changes in JVLC
tests.

Regards,

--
jpountz

>From e6f5b5ff77b38ec0dfefe4e036708396df7bf459 Mon Sep 17 00:00:00 2001
From: Adrien Grand <jpountz at videolan.org>
Date: Sun, 20 Jul 2008 18:10:52 +0200
Subject: [PATCH] Java bindings: Add VOD support.

Signed-off-by: Filippo Carone <littlejohn at videolan.org>

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

 .../core/src/main/java/org/videolan/jvlc/VLM.java  |   24 ++++-
 .../java/org/videolan/jvlc/internal/LibVlc.java    |    7 +-
 .../java/org/videolan/jvlc/AbstractJVLCTest.java   |    4 +-
 .../src/test/java/org/videolan/jvlc/VLMTest.java   |  107 ++++++++++++++++++--
 4 files changed, 125 insertions(+), 17 deletions(-)

diff --git a/bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java b/bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java
index 7763726..36cde32 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java
@@ -32,7 +32,7 @@ public class VLM
 {
 
     private JVLC jvlc;
-    
+
     private volatile boolean released;
 
     public VLM(JVLC jvlc)
@@ -55,6 +55,20 @@ public class VLM
             exception);
     }
 
+    public void addVod(String name, String input, String[] options, boolean enabled, String muxer)
+    {
+        libvlc_exception_t exception = new libvlc_exception_t();
+        jvlc.getLibvlc().libvlc_vlm_add_vod(
+            jvlc.getInstance(),
+            name,
+            input,
+            options == null ? 0 : options.length,
+            options,
+            enabled ? 1 : 0,
+            muxer,
+            exception);
+    }
+
     public void deleteMedia(String name)
     {
         libvlc_exception_t exception = new libvlc_exception_t();
@@ -91,6 +105,12 @@ public class VLM
         jvlc.getLibvlc().libvlc_vlm_add_input(jvlc.getInstance(), name, input, exception);
     }
 
+    public void setMux(String name, String muxer)
+    {
+        libvlc_exception_t exception = new libvlc_exception_t();
+        jvlc.getLibvlc().libvlc_vlm_set_mux(jvlc.getInstance(), name, muxer, exception);
+    }
+
     public void setMediaLoop(String media, boolean loop)
     {
         libvlc_exception_t exception = new libvlc_exception_t();
@@ -165,7 +185,5 @@ public class VLM
         release();
         super.finalize();
     }
-    
-    
 
 }
diff --git a/bindings/java/core/src/main/java/org/videolan/jvlc/internal/LibVlc.java b/bindings/java/core/src/main/java/org/videolan/jvlc/internal/LibVlc.java
index e4add27..c05d7d8 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/internal/LibVlc.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/internal/LibVlc.java
@@ -510,6 +510,9 @@ public interface LibVlc extends Library
     void libvlc_vlm_add_broadcast(LibVlcInstance p_instance, String psz_name, String psz_input, String psz_output,
         int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
 
+    void libvlc_vlm_add_vod(LibVlcInstance p_instance, String psz_name, String psz_input, int i_options,
+        String[] ppsz_options, int b_enabled, String psz_mux, libvlc_exception_t p_e);
+
     void libvlc_vlm_del_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
 
     void libvlc_vlm_set_enabled(LibVlcInstance p_instance, String psz_name, int b_enabled, libvlc_exception_t p_e);
@@ -522,6 +525,8 @@ public interface LibVlc extends Library
 
     void libvlc_vlm_set_loop(LibVlcInstance p_instance, String psz_name, int b_loop, libvlc_exception_t p_e);
 
+    void libvlc_vlm_set_mux(LibVlcInstance p_instance, String psz_name, String psz_mux, libvlc_exception_t p_e);
+
     void libvlc_vlm_change_media(LibVlcInstance p_instance, String psz_name, String psz_input, String psz_output,
         int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
 
@@ -536,7 +541,7 @@ public interface LibVlc extends Library
     String libvlc_vlm_show_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
 
     void libvlc_vlm_release(LibVlcInstance p_instance, libvlc_exception_t p_e);
-    
+
     // event manager
 
     public static interface LibVlcCallback extends Callback
diff --git a/bindings/java/core/src/test/java/org/videolan/jvlc/AbstractJVLCTest.java b/bindings/java/core/src/test/java/org/videolan/jvlc/AbstractJVLCTest.java
index 6bd9cff..9468e85 100644
--- a/bindings/java/core/src/test/java/org/videolan/jvlc/AbstractJVLCTest.java
+++ b/bindings/java/core/src/test/java/org/videolan/jvlc/AbstractJVLCTest.java
@@ -47,7 +47,7 @@ public abstract class AbstractJVLCTest
 
     protected String mrl;
 
-    private String address = "http://streams.videolan.org/streams-videolan/reference/avi/Hero-Div3.avi";
+    private String address = "http://streams.videolan.org/streams-videolan/reference/mp4/bl.mp4";
 
     /**
      * Logger.
@@ -57,7 +57,7 @@ public abstract class AbstractJVLCTest
     @Before
     public void testSetup()
     {
-        jvlc = new JVLC("-vvv --ignore-config --no-media-library -I dummy --aout=dummy --vout=dummy");
+        jvlc = new JVLC("-vvv --ignore-config --no-media-library -I dummy --aout=dummy --vout=dummy --rtsp-host 127.0.0.1:5554");
         downloadSample();
     }
 
diff --git a/bindings/java/core/src/test/java/org/videolan/jvlc/VLMTest.java b/bindings/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
index 6f97709..66b7848 100644
--- a/bindings/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
+++ b/bindings/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
@@ -47,26 +47,48 @@ public class VLMTest extends AbstractJVLCTest
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
     }
+
+    @Test
+    public void testAddVod()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+    }
     
     @Test
-    public void testShowMedia()
+    public void testShowBroadcastMedia()
     {
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
         vlm.showMedia(mediaName);
     }
+
+    @Test
+    public void testShowVodMedia()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.showMedia(mediaName);
+    }
     
     @Test
-    public void testDisableMedia()
+    public void testDisableBroadcastMedia()
     {
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
         vlm.disableMedia(mediaName);
     }
 
+    @Test
+    public void testDisableVodMedia()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.disableMedia(mediaName);
+    }
     
     @Test
-    public void testPauseMedia()
+    public void testPauseBroadcastMedia()
     {
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
@@ -76,7 +98,18 @@ public class VLMTest extends AbstractJVLCTest
     }
 
     @Test
-    public void testStopMedia()
+    public void testPauseVodMedia()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.playMedia(mediaName);
+        vlm.pauseMedia(mediaName);
+        vlm.stopMedia(mediaName);
+    }
+
+
+    @Test
+    public void testStopBroadcastMedia()
     {
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
@@ -85,7 +118,16 @@ public class VLMTest extends AbstractJVLCTest
     }
 
     @Test
-    public void testSeekMedia()
+    public void testStopVodMedia()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.playMedia(mediaName);
+        vlm.stopMedia(mediaName);
+    }
+
+    @Test
+    public void testSeekBroadcastMedia()
     {
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
@@ -93,31 +135,65 @@ public class VLMTest extends AbstractJVLCTest
         vlm.seekMedia(mediaName, 0.3f);
         vlm.stopMedia(mediaName);
     }
-    
+
+    @Test
+    public void testSeekVodMedia()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.playMedia(mediaName);
+        vlm.seekMedia(mediaName, 0.3f);
+        vlm.stopMedia(mediaName);
+    }
+
     @Test
-    public void testAddMediaInput()
+    public void testAddMediaInputToBroadcast()
     {
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
         vlm.addMediaInput(mediaName, "file://" + mrl);
     }
-    
+
     @Test
-    public void testEnableMedia()
+    public void testAddMediaInputToVod()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.addMediaInput(mediaName, "file://" + mrl);
+    }
+
+    @Test
+    public void testEnableBroadcastMedia()
     {
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
         vlm.enableMedia(mediaName);
     }
+
+    @Test
+    public void testEnableVodMedia()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.enableMedia(mediaName);
+    }
     
     @Test
-    public void testDeleteMedia()
+    public void testDeleteBroadcastMedia()
     {
         VLM vlm = jvlc.getVLM();
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
         vlm.deleteMedia(mediaName);
     }
-    
+
+    @Test
+    public void testDeleteVodMedia()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.deleteMedia(mediaName);
+    }
+
     @Test
     public void testMediaLoop()
     {
@@ -125,4 +201,13 @@ public class VLMTest extends AbstractJVLCTest
         vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
         vlm.setMediaLoop(mediaName, true);
     }
+
+    @Test
+    public void testSetMux()
+    {
+        VLM vlm = jvlc.getVLM();
+        vlm.addVod(mediaName, "file://" + mrl, null, true, null);
+        vlm.setMux(mediaName, "ts");
+    }
+
 }




More information about the vlc-devel mailing list