[vlc-devel] [PATCH 18/19] ttml demux: drop metadata tag inside p to avoid conflict

Stanislas Plessia stplessia at gmail.com
Mon Aug 29 16:01:16 CEST 2016


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.
---
 modules/demux/ttml.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 79f93bb..0d9393a 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -439,11 +439,10 @@ static int ParseTimeOnSpan( demux_sys_t* p_sys, char* psz_text )
     {
         if( i_type == XML_READER_STARTELEM && !strcasecmp( psz_node_name, "metadata" ) )
         {
-            do
+            while ( i_type != XML_READER_ENDELEM || strcasecmp( psz_node_name, "metadata" ) )
             {
                 i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_node_name );
-            }while ( i_type != XML_READER_ENDELEM || strcasecmp( psz_node_name, "metadata" ) );
-            i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_node_name );
+            }
         }
         else if( i_type == XML_READER_STARTELEM )
         {
@@ -633,7 +632,14 @@ 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" ) )
+                    {
+                        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" ) ) )
                           )
-- 
2.7.4



More information about the vlc-devel mailing list