[libbluray-devel] Fix setting chapter PSR in interactive titles

hpi1 git at videolan.org
Mon Apr 14 10:58:07 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Apr 14 11:01:01 2014 +0300| [c49c8fc6c9bf4794c3e7c3c7d3090b560e320ffd] | committer: hpi1

Fix setting chapter PSR in interactive titles

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

 src/libbluray/bluray.c |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 3c9b49d..acea045 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -380,10 +380,26 @@ static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
     }
 }
 
+static int _is_interactive_title(BLURAY *bd)
+{
+    if (bd->title && bd->title_type != title_undef) {
+        unsigned title = bd_psr_read(bd->regs, PSR_TITLE_NUMBER);
+        if (title == 0xffff && bd->disc_info.first_play->interactive) {
+            return 1;
+        }
+        if (title <= bd->disc_info.num_titles && bd->titles[title]) {
+            return bd->titles[title]->interactive;
+        }
+    }
+    return 0;
+}
+
 static void _update_chapter_psr(BLURAY *bd)
 {
-    uint32_t current_chapter = bd_get_current_chapter(bd);
-    bd_psr_write(bd->regs, PSR_CHAPTER,  current_chapter + 1);
+    if (!_is_interactive_title(bd)) {
+        uint32_t current_chapter = bd_get_current_chapter(bd);
+        bd_psr_write(bd->regs, PSR_CHAPTER,  current_chapter + 1);
+    }
 }
 
 /*
@@ -2093,7 +2109,12 @@ 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);
-    bd_psr_write(bd->regs, PSR_CHAPTER, 1);
+
+    if (_is_interactive_title(bd)) {
+        bd_psr_write(bd->regs, PSR_CHAPTER, 0xffff);
+    } else {
+        bd_psr_write(bd->regs, PSR_CHAPTER, 1);
+    }
 
     // Get the initial clip of the playlist
     bd->st0.clip = nav_next_clip(bd->title, NULL);



More information about the libbluray-devel mailing list