vlc | branch: master | Francois Cartegnie <[email protected]> | Fri Nov 24 10:29:01 2017 +0100| [41df966452ad9101208b067f9593dc45ccb9a244] | committer: Francois Cartegnie
codec: ttml: fix default alignment values refs #19147 #19146 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41df966452ad9101208b067f9593dc45ccb9a244 --- modules/codec/substext.h | 4 ++-- modules/codec/ttml/substtml.c | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/codec/substext.h b/modules/codec/substext.h index 9db0cceaab..a0aab57440 100644 --- a/modules/codec/substext.h +++ b/modules/codec/substext.h @@ -75,8 +75,8 @@ static inline void SubpictureUpdaterSysRegionClean(subpicture_updater_sys_region static inline void SubpictureUpdaterSysRegionInit(subpicture_updater_sys_region_t *p_updtregion) { memset(p_updtregion, 0, sizeof(*p_updtregion)); - p_updtregion->align = SUBPICTURE_ALIGN_BOTTOM /* CENTER */; - p_updtregion->inner_align = SUBPICTURE_ALIGN_BOTTOM /* CENTER */; + p_updtregion->align = SUBPICTURE_ALIGN_TOP; + p_updtregion->inner_align = SUBPICTURE_ALIGN_LEFT; } static inline subpicture_updater_sys_region_t *SubpictureUpdaterSysRegionNew( ) diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c index 3033bb0c98..6a0787d918 100644 --- a/modules/codec/ttml/substtml.c +++ b/modules/codec/ttml/substtml.c @@ -187,8 +187,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 bottom by default. !Warn: center align is obtained with NO flags */ - p_ttml_region->updt.align = SUBPICTURE_ALIGN_BOTTOM; + /* Align to top by default. !Warn: center align is obtained with NO flags */ + p_ttml_region->updt.align = SUBPICTURE_ALIGN_TOP; return p_ttml_region; } @@ -356,10 +356,11 @@ static void FillRegionStyle( const char *psz_attr, const char *psz_val, if( !strcasecmp( "tts:displayAlign", psz_attr ) ) { p_region->updt.inner_align &= ~(SUBPICTURE_ALIGN_TOP|SUBPICTURE_ALIGN_BOTTOM); - if( !strcasecmp ( "before", psz_val ) ) - p_region->updt.inner_align |= SUBPICTURE_ALIGN_TOP; - else if( !strcasecmp ( "after", psz_val ) ) + if( !strcasecmp( "after", psz_val ) ) p_region->updt.inner_align |= SUBPICTURE_ALIGN_BOTTOM; + else if( strcasecmp( "center", psz_val ) ) + /* "before" */ + p_region->updt.inner_align |= SUBPICTURE_ALIGN_TOP; } else if( !strcasecmp ( "tts:origin", psz_attr ) || !strcasecmp ( "tts:extent", psz_attr ) ) @@ -459,10 +460,12 @@ static void FillTTMLStyle( const char *psz_attr, const char *psz_val, p_ttml_style->i_text_align |= SUBPICTURE_ALIGN_LEFT; else if( !strcasecmp ( "right", psz_val ) ) p_ttml_style->i_text_align |= SUBPICTURE_ALIGN_RIGHT; - else if( !strcasecmp ( "start", psz_val ) ) /* FIXME: should be BIDI based */ - p_ttml_style->i_text_align |= SUBPICTURE_ALIGN_LEFT; else if( !strcasecmp ( "end", psz_val ) ) /* FIXME: should be BIDI based */ p_ttml_style->i_text_align |= SUBPICTURE_ALIGN_RIGHT; + else if( strcasecmp ( "center", psz_val ) ) + /* == "start" FIXME: should be BIDI based */ + p_ttml_style->i_text_align |= SUBPICTURE_ALIGN_LEFT; + printf("**%s %x\n", psz_val, p_ttml_style->i_text_align); } else if( !strcasecmp( "tts:fontSize", psz_attr ) ) { @@ -797,6 +800,7 @@ 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; ttml_style_Delete( s ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
