[libbluray-devel] media player: post MediaTimePositionChangedEvent

hpi1 git at videolan.org
Sat Apr 30 14:31:11 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Apr 29 20:48:20 2016 +0300| [fba700be63efa172617da3e059ed92c8bacdbc6f] | committer: hpi1

media player: post MediaTimePositionChangedEvent

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=fba700be63efa172617da3e059ed92c8bacdbc6f
---

 .../bdj/java/org/videolan/media/content/BDHandler.java      |   11 +++++++++++
 .../content/playlist/MediaTimePositionControlImpl.java      |    2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java b/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
index 1a6febb..b08649e 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
@@ -53,6 +53,8 @@ import javax.media.protocol.DataSource;
 import javax.tv.locator.Locator;
 import javax.tv.service.selection.ServiceContentHandler;
 
+import org.davic.media.MediaTimePositionChangedEvent;
+
 import org.bluray.media.OverallGainControl;
 
 import org.videolan.BDJAction;
@@ -220,6 +222,11 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         action.waitEnd();
     }
 
+    public void setMediaTimePosition(Time mediaTime) {
+        setMediaTime(mediaTime);
+        postMediaTimePositionChangedEvent();
+    }
+
     public Time mapToTimeBase(Time t) throws ClockStoppedException {
         if (state != Started)
             throw new ClockStoppedException();
@@ -440,6 +447,10 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         notifyListeners(new StopTimeChangeEvent(this, getStopTime()));
     }
 
+    protected void postMediaTimePositionChangedEvent() {
+        notifyListeners(new MediaTimePositionChangedEvent(this, getState(), getState(), getState(), getMediaTime()));
+    }
+
     private void notifyListeners(ControllerEvent event) {
         listeners.putCallback(event);
     }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/MediaTimePositionControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/MediaTimePositionControlImpl.java
index 74c9541..f7e6d7a 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/MediaTimePositionControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/MediaTimePositionControlImpl.java
@@ -35,7 +35,7 @@ public class MediaTimePositionControlImpl implements MediaTimePositionControl {
     }
 
     public Time setMediaTimePosition(Time mediaTime) {
-        player.setMediaTime(mediaTime);
+        player.setMediaTimePosition(mediaTime);
         return player.getMediaTime();
     }
 



More information about the libbluray-devel mailing list