[libbluray-devel] Delay decoding of preloaded IG stream

hpi1 git at videolan.org
Mon Nov 21 08:30:32 CET 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Nov 21 09:27:44 2011 +0200| [ea8f42177a500edca76a8bfb94834568f9f07b6f] | committer: hpi1

Delay decoding of preloaded IG stream

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

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

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 31cba9a..99ecebf 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1250,7 +1250,7 @@ static int _find_ig_stream(BLURAY *bd, uint16_t *pid, int *sub_path_idx)
     unsigned  ig_stream = bd_psr_read(bd->regs, PSR_IG_STREAM_ID);
 
     if (ig_stream > 0 && ig_stream <= pi->stn.num_ig) {
-        ig_stream--;
+        ig_stream--; /* stream number to table index */
         if (pi->stn.ig[ig_stream].stream_type == 2) {
             *sub_path_idx = pi->stn.ig[ig_stream].subpath_id;
         }
@@ -1282,11 +1282,10 @@ static int _preload_ig_subpath(BLURAY *bd)
     bd->st_ig.clip = &bd->title->sub_path[ig_subpath].clip_list.clip[0];
 
     if (!_preload_m2ts(bd, &bd->st_ig)) {
+        _close_preload(&bd->st_ig);
         return 0;
     }
 
-    gc_decode_ts(bd->graphics_controller, ig_pid, bd->st_ig.buf, bd->st_ig.clip_size / 6144, -1);
-
     return 1;
 }
 
@@ -1301,6 +1300,26 @@ static int _preload_subpaths(BLURAY *bd)
     return _preload_ig_subpath(bd);
 }
 
+static int _init_ig_stream(BLURAY *bd)
+{
+    int      ig_subpath = -1;
+    uint16_t ig_pid     = 0;
+
+    if (!bd->graphics_controller) {
+        return 0;
+    }
+
+    _find_ig_stream(bd, &ig_pid, &ig_subpath);
+
+    /* decode already preloaded IG sub-path */
+    if (bd->st_ig.clip) {
+        gc_decode_ts(bd->graphics_controller, ig_pid, bd->st_ig.buf, bd->st_ig.clip_size / 6144, -1);
+        return 1;
+    }
+
+    return 0;
+}
+
 /*
  * select title / angle
  */
@@ -1718,6 +1737,7 @@ static void _process_psr_restore_event(BLURAY *bd, BD_PSR_EVENT *ev)
             return;
         case PSR_TIME:
             bd_seek_time(bd, ((int64_t)ev->new_val) << 1);
+            _init_ig_stream(bd);
             return;
 
         case PSR_SELECTED_BUTTON_ID:
@@ -2053,6 +2073,7 @@ static void _process_hdmv_vm_event(BLURAY *bd, HDMV_EVENT *hev)
         case HDMV_EVENT_PLAY_PL:
             bd_select_playlist(bd, hev->param);
             /* initialize menus */
+            _init_ig_stream(bd);
             _run_gc(bd, GC_CTRL_INIT_MENU, 0);
             break;
 



More information about the libbluray-devel mailing list