Commit 1c4b6c51 authored by Alexandre Perraud's avatar Alexandre Perraud

LibVLC: add Buffering event

parent 7a7bb055
......@@ -30,6 +30,7 @@ JNIEnv *jni_get_env(const char *name);
static const libvlc_event_type_t mp_events[] = {
libvlc_MediaPlayerMediaChanged,
libvlc_MediaPlayerOpening,
libvlc_MediaPlayerBuffering,
libvlc_MediaPlayerPlaying,
libvlc_MediaPlayerPaused,
libvlc_MediaPlayerStopped,
......@@ -75,6 +76,9 @@ MediaPlayer_event_cb(vlcjni_object *p_obj, const libvlc_event_t *p_ev,
{
switch (p_ev->type)
{
case libvlc_MediaPlayerBuffering:
p_java_event->arg2 = p_ev->u.media_player_buffering.new_cache;
break;
case libvlc_MediaPlayerPositionChanged:
p_java_event->arg2 = p_ev->u.media_player_position_changed.new_position;
break;
......
......@@ -29,7 +29,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
public static final int MediaChanged = 0x100;
//public static final int NothingSpecial = 0x101;
public static final int Opening = 0x102;
//public static final int Buffering = 0x103;
public static final int Buffering = 0x103;
public static final int Playing = 0x104;
public static final int Paused = 0x105;
public static final int Stopped = 0x106;
......@@ -78,6 +78,9 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
public boolean getSeekable() {
return arg1 != 0;
}
public float getBuffering() {
return arg2;
}
}
public interface EventListener extends VLCEvent.Listener<MediaPlayer.Event> {}
......@@ -811,6 +814,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
mVoutCount = 0;
notify();
case Event.Opening:
case Event.Buffering:
return new Event(eventType, arg2);
case Event.Playing:
case Event.Paused:
return new Event(eventType);
......
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