[libbluray-devel] BDJ: ignore old end of playlist events

hpi1 git at videolan.org
Fri Apr 25 14:42:08 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Apr 25 15:04:02 2014 +0300| [85a9a2c9e640b657edde3eda454e81314ea6903c] | committer: hpi1

BDJ: ignore old end of playlist events

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

 src/libbluray/bdj/java/org/videolan/Libbluray.java          |    2 +-
 .../bdj/java/org/videolan/media/content/BDHandler.java      |    2 +-
 .../bdj/java/org/videolan/media/content/PlayerManager.java  |    4 ++--
 .../java/org/videolan/media/content/playlist/Handler.java   |   11 +++++++++++
 src/libbluray/bluray.c                                      |    2 +-
 5 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index f6b61ed..0a15577 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -372,7 +372,7 @@ public class Libbluray {
             if (rate > 0.99f && rate < 1.01f) rate = 1.0f;
             PlayerManager.getInstance().onRateChange(rate);
         case BDJ_EVENT_END_OF_PLAYLIST:
-            PlayerManager.getInstance().onPlaylistEnd();
+            PlayerManager.getInstance().onPlaylistEnd(param);
             break;
         case BDJ_EVENT_PSR102:
             org.bluray.bdplus.Status.getInstance().receive(param);
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 a7c3364..be3871f 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
@@ -321,7 +321,7 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         commandQueue.shutdown();
     }
 
-    protected void endOfMedia() {
+    protected void endOfMedia(int playlist) {
         if (isClosed) return;
 
         PlayerAction action = new PlayerAction(this, PlayerAction.ACTION_END_OF_MEDIA, null);
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java b/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
index 53e70e3..b0b46d0 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
@@ -114,10 +114,10 @@ public class PlayerManager {
      *
      */
 
-    public void onPlaylistEnd() {
+    public void onPlaylistEnd(int playlist) {
         synchronized (playlistPlayerLock) {
             if (playlistPlayer != null)
-                playlistPlayer.endOfMedia();
+                playlistPlayer.endOfMedia(playlist);
         }
     }
 
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
index 41250a3..7258fe2 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
@@ -226,6 +226,17 @@ public class Handler extends BDHandler {
         ((PiPControlImpl)controls[8]).onPiPChange(param);
     }
 
+    protected void endOfMedia(int playlist) {
+        synchronized (this) {
+            if (locator == null || locator.getPlayListId() != playlist) {
+                System.err.println("endOfMedia ignored: playlist does not match (" + playlist + " != " + locator.getPlayListId());
+                return;
+            }
+        }
+
+        super.endOfMedia(playlist);
+    }
+
     protected BDLocator getLocator() {
         return locator;
     }
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index d7074b9..42221ca 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -3196,7 +3196,7 @@ static int _read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
     }
 
     if (bd->bdj_end_of_playlist == 1) {
-        _bdj_event(bd, BDJ_EVENT_END_OF_PLAYLIST, 0);
+        _bdj_event(bd, BDJ_EVENT_END_OF_PLAYLIST, bd_psr_read(bd->regs, PSR_PLAYLIST));
         bd->bdj_end_of_playlist |= 2;
     }
 



More information about the libbluray-devel mailing list