[vlc-commits] subpicture: replace plain text by text_segment list

Jean-Baptiste Kempf git at videolan.org
Tue Jul 28 16:01:57 CEST 2015


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Apr  6 18:44:40 2015 +0200| [6b45f45e3038bfa16691244b2908de0ba76b007c] | committer: Jean-Baptiste Kempf

subpicture: replace plain text by text_segment list

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 include/vlc_subpicture.h      |    1 +
 src/misc/subpicture.c         |    4 ++--
 src/video_output/video_epg.c  |    2 +-
 src/video_output/video_text.c |    2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/vlc_subpicture.h b/include/vlc_subpicture.h
index 3f130c9..eb61ada 100644
--- a/include/vlc_subpicture.h
+++ b/include/vlc_subpicture.h
@@ -64,6 +64,7 @@ struct subpicture_region_t
     int             i_align;                  /**< alignment within a region */
     int             i_alpha;                               /**< transparency */
 
+    text_segment_t  *p_text;         /**< subtitle text, made of a list of segments */
     char            *psz_text;       /**< text string comprising this region */
     char            *psz_html;       /**< HTML version of subtitle (NULL = use psz_text) */
     text_style_t    *p_style;        /**< a description of the text style formatting */
diff --git a/src/misc/subpicture.c b/src/misc/subpicture.c
index bae12f8..6e74b0d 100644
--- a/src/misc/subpicture.c
+++ b/src/misc/subpicture.c
@@ -248,7 +248,7 @@ void subpicture_region_Delete( subpicture_region_t *p_region )
 
     free( p_region->fmt.p_palette );
 
-    free( p_region->psz_text );
+    text_segment_ChainDelete( p_region->p_text );
     free( p_region->psz_html );
     if( p_region->p_style )
         text_style_Delete( p_region->p_style );
@@ -304,7 +304,7 @@ subpicture_region_t* subpicture_region_Copy( subpicture_region_t *p_region_src )
     p_region_dst->i_align  = p_region_src->i_align;
     p_region_dst->i_alpha  = p_region_src->i_alpha;
 
-    p_region_dst->psz_text = p_region_src->psz_text ? strdup(p_region_src->psz_text) : NULL;
+    p_region_dst->p_text = text_segment_Copy( p_region_src->p_text );
     p_region_dst->psz_html = p_region_src->psz_html ? strdup(p_region_src->psz_html) : NULL;
     if (p_region_src->p_style != NULL) {
         p_region_dst->p_style = text_style_New();
diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index a0b5c6f..d580d5d 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -113,7 +113,7 @@ static subpicture_region_t * vout_OSDEpgText(const char *text,
         return NULL;
 
     /* Set subpicture parameters */
-    region->psz_text = strdup(text);
+    region->p_text   = text_segment_New(text);
     region->i_align  = 0;
     region->i_x      = x;
     region->i_y      = y;
diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c
index 4ef8865..eb20c9a 100644
--- a/src/video_output/video_text.c
+++ b/src/video_output/video_text.c
@@ -74,7 +74,7 @@ static void OSDTextUpdate(subpicture_t *subpic,
     if (!r)
         return;
 
-    r->psz_text = strdup(sys->text);
+    r->p_text = text_segment_New( sys->text );
 
     const float margin_ratio = 0.04;
     const int   margin_h     = margin_ratio * fmt_dst->i_visible_width;



More information about the vlc-commits mailing list