[vlc-commits] zvbi: mimic cc.c for using subtitles updater etc to avoid flickering in text subtitles

Ilkka Ollakka git at videolan.org
Tue Nov 12 17:00:18 CET 2013


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Tue Nov 12 17:33:04 2013 +0200| [47faceb4f016f9621323e2f1e1230e713a35261d] | committer: Ilkka Ollakka

zvbi: mimic cc.c for using subtitles updater etc to avoid flickering in text subtitles

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47faceb4f016f9621323e2f1e1230e713a35261d
---

 modules/codec/zvbi.c |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
index f75fab1..489f42b 100644
--- a/modules/codec/zvbi.c
+++ b/modules/codec/zvbi.c
@@ -50,6 +50,7 @@
 #include <libzvbi.h>
 
 #include <vlc_codec.h>
+#include "substext.h"
 
 /*****************************************************************************
  * Module descriptor.
@@ -379,7 +380,8 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
                                 i_align, p_block->i_pts );
             if( !p_spu )
                 goto error;
-            p_spu->p_region->psz_text = strdup("");
+            subpicture_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
+            p_spu_sys->text = strdup("");
 
             p_sys->b_update = true;
             p_sys->i_last_page = i_wanted_page;
@@ -431,7 +433,12 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
         while( offset < i_total && isspace( p_text[offset] ) )
            offset++;
 
-        p_spu->p_region->psz_text = strdup( &p_text[offset] );
+        subpicture_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
+        p_spu_sys->text = strdup( &p_text[offset] );
+
+        p_spu_sys->align = i_align;
+        p_spu_sys->i_font_height_percent = 5;
+
 #ifdef ZVBI_DEBUG
         msg_Info( p_dec, "page %x-%x(%d)\n\"%s\"", p_page.pgno, p_page.subno, i_total, &p_text[offset] );
 #endif
@@ -487,7 +494,10 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
 
     /* If there is a page or sub to render, then we do that here */
     /* Create the subpicture unit */
-    p_spu = decoder_NewSubpicture( p_dec, NULL );
+    if( b_text )
+        p_spu = decoder_NewSubpictureText( p_dec );
+    else
+        p_spu = decoder_NewSubpicture( p_dec, NULL );
     if( !p_spu )
     {
         msg_Warn( p_dec, "can't get spu buffer" );
@@ -525,13 +535,11 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
     p_spu->i_stop = i_pts + 10000000;
     p_spu->b_ephemer = true;
     p_spu->b_absolute = b_text ? false : true;
-    p_spu->p_region->i_align = i_align;
 
     if( !b_text )
-    {
-        p_spu->i_original_picture_width = fmt.i_width;
-        p_spu->i_original_picture_height = fmt.i_height;
-    }
+        p_spu->p_region->i_align = i_align;
+    p_spu->i_original_picture_width = fmt.i_width;
+    p_spu->i_original_picture_height = fmt.i_height;
 
     /* */
     *p_fmt = fmt;



More information about the vlc-commits mailing list