[vlc-commits] ttml demux: drop metadata tag inside p to avoid conflict
Stanislas Plessia
git at videolan.org
Wed Sep 14 18:39:44 CEST 2016
vlc | branch: master | Stanislas Plessia <stplessia at gmail.com> | Wed Aug 31 14:14:35 2016 +0200| [589ce85b62e566823159f08980ac82f0e9856737] | committer: Hugo Beauzée-Luyssen
ttml demux: drop metadata tag inside p to avoid conflict
As there is plaintext inside the metatdata tag, when there
is one inside of the p span, we just drop it to avoid its
display.
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=589ce85b62e566823159f08980ac82f0e9856737
---
modules/demux/ttml.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 061f80d..9bdcf25 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -434,7 +434,21 @@ static int ParseTimeOnSpan( demux_sys_t* p_sys, char* psz_text )
*/
do
{
- if( i_type == XML_READER_STARTELEM )
+ if( i_type == XML_READER_STARTELEM && !strcasecmp( psz_node_name, "metadata" ) )
+ {
+ if( !xml_ReaderIsEmptyElement( p_sys->p_reader ) )
+ {
+ while ( i_type != XML_READER_ENDELEM || strcasecmp( psz_node_name, "metadata" ) )
+ {
+ i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_node_name );
+ }
+ }
+ else
+ {
+ i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_node_name );
+ }
+ }
+ else if( i_type == XML_READER_STARTELEM )
{
node_t* p_node = calloc( 1, sizeof( *p_node ) );
if( unlikely( p_node == NULL ) )
@@ -625,7 +639,17 @@ static int ReadTTML( demux_t* p_demux )
* they are unecessary.
*/
i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_node_name );
-
+ if( i_type == XML_READER_STARTELEM && !strcasecmp( psz_node_name, "metadata" ) )
+ {
+ if( !xml_ReaderIsEmptyElement( p_sys->p_reader ) )
+ {
+ while ( i_type != XML_READER_ENDELEM || strcasecmp( psz_node_name, "metadata" ) )
+ {
+ i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_node_name );
+ }
+ }
+ i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_node_name );
+ }
while( i_type > XML_READER_NONE && ( i_type != XML_READER_ENDELEM
|| ( strcmp( psz_node_name, "p" ) && strcmp( psz_node_name, "tt:p" ) ) )
)
More information about the vlc-commits
mailing list