Browse Source

ttml: correct element style resolution order

the element style resolution order should start with Inline Styling
than Referential Styling than Region Style Inheritance without
overriding.

if we have:
<style xml:id="captionStyle" tts:color="red"/>
and:
<span style="captionStyle" tts:color="green">test</span>

so in the example the color should be green not red.

Signed-off-by: Francois Cartegnie <fcvlcdev@free.fr>
pull/57/head
Remita Amine 9 years ago
committed by Francois Cartegnie
parent
commit
b6e173f0d5
  1. 10
      modules/codec/ttml/substtml.c

10
modules/codec/ttml/substtml.c

@ -479,17 +479,17 @@ static ttml_style_t * InheritTTMLStyles( ttml_context_t *p_ctx, tt_node_t *p_nod
/* Merge dics backwards without overwriting */
for( ; p_node; p_node = p_node->p_parent )
{
const char *psz_regionid = (const char *)
vlc_dictionary_value_for_key( &p_node->attr_dict, "region" );
if( psz_regionid )
DictMergeWithRegionID( p_ctx, psz_regionid, &merged );
DictionnaryMerge( &p_node->attr_dict, &merged );
const char *psz_styleid = (const char *)
vlc_dictionary_value_for_key( &p_node->attr_dict, "style" );
if( psz_styleid )
DictMergeWithStyleID( p_ctx, psz_styleid, &merged );
DictionnaryMerge( &p_node->attr_dict, &merged );
const char *psz_regionid = (const char *)
vlc_dictionary_value_for_key( &p_node->attr_dict, "region" );
if( psz_regionid )
DictMergeWithRegionID( p_ctx, psz_regionid, &merged );
}
if( merged.i_size && merged.p_entries[0] && (p_ttml_style = ttml_style_New()) )

Loading…
Cancel
Save