[libbluray-devel] Simplify handling of BDJ_EVENT_RATE

hpi1 git at videolan.org
Mon May 16 13:40:30 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon May 16 14:28:06 2016 +0300| [a3d84f5b544841c43eb2c07707072fe6c7aed6a4] | committer: hpi1

Simplify handling of BDJ_EVENT_RATE

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

 src/libbluray/bdj/java/org/videolan/Libbluray.java    |    8 +-------
 .../java/org/videolan/media/content/BDHandler.java    |   17 +++++++----------
 .../org/videolan/media/content/PlayerManager.java     |   10 ----------
 3 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 80b275d..1cf601c 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -548,14 +548,8 @@ public class Libbluray {
         case BDJ_EVENT_PTS:
         case BDJ_EVENT_UO_MASKED:
         case BDJ_EVENT_SEEK:
-            PlayerManager.getInstance().onEvent(event, param);
-            break;
         case BDJ_EVENT_RATE:
-            float rate = (float)param / 90000.0f;
-            if (rate < 0.0f) rate = -rate;
-            if (rate < 0.01f) rate = 0.0f;
-            if (rate > 0.99f && rate < 1.01f) rate = 1.0f;
-            PlayerManager.getInstance().onRateChange(rate);
+            PlayerManager.getInstance().onEvent(event, param);
             break;
 
         case BDJ_EVENT_PSR102:
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 a9e25e8..41b176f 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
@@ -345,12 +345,6 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         commandQueue.put(new PlayerAction(this, PlayerAction.ACTION_STATUS, new Integer(event), param));
     }
 
-    protected void rateChanged(float rate) {
-        if (isClosed) return;
-        PlayerAction action = new PlayerAction(this, PlayerAction.ACTION_RATE_CHANGED, new Float(rate));
-        commandQueue.put(action);
-    }
-
     /*
      * handling of notifications from app
      */
@@ -635,9 +629,6 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
                 player.doSetRate((Float)param);
                 break;
 
-            case ACTION_RATE_CHANGED:
-                player.doRateChanged(((Float)param).floatValue());
-                break;
             case ACTION_STATUS:
                 switch (((Integer)param).intValue()) {
                 case Libbluray.BDJ_EVENT_CHAPTER:
@@ -676,6 +667,13 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
                 case Libbluray.BDJ_EVENT_SEEK:
                     player.doSeekNotify(param2 * 2 /* 45kHz -> 90kHz */);
                     break;
+                case Libbluray.BDJ_EVENT_RATE:
+                    float rate = (float)param2 / 90000.0f;
+                    if (rate < 0.0f) rate = -rate;
+                    if (rate < 0.01f) rate = 0.0f;
+                    if (rate > 0.99f && rate < 1.01f) rate = 1.0f;
+                    player.doRateChanged(rate);
+                    break;
                 default:
                     System.err.println("Unknown ACTION_STATUS: id " + param + ", value " + param2);
                     break;
@@ -704,7 +702,6 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         public static final int ACTION_SET_RATE = 9;
 
         public static final int ACTION_STATUS = 10;
-        public static final int ACTION_RATE_CHANGED = 11;
     }
 
     protected int state = Unrealized;
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 d45358b..7019b16 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
@@ -148,15 +148,5 @@ public class PlayerManager {
         }
     }
 
-    public void onRateChange(float rate) {
-        synchronized (stoppingLock) {
-            if (stopping) return;
-        synchronized (playlistPlayerLock) {
-            if (playlistPlayer != null)
-                playlistPlayer.rateChanged(rate);
-        }
-        }
-    }
-
     private static final Logger logger = Logger.getLogger(PlayerManager.class.getName());
 }



More information about the libbluray-devel mailing list