Commit e2644877 authored by Adrien Grand's avatar Adrien Grand Committed by Filippo Carone

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@videolan.org>
Date: Sun, 20 Jul 2008 18:10:52 +0200
Subject: [PATCH] Java bindings: Add VOD support.
Signed-off-by: default avatarFilippo Carone <littlejohn@videolan.org>
parent 2a641d19
...@@ -55,6 +55,20 @@ public class VLM ...@@ -55,6 +55,20 @@ public class VLM
exception); 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) public void deleteMedia(String name)
{ {
libvlc_exception_t exception = new libvlc_exception_t(); libvlc_exception_t exception = new libvlc_exception_t();
...@@ -91,6 +105,12 @@ public class VLM ...@@ -91,6 +105,12 @@ public class VLM
jvlc.getLibvlc().libvlc_vlm_add_input(jvlc.getInstance(), name, input, exception); 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) public void setMediaLoop(String media, boolean loop)
{ {
libvlc_exception_t exception = new libvlc_exception_t(); libvlc_exception_t exception = new libvlc_exception_t();
...@@ -166,6 +186,4 @@ public class VLM ...@@ -166,6 +186,4 @@ public class VLM
super.finalize(); super.finalize();
} }
} }
...@@ -510,6 +510,9 @@ public interface LibVlc extends Library ...@@ -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, 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); 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_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); 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 ...@@ -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_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, 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); int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
......
...@@ -47,7 +47,7 @@ public abstract class AbstractJVLCTest ...@@ -47,7 +47,7 @@ public abstract class AbstractJVLCTest
protected String mrl; 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. * Logger.
...@@ -57,7 +57,7 @@ public abstract class AbstractJVLCTest ...@@ -57,7 +57,7 @@ public abstract class AbstractJVLCTest
@Before @Before
public void testSetup() 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(); downloadSample();
} }
......
...@@ -49,7 +49,14 @@ public class VLMTest extends AbstractJVLCTest ...@@ -49,7 +49,14 @@ public class VLMTest extends AbstractJVLCTest
} }
@Test @Test
public void testShowMedia() public void testAddVod()
{
VLM vlm = jvlc.getVLM();
vlm.addVod(mediaName, "file://" + mrl, null, true, null);
}
@Test
public void testShowBroadcastMedia()
{ {
VLM vlm = jvlc.getVLM(); VLM vlm = jvlc.getVLM();
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
...@@ -57,16 +64,31 @@ public class VLMTest extends AbstractJVLCTest ...@@ -57,16 +64,31 @@ public class VLMTest extends AbstractJVLCTest
} }
@Test @Test
public void testDisableMedia() public void testShowVodMedia()
{
VLM vlm = jvlc.getVLM();
vlm.addVod(mediaName, "file://" + mrl, null, true, null);
vlm.showMedia(mediaName);
}
@Test
public void testDisableBroadcastMedia()
{ {
VLM vlm = jvlc.getVLM(); VLM vlm = jvlc.getVLM();
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
vlm.disableMedia(mediaName); vlm.disableMedia(mediaName);
} }
@Test
public void testDisableVodMedia()
{
VLM vlm = jvlc.getVLM();
vlm.addVod(mediaName, "file://" + mrl, null, true, null);
vlm.disableMedia(mediaName);
}
@Test @Test
public void testPauseMedia() public void testPauseBroadcastMedia()
{ {
VLM vlm = jvlc.getVLM(); VLM vlm = jvlc.getVLM();
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
...@@ -76,7 +98,18 @@ public class VLMTest extends AbstractJVLCTest ...@@ -76,7 +98,18 @@ public class VLMTest extends AbstractJVLCTest
} }
@Test @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 vlm = jvlc.getVLM();
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
...@@ -85,7 +118,16 @@ public class VLMTest extends AbstractJVLCTest ...@@ -85,7 +118,16 @@ public class VLMTest extends AbstractJVLCTest
} }
@Test @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 vlm = jvlc.getVLM();
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
...@@ -95,7 +137,17 @@ public class VLMTest extends AbstractJVLCTest ...@@ -95,7 +137,17 @@ public class VLMTest extends AbstractJVLCTest
} }
@Test @Test
public void testAddMediaInput() 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 testAddMediaInputToBroadcast()
{ {
VLM vlm = jvlc.getVLM(); VLM vlm = jvlc.getVLM();
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
...@@ -103,7 +155,15 @@ public class VLMTest extends AbstractJVLCTest ...@@ -103,7 +155,15 @@ public class VLMTest extends AbstractJVLCTest
} }
@Test @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 vlm = jvlc.getVLM();
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
...@@ -111,13 +171,29 @@ public class VLMTest extends AbstractJVLCTest ...@@ -111,13 +171,29 @@ public class VLMTest extends AbstractJVLCTest
} }
@Test @Test
public void testDeleteMedia() public void testEnableVodMedia()
{
VLM vlm = jvlc.getVLM();
vlm.addVod(mediaName, "file://" + mrl, null, true, null);
vlm.enableMedia(mediaName);
}
@Test
public void testDeleteBroadcastMedia()
{ {
VLM vlm = jvlc.getVLM(); VLM vlm = jvlc.getVLM();
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
vlm.deleteMedia(mediaName); vlm.deleteMedia(mediaName);
} }
@Test
public void testDeleteVodMedia()
{
VLM vlm = jvlc.getVLM();
vlm.addVod(mediaName, "file://" + mrl, null, true, null);
vlm.deleteMedia(mediaName);
}
@Test @Test
public void testMediaLoop() public void testMediaLoop()
{ {
...@@ -125,4 +201,13 @@ public class VLMTest extends AbstractJVLCTest ...@@ -125,4 +201,13 @@ public class VLMTest extends AbstractJVLCTest
vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false); vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
vlm.setMediaLoop(mediaName, true); vlm.setMediaLoop(mediaName, true);
} }
@Test
public void testSetMux()
{
VLM vlm = jvlc.getVLM();
vlm.addVod(mediaName, "file://" + mrl, null, true, null);
vlm.setMux(mediaName, "ts");
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment