[vlc-commits] demux: ttml: recreate entities (fix #22919)
Francois Cartegnie
git at videolan.org
Tue Oct 8 19:23:25 CEST 2019
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct 8 18:53:35 2019 +0200| [b14d7aba50962666d735dec230242f70e1372c2c] | committer: Francois Cartegnie
demux: ttml: recreate entities (fix #22919)
(cherry picked from commit 9c490479cfda04b57d12be1e65745ffa7ac5d43b)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=b14d7aba50962666d735dec230242f70e1372c2c
---
NEWS | 1 +
modules/demux/ttml.c | 25 +++++++++++++++++++------
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/NEWS b/NEWS
index e9d220980b..3a7e4a1c4f 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ Demux:
* Fix glitches in TS over HLS
* Add real probing of HLS streams
* Fix HLS MIME type fallback
+ * Fix TTML entities not passed to decoder
Decoder:
* Fix WebVTT subtitles rendering
diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index d4d0755e9f..4eeabddd4a 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -106,6 +106,16 @@ static char *tt_genTiming( tt_time_t t )
return i_ret < 0 ? NULL : psz;
}
+static void tt_MemstreamPutEntities( struct vlc_memstream *p_stream, const char *psz )
+{
+ char *psz_entities = vlc_xml_encode( psz );
+ if( psz_entities )
+ {
+ vlc_memstream_puts( p_stream, psz_entities );
+ free( psz_entities );
+ }
+}
+
static void tt_node_AttributesToText( struct vlc_memstream *p_stream, const tt_node_t* p_node )
{
bool b_timed_node = false;
@@ -132,14 +142,15 @@ static void tt_node_AttributesToText( struct vlc_memstream *p_stream, const tt_n
}
else
{
- psz_value = (char const*)p_entry->p_value;
+ psz_value = p_entry->p_value;
}
if( psz_value == NULL )
continue;
- vlc_memstream_printf( p_stream, " %s=\"%s\"",
- p_entry->psz_key, psz_value );
+ vlc_memstream_printf( p_stream, " %s=\"", p_entry->psz_key );
+ tt_MemstreamPutEntities( p_stream, psz_value );
+ vlc_memstream_putc( p_stream, '"' );
}
}
@@ -173,7 +184,7 @@ static void tt_node_ToText( struct vlc_memstream *p_stream, const tt_basenode_t
return;
vlc_memstream_putc( p_stream, '<' );
- vlc_memstream_puts( p_stream, p_node->psz_node_name );
+ tt_MemstreamPutEntities( p_stream, p_node->psz_node_name );
tt_node_AttributesToText( p_stream, p_node );
@@ -193,7 +204,9 @@ static void tt_node_ToText( struct vlc_memstream *p_stream, const tt_basenode_t
tt_node_ToText( p_stream, p_child, playbacktime );
}
- vlc_memstream_printf( p_stream, "</%s>", p_node->psz_node_name );
+ vlc_memstream_puts( p_stream, "</" );
+ tt_MemstreamPutEntities( p_stream, p_node->psz_node_name );
+ vlc_memstream_putc( p_stream, '>' );
}
else
vlc_memstream_puts( p_stream, "/>" );
@@ -201,7 +214,7 @@ static void tt_node_ToText( struct vlc_memstream *p_stream, const tt_basenode_t
else
{
const tt_textnode_t *p_textnode = (const tt_textnode_t *) p_basenode;
- vlc_memstream_puts( p_stream, p_textnode->psz_text );
+ tt_MemstreamPutEntities( p_stream, p_textnode->psz_text );
}
}
More information about the vlc-commits
mailing list