[libbluray-devel] Signal PSR 102 changes to BD-J

npzacs git at videolan.org
Sun Jul 14 10:56:39 CEST 2013


libbluray | branch: master | npzacs <npzacs at gmail.com> | Sun Jul 14 11:30:52 2013 +0300| [e3fec8c9be0fc0f43251c64e07848948ea01d253] | committer: npzacs

Signal PSR 102 changes to BD-J

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

 src/libbluray/bdj/bdj.c                            |    1 +
 src/libbluray/bdj/bdj.h                            |    1 +
 .../bdj/java/org/bluray/bdplus/Status.java         |   26 ++++++++++++++++++++
 src/libbluray/bdj/java/org/videolan/Libbluray.java |    5 ++++
 src/libbluray/bluray.c                             |    4 +++
 5 files changed, 37 insertions(+)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 01dc79e..d44830a 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -486,6 +486,7 @@ int bdj_process_event(BDJAVA *bdjava, unsigned ev, unsigned param)
         "PTS",
         "VK_KEY",
         "MARK",
+        "PSR102",
     };
 
     JNIEnv* env;
diff --git a/src/libbluray/bdj/bdj.h b/src/libbluray/bdj/bdj.h
index 3f76687..4207de5 100644
--- a/src/libbluray/bdj/bdj.h
+++ b/src/libbluray/bdj/bdj.h
@@ -35,6 +35,7 @@ typedef enum {
     BDJ_EVENT_PTS,
     BDJ_EVENT_VK_KEY,
     BDJ_EVENT_MARK,
+    BDJ_EVENT_PSR102,
 } BDJ_EVENT;
 
 /* bdj_get_uo_mask() */
diff --git a/src/libbluray/bdj/java/org/bluray/bdplus/Status.java b/src/libbluray/bdj/java/org/bluray/bdplus/Status.java
index 04be262..09110d9 100644
--- a/src/libbluray/bdj/java/org/bluray/bdplus/Status.java
+++ b/src/libbluray/bdj/java/org/bluray/bdplus/Status.java
@@ -60,6 +60,32 @@ public class Status {
         Libbluray.writePSR(104, data);
     }
 
+    public void receive(int data) {
+        logger.trace("receive(" + data + ")");
+
+        synchronized (listeners) {
+            if (!listeners.isEmpty())
+                org.videolan.BDJActionManager.getInstance().putCallback(new PSR102Callback(data));
+        }
+    }
+
+    private class PSR102Callback extends org.videolan.BDJAction {
+        private PSR102Callback(int value) {
+            this.value = value;
+        }
+
+        protected void doAction() {
+            ArrayList list;
+            synchronized (listeners) {
+                list = (ArrayList)listeners.clone();
+            }
+            for (int i = 0; i < list.size(); i++)
+                ((StatusListener)list.get(i)).receive(value);
+        }
+
+        private int value;
+    }
+
     private static Status instance = null;
     private ArrayList listeners = new ArrayList();
 
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index d9aa61f..a2fa9ee 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -340,6 +340,9 @@ public class Libbluray {
         case BDJ_EVENT_END_OF_PLAYLIST:
             BDHandler.activePlayerEndOfMedia();
             break;
+        case BDJ_EVENT_PSR102:
+            org.bluray.bdplus.Status.getInstance().receive(param);
+            break;
         case BDJ_EVENT_PTS:
             BDHandler.activePlayerUpdateTime(param);
             break;
@@ -396,7 +399,9 @@ public class Libbluray {
     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;
+    private static final int BDJ_EVENT_PSR102                   = 10;
 
+    /* TODO: use org/bluray/system/RegisterAccess instead */
     public static final int PSR_IG_STREAM_ID     = 0;
     public static final int PSR_PRIMARY_AUDIO_ID = 1;
     public static final int PSR_PG_STREAM        = 2;
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 1840d6e..001e1e2 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -2714,6 +2714,10 @@ static void _process_psr_write_event(BLURAY *bd, BD_PSR_EVENT *ev)
             _bdj_event  (bd, BDJ_EVENT_PTS,     ev->new_val);
             break;
 
+        case 102:
+            _bdj_event  (bd, BDJ_EVENT_PSR102,  ev->new_val);
+            break;
+
         default:;
     }
 }



More information about the libbluray-devel mailing list