[libbluray-devel] Improve BDJ_EVENT_CHAPTER triggering

hpi1 git at videolan.org
Fri May 13 09:37:46 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Apr 15 14:30:09 2016 +0300| [cf162d1dde8d5a25593faabf2d09909f853e1baa] | committer: hpi1

Improve BDJ_EVENT_CHAPTER triggering

Avoid duplicate chapter event when passing link mark.
Do not send chapter event when there are no chapters (psr == 0xffff).

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

 src/libbluray/bluray.c |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 86a92e0..0e60b68 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -2288,12 +2288,7 @@ static int _open_playlist(BLURAY *bd, const char *f_name, unsigned angle)
 
     bd_psr_write(bd->regs, PSR_PLAYLIST, atoi(bd->title->name));
     bd_psr_write(bd->regs, PSR_ANGLE_NUMBER, bd->title->angle + 1);
-
-    if (_is_interactive_title(bd)) {
-        bd_psr_write(bd->regs, PSR_CHAPTER, 0xffff);
-    } else {
-        bd_psr_write(bd->regs, PSR_CHAPTER, 1);
-    }
+    bd_psr_write(bd->regs, PSR_CHAPTER, 0xffff);
 
     // Get the initial clip of the playlist
     bd->st0.clip = nav_next_clip(bd->title, NULL);
@@ -2943,10 +2938,6 @@ static void _process_psr_write_event(BLURAY *bd, BD_PSR_EVENT *ev)
             _bdj_event  (bd, BDJ_EVENT_PLAYITEM,ev->new_val);
             _queue_event(bd, BD_EVENT_PLAYITEM, ev->new_val);
             break;
-        case PSR_CHAPTER:
-            _bdj_event  (bd, BDJ_EVENT_CHAPTER, ev->new_val);
-            _queue_event(bd, BD_EVENT_CHAPTER,  ev->new_val);
-            break;
         case PSR_TIME:
             _bdj_event  (bd, BDJ_EVENT_PTS,     ev->new_val);
             break;
@@ -2976,6 +2967,13 @@ static void _process_psr_change_event(BLURAY *bd, BD_PSR_EVENT *ev)
             disc_event(bd->disc, DISC_EVENT_TITLE, ev->new_val);
             break;
 
+        case PSR_CHAPTER:
+            _bdj_event  (bd, BDJ_EVENT_CHAPTER, ev->new_val);
+            if (ev->new_val != 0xffff) {
+                _queue_event(bd, BD_EVENT_CHAPTER,  ev->new_val);
+            }
+            break;
+
         /* stream selection */
 
         case PSR_IG_STREAM_ID:



More information about the libbluray-devel mailing list