[libbluray-devel] Implement sending BD-J PlaybackMarkEvent events

hpi1 git at videolan.org
Fri Mar 8 15:18:41 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Mar  8 16:00:13 2013 +0200| [10ca64d6947ec2a044beb39b2fc14c5a7f28abee] | committer: hpi1

Implement sending BD-J PlaybackMarkEvent events
Fixes Ratatouille menus not showing up

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

 src/libbluray/bdj/java/org/videolan/Libbluray.java  |    4 ++++
 .../java/org/videolan/media/content/BDHandler.java  |    8 ++++++++
 .../videolan/media/content/playlist/Handler.java    |    4 ++++
 .../media/content/playlist/PlaybackControlImpl.java |   19 +++++++++++++++++++
 4 files changed, 35 insertions(+)

diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 85f21ae..3f012f2 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -308,6 +308,9 @@ public class Libbluray {
         case BDJ_EVENT_CHAPTER:
             BDHandler.onChapterReach(param);
             break;
+        case BDJ_EVENT_MARK:
+            BDHandler.onMarkReach(param);
+            break;
         case BDJ_EVENT_PLAYITEM:
             BDHandler.onPlayItemReach(param);
             break;
@@ -366,6 +369,7 @@ public class Libbluray {
     private static final int BDJ_EVENT_END_OF_PLAYLIST          = 6;
     private static final int BDJ_EVENT_PTS                      = 7;
     private static final int BDJ_EVENT_VK_KEY                   = 8;
+    private static final int BDJ_EVENT_MARK                     = 9;
 
     public static final int PSR_IG_STREAM_ID     = 0;
     public static final int PSR_PRIMARY_AUDIO_ID = 1;
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 0c720bc..1177e6a 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
@@ -300,6 +300,13 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         }
     }
 
+    public static void onMarkReach(int param) {
+        synchronized (BDHandler.class) {
+            if (activePlayer != null)
+                activePlayer.doMarkReach(param);
+        }
+    }
+
     public static void onPlayItemReach(int param) {
         synchronized (BDHandler.class) {
             if (activePlayer != null)
@@ -329,6 +336,7 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
     }
 
     protected abstract void doChapterReach(int param);
+    protected abstract void doMarkReach(int param);
     protected abstract void doPlayItemReach(int param);
     protected abstract void doAngleChange(int param);
     protected abstract void doSubtitleChange(int param);
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 8521b3c..0cdf2b2 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
@@ -186,9 +186,13 @@ public class Handler extends BDHandler {
     protected void doChapterReach(int param) {
         ((PlaybackControlImpl)controls[9]).onChapterReach(param);
     }
+    protected void doMarkReach(int param) {
+        ((PlaybackControlImpl)controls[9]).onMarkReach(param);
+    }
 
     protected void doPlayItemReach(int param) {
         ((PlaybackControlImpl)controls[9]).onPlayItemReach(param);
+        ((UOMaskTableControlImpl)controls[16]).onPlayItemReach(param);
     }
 
     protected void doAngleChange(int param) {
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PlaybackControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PlaybackControlImpl.java
index 0a1f83e..a5a2902 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PlaybackControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PlaybackControlImpl.java
@@ -121,6 +121,25 @@ public class PlaybackControlImpl implements PlaybackControl {
         }
     }
 
+    protected void onMarkReach(int mark) {
+        if (mark < 0) {
+            return;
+        }
+        PlaylistInfo pi = player.getPlaylistInfo();
+        if (pi == null) {
+            return;
+        }
+        TIMark[] marks = pi.getMarks();
+        if (marks == null) {
+            return;
+        }
+        if (mark >= marks.length) {
+            return;
+        }
+
+        notifyListeners(new PlaybackMarkEvent(this, mark));
+    }
+
     protected void onPlayItemReach(int param) {
         notifyListeners(new PlaybackPlayItemEvent(this, param));
     }



More information about the libbluray-devel mailing list