[libbluray-devel] TextST: fixed rendering after seek

hpi1 git at videolan.org
Fri Aug 23 09:26:18 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Aug 23 10:00:22 2013 +0300| [270b1d1a52b7c47439f35e778dc2eab0b2a466c9] | committer: hpi1

TextST: fixed rendering after seek

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

 src/libbluray/decoders/graphics_controller.c |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c
index 6a1d44b..b1c540d 100644
--- a/src/libbluray/decoders/graphics_controller.c
+++ b/src/libbluray/decoders/graphics_controller.c
@@ -97,7 +97,6 @@ struct graphics_controller_s {
 
     /* */
     TEXTST_RENDER  *textst_render;
-    uint32_t        prev_stc; /* detect seeks */
     int             next_dialog_idx;
     int             textst_user_style;
 };
@@ -702,6 +701,8 @@ static void _gc_reset(GRAPHICS_CONTROLLER *gc)
     pg_display_set_free(&gc->tgs);
 
     textst_render_free(&gc->textst_render);
+    gc->next_dialog_idx = 0;
+    gc->textst_user_style = -1;
 
     X_FREE(gc->bog_data);
 }
@@ -761,6 +762,8 @@ GRAPHICS_CONTROLLER *gc_init(BD_REGISTERS *regs, void *handle, gc_overlay_proc_f
 
     bd_psr_register_cb(regs, _process_psr_event, p);
 
+    p->textst_user_style = -1;
+
     return p;
 }
 
@@ -950,19 +953,11 @@ static int _render_textst(GRAPHICS_CONTROLLER *p, uint32_t stc, GC_NAV_CMDS *cmd
 
     dialog = s->dialog;
 
-    /* detect seeks */
-    if (stc < p->prev_stc) {
-      ii = 0;
-    } else {
-      ii = p->next_dialog_idx;
-    }
-    p->prev_stc = stc;
-
     /* loop over all matching dialogs */
-    for ( ; ii < s->num_dialog; ii++) {
+    for (ii = p->next_dialog_idx; ii < s->num_dialog; ii++) {
 
         /* next dialog too far in future ? */
-        if (dialog[ii].start_pts >= now + 90000) {
+        if (now < 1 || dialog[ii].start_pts >= now + 90000) {
             cmds->wakeup_time = dialog[ii].start_pts / 2;
             GC_TRACE("_render_textst(): next event #%d in %"PRId64" seconds (pts %"PRId64")\n",
                      ii, (dialog[ii].start_pts - now)/90000, dialog[ii].start_pts);
@@ -973,6 +968,11 @@ static int _render_textst(GRAPHICS_CONTROLLER *p, uint32_t stc, GC_NAV_CMDS *cmd
 
         /* too late ? */
         if (dialog[ii].start_pts < now - 45000) {
+            GC_TRACE("_render_textst(): not showing #%d (start time passed)\n",ii);
+            continue;
+        }
+        if (dialog[ii].end_pts < now) {
+            GC_TRACE("_render_textst(): not showing #%d (hide time passed)\n",ii);
             continue;
         }
 
@@ -1153,6 +1153,8 @@ static void _reset_pg(GRAPHICS_CONTROLLER *gc)
     if (gc->pg_open) {
         _close_osd(gc, BD_OVERLAY_PG);
     }
+
+    gc->next_dialog_idx = 0;
 }
 
 /*



More information about the libbluray-devel mailing list