[libbluray-devel] Delay sending of BDJ_EVENT_END_OF_PLAYLIST until application has processed end of playlist event.

hpi1 git at videolan.org
Mon Oct 21 08:14:44 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Oct 21 09:09:42 2013 +0300| [90124ab8bf5d8f8b0a75d81291b605a5f602259d] | committer: hpi1

Delay sending of BDJ_EVENT_END_OF_PLAYLIST until application has processed end of playlist event.
Fixes showing BD-J menus too early.

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

 src/libbluray/bluray.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index c3d23de..74cc891 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -156,6 +156,9 @@ struct bluray {
 #ifdef USING_BDJAVA
     BDJAVA         *bdjava;
 #endif
+    /* delayed sending of BDJ_EVENT_END_OF_PLAYLIST:
+     * 1 - message pending. 3 - message sent. */
+    uint8_t         bdj_end_of_playlist;
 
     /* HDMV graphics */
     GRAPHICS_CONTROLLER *graphics_controller;
@@ -1568,7 +1571,7 @@ static int _bd_read(BLURAY *bd, unsigned char *buf, int len)
                 // We previously reached the last clip.  Nothing
                 // else to read.
                 _queue_event(bd, BD_EVENT_END_OF_TITLE, 0);
-                _bdj_event(bd, BDJ_EVENT_END_OF_PLAYLIST, 0);
+                bd->bdj_end_of_playlist |= 1;
                 return 0;
             }
             if (st->int_buf_off == 6144 || clip_pkt >= st->clip->end_pkt) {
@@ -1600,7 +1603,7 @@ static int _bd_read(BLURAY *bd, unsigned char *buf, int len)
                     if (st->clip == NULL) {
                         BD_DEBUG(DBG_BLURAY | DBG_STREAM, "End of title\n");
                         _queue_event(bd, BD_EVENT_END_OF_TITLE, 0);
-                        _bdj_event(bd, BDJ_EVENT_END_OF_PLAYLIST, 0);
+                        bd->bdj_end_of_playlist |= 1;
                         return 0;
                     }
                     if (!_open_m2ts(bd, st)) {
@@ -1911,6 +1914,7 @@ static int _open_playlist(BLURAY *bd, const char *f_name, unsigned angle)
 
     bd->seamless_angle_change = 0;
     bd->s_pos = 0;
+    bd->bdj_end_of_playlist = 0;
 
     bd_psr_write(bd->regs, PSR_PLAYLIST, atoi(bd->title->name));
     bd_psr_write(bd->regs, PSR_ANGLE_NUMBER, bd->title->angle + 1);
@@ -2919,6 +2923,11 @@ static int _read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
         return 0;
     }
 
+    if (bd->bdj_end_of_playlist == 1) {
+        _bdj_event(bd, BDJ_EVENT_END_OF_PLAYLIST, 0);
+        bd->bdj_end_of_playlist |= 2;
+    }
+
     if (!bd->title && bd->title_type == title_bdj) {
         /* BD-J title running but no playlist playing */
         _queue_event(bd, BD_EVENT_IDLE, 0);



More information about the libbluray-devel mailing list