Commit f89d6ff9 authored by Rémi Duraffort's avatar Rémi Duraffort

jvlc: update libvlc_exception_t structure.

parent 18555a9e
......@@ -46,9 +46,9 @@ public class Logger
this.libvlc = jvlc.getLibvlc();
libvlc_exception_t exception = new libvlc_exception_t();
this.logInstance = jvlc.getLibvlc().libvlc_log_open(jvlc.getInstance(), exception);
if (exception.raised == 1)
if (exception.b_raised == 1)
{
throw new RuntimeException("Native exception thrown: " + exception.message);
throw new RuntimeException("Native exception thrown");
}
}
......
......@@ -125,7 +125,7 @@ public class MediaList
{
libvlc_exception_t exception = new libvlc_exception_t();
jvlc.getLibvlc().libvlc_media_list_remove_index(instance, index, exception);
if (exception.raised == 0)
if (exception.b_raised == 0)
{
items.remove(index);
return true;
......
......@@ -44,12 +44,7 @@ public interface LibVlc extends Library
public static class libvlc_exception_t extends Structure
{
public int raised;
public int code;
public String message;
public int b_raised;
}
public static class libvlc_log_message_t extends Structure
......
......@@ -42,7 +42,7 @@ public class LibVlcCoreTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcInstance libvlcInstance = instance.libvlc_new(0, new String[] {"-I","dummy","--aout=dummy","--vout=dummy"}, exception);
Assert.assertNotNull(libvlcInstance);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -59,7 +59,7 @@ public class LibVlcCoreTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcInstance libvlcInstance = instance.libvlc_new(0, new String[] {}, exception);
instance.libvlc_add_intf(libvlcInstance, "dummy", exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
instance.libvlc_release(libvlcInstance);
}
......
......@@ -49,7 +49,7 @@ public class LibVlcLogTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcLog libvlcLog = libvlc.libvlc_log_open(libvlcInstance, exception);
libvlc.libvlc_log_close(libvlcLog, exception);
Assert.assertEquals(exception.message, 0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
//@Test
......@@ -58,7 +58,7 @@ public class LibVlcLogTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcLog libvlcLog = libvlc.libvlc_log_open(libvlcInstance, exception);
libvlc.libvlc_log_clear(libvlcLog, exception);
Assert.assertEquals(exception.message, 0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
Assert.assertEquals(0, libvlc.libvlc_log_count(libvlcLog, exception));
}
......@@ -68,7 +68,7 @@ public class LibVlcLogTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcLog libvlcLog = libvlc.libvlc_log_open(libvlcInstance, exception);
libvlc.libvlc_log_clear(libvlcLog, exception);
Assert.assertEquals(exception.message, 0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
Assert.assertEquals(0, libvlc.libvlc_log_count(libvlcLog, exception));
LibVlcLogIterator logIterator = libvlc.libvlc_log_get_iterator(libvlcLog, exception);
Assert.assertNotNull(logIterator);
......
......@@ -47,7 +47,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
Assert.assertNotNull(mediaListPlayer);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
libvlc.libvlc_media_list_player_release(mediaListPlayer);
}
......@@ -58,7 +58,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
libvlc.libvlc_media_list_release(mediaList);
libvlc.libvlc_media_list_player_release(mediaListPlayer);
}
......@@ -72,7 +72,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
LibVlcMedia mediaDescriptor = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
libvlc.libvlc_media_list_release(mediaList);
libvlc.libvlc_media_list_player_release(mediaListPlayer);
}
......@@ -84,7 +84,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
int result = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
Assert.assertEquals(0, result);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
libvlc.libvlc_media_list_player_release(mediaListPlayer);
}
......@@ -94,7 +94,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);
Assert.assertEquals(1, exception.raised);
Assert.assertEquals(1, exception.b_raised);
libvlc.libvlc_media_list_player_release(mediaListPlayer);
}
......@@ -109,7 +109,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);
Assert.assertEquals("Exception message: " + exception.message + ".\n", 0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
libvlc.libvlc_media_release(mediaDescriptor);
libvlc.libvlc_media_list_release(mediaList);
}
......@@ -127,7 +127,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
while (true)
{
int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
if (exception.raised == 1)
if (exception.b_raised == 1)
{
throw new RuntimeException("Native exception thrown");
}
......@@ -158,11 +158,11 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
libvlc.libvlc_media_list_player_play_item(mediaListPlayer, mediaDescriptor, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
while (true)
{
int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
if (exception.raised == 1)
if (exception.b_raised == 1)
{
throw new RuntimeException("Native exception thrown");
}
......@@ -201,7 +201,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
while (true)
{
int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
if (exception.raised == 1)
if (exception.b_raised == 1)
{
throw new RuntimeException("Native exception thrown");
}
......@@ -214,7 +214,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
libvlc.libvlc_media_list_player_pause(mediaListPlayer, exception);
int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
Assert.assertEquals(exception.message, 0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
Thread.sleep(200L);
Assert.assertEquals(
"Expected state: " + LibVlcState.libvlc_Paused + ".\n",
......@@ -233,7 +233,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
libvlc.libvlc_media_list_player_set_media_player(mediaListPlayer, mi, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -242,7 +242,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
libvlc.libvlc_media_list_player_next(mediaListPlayer, exception);
Assert.assertEquals(1, exception.raised);
Assert.assertEquals(1, exception.b_raised);
}
/**
......@@ -261,7 +261,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
libvlc.libvlc_media_list_player_play_item_at_index(mediaListPlayer, 0, exception);
Thread.sleep(150);
libvlc.libvlc_media_list_player_next(mediaListPlayer, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
libvlc.libvlc_media_list_release(mediaList);
}
......@@ -279,7 +279,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
while (true)
{
int playing = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
if (playing == LibVlcState.libvlc_Playing.ordinal())
{
break;
......@@ -291,7 +291,7 @@ public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
while (true)
{
int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
if (playing == 0)
{
break;
......
......@@ -42,7 +42,7 @@ public class LibVlcMediaListTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
Assert.assertNotNull(mediaList);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -56,7 +56,7 @@ public class LibVlcMediaListTest extends AbstractVLCInternalTest
mrl,
exception);
libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -72,12 +72,12 @@ public class LibVlcMediaListTest extends AbstractVLCInternalTest
libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
int result = libvlc.libvlc_media_list_count(mediaList, exception);
Assert.assertEquals(1, result);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
result = libvlc.libvlc_media_list_count(mediaList, exception);
Assert.assertEquals(2, result);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -86,7 +86,7 @@ public class LibVlcMediaListTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
Assert.assertNotNull(libvlc.libvlc_media_list_event_manager(mediaList, exception));
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -102,7 +102,7 @@ public class LibVlcMediaListTest extends AbstractVLCInternalTest
libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
int index = libvlc.libvlc_media_list_index_of_item(mediaList, libvlc_media, exception);
Assert.assertEquals(0, index);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -117,7 +117,7 @@ public class LibVlcMediaListTest extends AbstractVLCInternalTest
exception);
libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -132,7 +132,7 @@ public class LibVlcMediaListTest extends AbstractVLCInternalTest
exception);
libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
libvlc_media = libvlc.libvlc_media_new(
libvlcInstance,
......
......@@ -38,7 +38,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
{
LibVlcMediaPlayer instance = libvlc.libvlc_media_player_new(libvlcInstance, exception);
Assert.assertNotNull(instance);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -46,7 +46,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
{
LibVlcMediaPlayer instance = libvlc.libvlc_media_player_new(libvlcInstance, exception);
libvlc.libvlc_media_player_play(instance, exception);
Assert.assertEquals(1, exception.raised); // no associated media descriptor
Assert.assertEquals(1, exception.b_raised); // no associated media descriptor
}
@Test
......@@ -55,7 +55,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
libvlc.libvlc_media_player_play(mi, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -65,7 +65,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
Assert.assertEquals(0, libvlc.libvlc_media_player_is_playing(mi, exception));
libvlc.libvlc_media_player_play(mi, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
Thread.sleep(200);
Assert.assertEquals(1, libvlc.libvlc_media_player_is_playing(mi, exception));
}
......@@ -76,7 +76,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
libvlc.libvlc_media_player_pause(mi, exception);
Assert.assertEquals(1, exception.raised);
Assert.assertEquals(1, exception.b_raised);
}
@Test
......@@ -86,7 +86,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
libvlc.libvlc_media_player_play(mi, exception);
libvlc.libvlc_media_player_pause(mi, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -96,7 +96,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
libvlc.libvlc_media_player_play(mi, exception);
libvlc.libvlc_media_player_set_position(mi, 0.5f, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
float position = libvlc.libvlc_media_player_get_position(mi, exception);
Assert.assertTrue("Position is: " + position, position >= 0.5f);
}
......@@ -107,7 +107,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
libvlc.libvlc_media_player_stop(mi, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test(timeout = 2000L)
......@@ -119,7 +119,7 @@ public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
Thread.sleep(100);
libvlc.libvlc_media_player_stop(mi, exception);
Thread.sleep(500);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
}
......@@ -42,7 +42,7 @@ public class LibVlcMediaTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
Assert.assertNotNull(md);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
}
@Test
......@@ -70,7 +70,7 @@ public class LibVlcMediaTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
LibVlcEventManager evManager = libvlc.libvlc_media_event_manager(md, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
Assert.assertNotNull(evManager);
}
......@@ -80,7 +80,7 @@ public class LibVlcMediaTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
int state = libvlc.libvlc_media_get_state(md, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
Assert.assertEquals(LibVlcState.libvlc_NothingSpecial.ordinal(), state);
}
......@@ -90,7 +90,7 @@ public class LibVlcMediaTest extends AbstractVLCInternalTest
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
int state = libvlc.libvlc_media_is_preparsed(md, exception);
Assert.assertEquals(0, exception.raised);
Assert.assertEquals(0, exception.b_raised);
Assert.assertEquals(0, state);
}
......
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