Commit 71c4969b authored by Filippo Carone's avatar Filippo Carone

jvlc: libvlc state and event type enums aligned with libvlc

parent f9281a91
......@@ -156,7 +156,7 @@ public class MediaPlayer
MediaInstanceCallback callback = new MediaInstanceCallback(this, listener);
libvlc_exception_t exception = new libvlc_exception_t();
for (LibVlcEventType event : EnumSet.range(
LibVlcEventType.libvlc_MediaPlayerPlayed,
LibVlcEventType.libvlc_MediaPlayerPlaying,
LibVlcEventType.libvlc_MediaPlayerTimeChanged))
{
libvlc.libvlc_event_attach(eventManager, event.ordinal(), callback, null, exception);
......@@ -174,7 +174,7 @@ public class MediaPlayer
for (MediaInstanceCallback callback : callbacks)
{
for (LibVlcEventType event : EnumSet.range(
LibVlcEventType.libvlc_MediaPlayerPlayed,
LibVlcEventType.libvlc_MediaPlayerPlaying,
LibVlcEventType.libvlc_MediaPlayerPositionChanged))
{
libvlc.libvlc_event_detach(eventManager, event.ordinal(), callback, null, exception);
......
......@@ -51,7 +51,7 @@ public class MediaInstanceCallback implements LibVlcCallback
*/
public void callback(libvlc_event_t libvlc_event, Pointer userData)
{
if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerPlayed.ordinal())
if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerPlaying.ordinal())
{
listener.played(mediaInstance);
}
......
......@@ -34,11 +34,36 @@ public enum LibVlcEventType {
libvlc_MediaPreparsedChanged,
libvlc_MediaFreed,
libvlc_MediaStateChanged,
libvlc_MediaPlayerPlayed,
libvlc_MediaPlayerNothingSpecial,
libvlc_MediaPlayerOpening,
libvlc_MediaPlayerBuffering,
libvlc_MediaPlayerPlaying,
libvlc_MediaPlayerPaused,
libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerStopped,
libvlc_MediaPlayerForward,
libvlc_MediaPlayerBackward,
libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerTimeChanged,
libvlc_MediaPlayerPositionChanged;
libvlc_MediaPlayerPositionChanged,
libvlc_MediaPlayerSeekableChanged,
libvlc_MediaPlayerPausableChanged,
libvlc_MediaListItemAdded,
libvlc_MediaListWillAddItem,
libvlc_MediaListItemDeleted,
libvlc_MediaListWillDeleteItem,
libvlc_MediaListViewItemAdded,
libvlc_MediaListViewWillAddItem,
libvlc_MediaListViewItemDeleted,
libvlc_MediaListViewWillDeleteItem,
libvlc_MediaListPlayerPlayed,
libvlc_MediaListPlayerNextItemSet,
libvlc_MediaListPlayerStopped,
libvlc_MediaDiscovererStarted,
libvlc_MediaDiscovererEnded;
}
......@@ -92,7 +92,7 @@ public class LibVlcImpl
libVlc.libvlc_event_attach(
mediaInstanceEventManager,
LibVlcEventType.libvlc_MediaPlayerPlayed.ordinal(),
LibVlcEventType.libvlc_MediaPlayerPlaying.ordinal(),
played,
null,
exception);
......
......@@ -29,11 +29,13 @@ package org.videolan.jvlc.internal;
public enum LibVlcState
{
libvlc_NothingSpecial,
libvlc_Stopped,
libvlc_Opening,
libvlc_Buffering,
libvlc_Ended,
libvlc_Error,
libvlc_Playing,
libvlc_Paused
libvlc_Paused,
libvlc_Stopped,
libvlc_Forward,
libvlc_Backward,
libvlc_Ended,
libvlc_Error;
}
......@@ -200,12 +200,12 @@ public class MediaListPlayerTest
}
@Test
public void mediaListPlayerGetStateStopped()
public void mediaListPlayerGetStateEnded()
{
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
Assert.assertEquals(LibVlcState.libvlc_Stopped.ordinal(), state);
Assert.assertEquals(LibVlcState.libvlc_Ended.ordinal(), state);
libvlc.libvlc_media_list_player_release(mediaListPlayer);
}
......@@ -331,7 +331,7 @@ public class MediaListPlayerTest
}
Thread.sleep(150);
}
Assert.assertEquals(LibVlcState.libvlc_Stopped.ordinal(), libvlc.libvlc_media_list_player_get_state(
Assert.assertEquals(LibVlcState.libvlc_Ended.ordinal(), libvlc.libvlc_media_list_player_get_state(
mediaListPlayer,
exception));
libvlc.libvlc_media_list_release(mediaList);
......
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