[vlc-commits] codec: ttml: handle missing default text alignment
Francois Cartegnie
git at videolan.org
Fri Nov 24 18:20:16 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov 24 18:18:19 2017 +0100| [5f52d4bd59048559b274a3f22b945c9824e9006b] | committer: Francois Cartegnie
codec: ttml: handle missing default text alignment
refs #19147 #19146
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f52d4bd59048559b274a3f22b945c9824e9006b
---
modules/codec/ttml/substtml.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index 6a0787d918..383f8e07fa 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -64,6 +64,7 @@ typedef struct
ttml_length_t font_size;
ttml_length_t extent_h, extent_v;
int i_text_align;
+ bool b_text_align_set;
int i_direction;
bool b_direction_set;
bool b_preserve_space;
@@ -188,7 +189,8 @@ static ttml_region_t *ttml_region_New( )
SubpictureUpdaterSysRegionInit( &p_ttml_region->updt );
p_ttml_region->pp_last_segment = &p_ttml_region->updt.p_segments;
/* Align to top by default. !Warn: center align is obtained with NO flags */
- p_ttml_region->updt.align = SUBPICTURE_ALIGN_TOP;
+ p_ttml_region->updt.align = SUBPICTURE_ALIGN_TOP|SUBPICTURE_ALIGN_LEFT;
+ p_ttml_region->updt.inner_align = SUBPICTURE_ALIGN_TOP|SUBPICTURE_ALIGN_LEFT;
return p_ttml_region;
}
@@ -465,6 +467,7 @@ static void FillTTMLStyle( const char *psz_attr, const char *psz_val,
else if( strcasecmp ( "center", psz_val ) )
/* == "start" FIXME: should be BIDI based */
p_ttml_style->i_text_align |= SUBPICTURE_ALIGN_LEFT;
+ p_ttml_style->b_text_align_set = true;
printf("**%s %x\n", psz_val, p_ttml_style->i_text_align);
}
else if( !strcasecmp( "tts:fontSize", psz_attr ) )
@@ -800,8 +803,11 @@ static void AppendTextToRegion( ttml_context_t *p_ctx, const tt_textnode_t *p_tt
/* we don't have paragraph, so no per text line alignment.
* Text style brings horizontal textAlign to region.
* Region itself is styled with vertical displayAlign */
- p_region->updt.inner_align &= ~(SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT);
- p_region->updt.inner_align |= s->i_text_align;
+ if( s->b_text_align_set )
+ {
+ p_region->updt.inner_align &= ~(SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT);
+ p_region->updt.inner_align |= s->i_text_align;
+ }
ttml_style_Delete( s );
}
@@ -1030,7 +1036,7 @@ static int ParseBlock( decoder_t *p_dec, const block_t *p_block )
p_spu->i_start = VLC_TS_0 + tt_time_Convert( &p_timings_array[i] );
p_spu->i_stop = VLC_TS_0 + tt_time_Convert( &p_timings_array[i+1] ) - 1;
p_spu->b_ephemer = true;
- p_spu->b_absolute = false;
+ p_spu->b_absolute = true;
subpicture_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
subpicture_updater_sys_region_t *p_updtregion = NULL;
More information about the vlc-commits
mailing list