[libbluray-devel] Run player callbacks in right xlet context

hpi1 git at videolan.org
Fri Dec 6 12:48:13 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Dec  6 13:44:53 2013 +0200| [6560b4344f50387c2bd03b36430aa8ca29c12550] | committer: hpi1

Run player callbacks in right xlet context

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

 .../bdj/java/org/videolan/media/content/BDHandler.java     |   12 ++++++++++++
 .../videolan/media/content/playlist/AngleControlImpl.java  |    1 +
 .../videolan/media/content/playlist/PiPControlImpl.java    |    1 +
 .../media/content/playlist/PlaybackControlImpl.java        |    1 +
 .../media/content/playlist/SubtitlingControlImpl.java      |    1 +
 .../media/content/playlist/UOMaskTableControlImpl.java     |    1 +
 6 files changed, 17 insertions(+)

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 1177e6a..9caf9ab 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
@@ -56,10 +56,20 @@ import org.bluray.net.BDLocator;
 
 import org.videolan.BDJAction;
 import org.videolan.BDJActionManager;
+import org.videolan.BDJXletContext;
+import org.videolan.Logger;
 
 public abstract class BDHandler implements Player, ServiceContentHandler {
     public BDHandler() {
+        BDJXletContext ownerContext = BDJXletContext.getCurrentContext();
+        if (ownerContext == null) {
+            Logger.getLogger(BDHandler.class.getName()).error("Create BDHandler from wrong thread: " + org.videolan.Logger.dumpStack());
+        }
+        this.ownerContext = ownerContext;
+    }
 
+    public BDJXletContext getOwnerContext() {
+        return this.ownerContext;
     }
 
     private void checkUnrealized() {
@@ -539,6 +549,7 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
 
     private class PlayerCallback extends BDJAction {
         private PlayerCallback(BDHandler player, ControllerEvent event) {
+            super(player.ownerContext);
             this.player = player;
             this.event = event;
         }
@@ -618,6 +629,7 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
     protected float rate = 1.0f;
     protected Control[] controls = null;
     protected BDLocator locator = null;
+    protected BDJXletContext ownerContext;
     private LinkedList listeners = new LinkedList();
 
     public static final double TO_SECONDS = 1 / 90000.0d;
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/AngleControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/AngleControlImpl.java
index c72dd71..6052e0b 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/AngleControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/AngleControlImpl.java
@@ -78,6 +78,7 @@ public class AngleControlImpl implements AngleControl {
 
     private class AngleCallback extends BDJAction {
         private AngleCallback(AngleControlImpl control, int angle) {
+            super(control.player.getOwnerContext());
             this.control = control;
             this.angle = angle;
         }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
index 0cb264f..2921243 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
@@ -111,6 +111,7 @@ public class PiPControlImpl extends VideoControl implements PiPControl, Asynchro
 
     private class PiPCallback extends BDJAction {
         private PiPCallback(PiPControlImpl control, boolean available) {
+            super(control.player.getOwnerContext());
             this.control = control;
             this.available = available;
         }
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 a5a2902..e92eb7e 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
@@ -154,6 +154,7 @@ public class PlaybackControlImpl implements PlaybackControl {
 
     private class PlayeBackCallback extends BDJAction {
         private PlayeBackCallback(PlaybackControlImpl control, Object event) {
+            super(control.player.getOwnerContext());
             this.control = control;
             this.event = event;
         }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
index e84db55..841e518 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
@@ -146,6 +146,7 @@ public class SubtitlingControlImpl extends StreamControl implements SubtitlingCo
 
     private class SubtitleCallback extends BDJAction {
         private SubtitleCallback(SubtitlingControlImpl control) {
+            super(control.player.getOwnerContext());
             this.control = control;
         }
 
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/UOMaskTableControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/UOMaskTableControlImpl.java
index d2b6881..f8a8471 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/UOMaskTableControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/UOMaskTableControlImpl.java
@@ -86,6 +86,7 @@ public class UOMaskTableControlImpl implements UOMaskTableControl {
 
     private class UOMaskTableCallback extends BDJAction {
         private UOMaskTableCallback(UOMaskTableControlImpl control, Object event) {
+            super(control.player.getOwnerContext());
             this.control = control;
             this.event = event;
         }



More information about the libbluray-devel mailing list