[vlc-devel] commit: jvlc: MediaPlayerListener stopped method added (Filippo Carone )
git version control
git at videolan.org
Mon Jul 21 22:21:33 CEST 2008
vlc | branch: master | Filippo Carone <littlejohn at videolan.org> | Mon Jul 21 22:21:31 2008 +0200| [45942f34f38c6a97f1359d9fd06d17d6710da4d4]
jvlc: MediaPlayerListener stopped method added
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45942f34f38c6a97f1359d9fd06d17d6710da4d4
---
.../java/org/videolan/jvlc/MediaDescriptor.java | 2 +-
.../videolan/jvlc/event/MediaPlayerCallback.java | 6 ++-
.../videolan/jvlc/event/MediaPlayerListener.java | 14 +++--
.../java/org/videolan/jvlc/example/VLCExample.java | 51 +++++++++++---------
4 files changed, 42 insertions(+), 31 deletions(-)
diff --git a/bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java b/bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
index 34e672f..d282963 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
@@ -69,7 +69,7 @@ public class MediaDescriptor
return libvlc.libvlc_media_get_mrl(instance);
}
- public MediaPlayer getMediaInstance()
+ public MediaPlayer getMediaPlayer()
{
return new MediaPlayer(this);
}
diff --git a/bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerCallback.java b/bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerCallback.java
index db878e7..5533c74 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerCallback.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerCallback.java
@@ -53,7 +53,7 @@ public class MediaPlayerCallback implements LibVlcCallback
{
if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerPlaying.ordinal())
{
- listener.played(mediaInstance);
+ listener.playing(mediaInstance);
}
else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerPaused.ordinal())
{
@@ -67,6 +67,10 @@ public class MediaPlayerCallback implements LibVlcCallback
{
listener.positionChanged(mediaInstance);
}
+ else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerStopped.ordinal())
+ {
+ listener.stopped(mediaInstance);
+ }
else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerTimeChanged.ordinal())
{
libvlc_event.event_type_specific.setType(LibVlc.media_player_time_changed.class);
diff --git a/bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerListener.java b/bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerListener.java
index 5ebaf37..8877522 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerListener.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerListener.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * MediaInstancePlayListener.java: VLC Java Bindings
+ * mediaPlayerPlayListener.java: VLC Java Bindings
*****************************************************************************
* Copyright (C) 1998-2008 the VideoLAN team
*
@@ -31,14 +31,16 @@ import org.videolan.jvlc.MediaPlayer;
public interface MediaPlayerListener
{
- void played(MediaPlayer mediaInstance);
+ void playing(MediaPlayer mediaPlayer);
- void paused(MediaPlayer mediaInstance);
+ void paused(MediaPlayer mediaPlayer);
- void endReached(MediaPlayer mediaInstance);
+ void stopped(MediaPlayer mediaPlayer);
- void timeChanged(MediaPlayer mediaInstance, long newTime);
+ void endReached(MediaPlayer mediaPlayer);
- void positionChanged(MediaPlayer mediaInstance);
+ void timeChanged(MediaPlayer mediaPlayer, long newTime);
+
+ void positionChanged(MediaPlayer mediaPlayer);
}
diff --git a/bindings/java/core/src/main/java/org/videolan/jvlc/example/VLCExample.java b/bindings/java/core/src/main/java/org/videolan/jvlc/example/VLCExample.java
index 41ec321..0d51620 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/example/VLCExample.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/example/VLCExample.java
@@ -30,54 +30,59 @@ public class VLCExample
System.out.println("... done.");
MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, "/home/carone/apps/a.avi");
- MediaPlayer mediaInstance = mediaDescriptor.getMediaInstance();
+ MediaPlayer mediaPlayer = mediaDescriptor.getMediaPlayer();
- mediaInstance.addListener(new MediaPlayerListener()
+ mediaPlayer.addListener(new MediaPlayerListener()
{
- public void endReached(MediaPlayer mediaInstance)
+ public void endReached(MediaPlayer mediaPlayer)
{
- System.out.println("Media instance end reached. MRL: " + mediaInstance.getMediaDescriptor().getMrl());
+ System.out.println("Media instance end reached. MRL: " + mediaPlayer.getMediaDescriptor().getMrl());
}
- public void paused(MediaPlayer mediaInstance)
+ public void paused(MediaPlayer mediaPlayer)
{
- System.out.println("Media instance paused. MRL: " + mediaInstance.getMediaDescriptor().getMrl());
+ System.out.println("Media instance paused. MRL: " + mediaPlayer.getMediaDescriptor().getMrl());
}
- public void played(MediaPlayer mediaInstance)
+ public void playing(MediaPlayer mediaPlayer)
{
- System.out.println("Media instance played. MRL: " + mediaInstance.getMediaDescriptor().getMrl());
+ System.out.println("Media instance played. MRL: " + mediaPlayer.getMediaDescriptor().getMrl());
}
- public void positionChanged(MediaPlayer mediaInstance)
+ public void positionChanged(MediaPlayer mediaPlayer)
{
// TODO Auto-generated method stub
}
- public void timeChanged(MediaPlayer mediaInstance, long newTime)
+ public void timeChanged(MediaPlayer mediaPlayer, long newTime)
{
System.out.println("new time: " + newTime);
}
+
+ public void stopped(MediaPlayer mediaPlayer)
+ {
+ System.out.println("Media player stopped. MRL: " + mediaPlayer.getMediaDescriptor().getMrl());
+ }
});
- mediaInstance.play();
+ mediaPlayer.play();
- while (!mediaInstance.hasVideoOutput())
+ while (!mediaPlayer.hasVideoOutput())
{
Thread.sleep(100);
}
Video video = new Video(jvlc);
- System.out.print(video.getWidth(mediaInstance));
+ System.out.print(video.getWidth(mediaPlayer));
System.out.print("x");
- System.out.println(video.getHeight(mediaInstance));
+ System.out.println(video.getHeight(mediaPlayer));
System.out.print("Fullscreen... ");
- video.setFullscreen(mediaInstance, true);
+ video.setFullscreen(mediaPlayer, true);
Thread.sleep(3000);
System.out.println("real size.");
- video.setFullscreen(mediaInstance, false);
+ video.setFullscreen(mediaPlayer, false);
System.out.print("Taking snapshot... ");
- video.getSnapshot(mediaInstance, System.getProperty("user.dir") + "/snap.png", 0, 0);
+ video.getSnapshot(mediaPlayer, System.getProperty("user.dir") + "/snap.png", 0, 0);
System.out.println("taken. (see " + System.getProperty("user.dir") + "/snap.png )");
Thread.sleep(2000);
System.out.println("Resizing to 300x300");
@@ -95,15 +100,15 @@ public class VLCExample
audio.setVolume(150);
System.out.println("done");
System.out.println("== AUDIO INFO ==");
- System.out.println("Audio track number: " + audio.getTrack(mediaInstance));
+ System.out.println("Audio track number: " + audio.getTrack(mediaPlayer));
System.out.println("Audio channel info: " + audio.getChannel());
Thread.sleep(3000);
- System.out.println("MEDIA INSTANCE INFORMATION");
+ System.out.println("MEDIA PLAYER INFORMATION");
System.out.println("--------------------------");
- System.out.println("Total length (ms) :\t" + mediaInstance.getLength());
- System.out.println("Input time (ms) :\t" + mediaInstance.getTime());
- System.out.println("Input position [0-1]:\t" + mediaInstance.getPosition());
- System.out.println("Input FPS :\t" + mediaInstance.getFPS());
+ System.out.println("Total length (ms) :\t" + mediaPlayer.getLength());
+ System.out.println("Input time (ms) :\t" + mediaPlayer.getTime());
+ System.out.println("Input position [0-1]:\t" + mediaPlayer.getPosition());
+ System.out.println("Input FPS :\t" + mediaPlayer.getFPS());
System.out.println("Everything fine ;)");
return;
More information about the vlc-devel
mailing list