[libbluray-devel] BD-J: Separate playlist player prefetch and start.

hpi1 git at videolan.org
Fri Oct 24 12:31:07 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Oct 23 11:25:31 2014 +0300| [48c8fa525ab080893d809b89dc32b0dc4cc8dd0e] | committer: hpi1

BD-J: Separate playlist player prefetch and start.

Fixes triggering playback status events too early.

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

 src/libbluray/bluray.c |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index f6e289e..16374ce 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -164,6 +164,7 @@ struct bluray {
     /* delayed sending of BDJ_EVENT_END_OF_PLAYLIST:
      * 1 - message pending. 3 - message sent. */
     uint8_t         bdj_end_of_playlist;
+    uint8_t         bdj_wait_start;  /* BD-J has selected playlist (prefetch) but not yet started playback */
 
     /* HDMV graphics */
     GRAPHICS_CONTROLLER *graphics_controller;
@@ -1113,10 +1114,16 @@ uint64_t bd_get_uo_mask(BLURAY *bd)
 
 void bd_select_rate(BLURAY *bd, float rate, int reason)
 {
-    if (reason == 2) {
+    if (reason == BDJ_PLAYBACK_STOP) {
         /* playback stop. Might want to wait for buffers empty here. */
         return;
     }
+
+    if (reason == BDJ_PLAYBACK_START) {
+        /* playback is triggered by bd_select_rate() */
+        bd->bdj_wait_start = 0;
+    }
+
     if (rate < 0.5) {
         _queue_event(bd, BD_EVENT_STILL, 1);
     } else {
@@ -2227,6 +2234,8 @@ static int _play_playlist_at(BLURAY *bd, int playlist, int playitem, int playmar
         return 0;
     }
 
+    bd->bdj_wait_start = 1;  /* playback is triggered by bd_select_rate() */
+
     if (playitem > 0) {
         bd_seek_playitem(bd, playitem);
     }
@@ -3273,6 +3282,14 @@ static int _read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
         return 0;
     }
 
+    if (bd->title_type == title_bdj) {
+        if (bd->bdj_wait_start) {
+            /* BD-J playlist prefethed but not yet playing */
+            _queue_event(bd, BD_EVENT_IDLE, 1);
+            return 0;
+        }
+    }
+
     int bytes = _bd_read(bd, buf, len);
 
     if (bytes == 0) {



More information about the libbluray-devel mailing list