[vlc-commits] Revert "wpl/ttml: use similar logic that subtitle_helper has for xml probing"

Francois Cartegnie git at videolan.org
Wed Oct 7 20:02:11 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct  7 19:53:03 2015 +0200| [99ef553614db40ea70941f14cadad629ef905e39] | committer: Francois Cartegnie

Revert "wpl/ttml: use similar logic that subtitle_helper has for xml probing"

We can't use stream_Memory as xmlreader backend if we don't load the whole
file into memory, and that's not possible because we're probing.
(xmlread can't load incomplete documents)

This reverts commit 7ce48b0dd1bb160572a3b81e07d12379693c0a98.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=99ef553614db40ea70941f14cadad629ef905e39
---

 modules/demux/playlist/wpl.c |   19 -------------------
 modules/demux/ttml.c         |   37 +------------------------------------
 2 files changed, 1 insertion(+), 55 deletions(-)

diff --git a/modules/demux/playlist/wpl.c b/modules/demux/playlist/wpl.c
index 302317b..121ffd2 100644
--- a/modules/demux/playlist/wpl.c
+++ b/modules/demux/playlist/wpl.c
@@ -186,22 +186,6 @@ int Import_WPL( vlc_object_t* p_this )
         Close_WPL( p_this );
         return VLC_EGENERIC;
     }
-    uint8_t *p_peek;
-    ssize_t i_peek = stream_Peek( p_demux->s, (const uint8_t **) &p_peek, 2048 );
-
-    if( unlikely( i_peek <= 0 ) )
-    {
-        Close_WPL( p_this );
-        return VLC_EGENERIC;
-    }
-
-    stream_t *p_probestream = stream_MemoryNew( p_demux->s, p_peek, i_peek, true );
-    if( unlikely( !p_probestream ) )
-    {
-        Close_WPL( p_this );
-        return VLC_EGENERIC;
-    }
-    p_sys->p_reader = xml_ReaderReset( p_sys->p_reader, p_probestream );
 
     const char* psz_name;
     int type = xml_ReaderNextNode( p_sys->p_reader, &psz_name );
@@ -209,11 +193,8 @@ int Import_WPL( vlc_object_t* p_this )
     {
         msg_Err( p_demux, "Invalid WPL playlist. Root element should have been <smil>" );
         Close_WPL( p_this );
-        stream_Delete( p_probestream );
         return VLC_EGENERIC;
     }
-    p_sys->p_reader = xml_ReaderReset( p_sys->p_reader, p_demux->s );
-    stream_Delete( p_probestream );
 
     msg_Dbg( p_demux, "Found valid WPL playlist" );
 
diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index f48b326..d07f698 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -463,41 +463,17 @@ static int Open( vlc_object_t* p_this )
     if ( unlikely( p_sys == NULL ) )
         return VLC_ENOMEM;
 
-    i_peek = stream_Peek( p_demux->s, (const uint8_t **) &p_peek, 2048 );
-
-    if( unlikely( i_peek <= 0 ) )
-    {
-        Close( p_demux );
-        return VLC_EGENERIC;
-    }
-
-    stream_t *p_probestream = stream_MemoryNew( p_demux->s, p_peek, i_peek, true );
-    if( unlikely( !p_probestream ) )
-    {
-        Close( p_demux );
-        return VLC_EGENERIC;
-    }
-
     p_sys->p_xml = xml_Create( p_demux );
     if ( !p_sys->p_xml )
     {
         Close( p_demux );
-        stream_Delete( p_probestream );
-        return VLC_EGENERIC;
-    }
-    p_sys->p_reader = xml_ReaderCreate( p_sys->p_xml, p_demux->s );
-    if ( !p_sys->p_reader )
-    {
-        Close( p_demux );
-        stream_Delete( p_probestream );
         return VLC_EGENERIC;
     }
 
-    p_sys->p_reader = xml_ReaderReset( p_sys->p_reader, p_probestream );
+    p_sys->p_reader = xml_ReaderCreate( p_sys->p_xml, p_demux->s );
     if ( !p_sys->p_reader )
     {
         Close( p_demux );
-        stream_Delete( p_probestream );
         return VLC_EGENERIC;
     }
 
@@ -506,19 +482,8 @@ static int Open( vlc_object_t* p_this )
     if ( i_type != XML_READER_STARTELEM || ( strcmp( psz_name, "tt" ) && strcmp( psz_name, "tt:tt" ) ) )
     {
         Close( p_demux );
-        stream_Delete( p_probestream );
-        return VLC_EGENERIC;
-    }
-    p_sys->p_reader = xml_ReaderReset( p_sys->p_reader, p_demux->s );
-    if ( !p_sys->p_reader )
-    {
-        Close( p_demux );
-        stream_Delete( p_probestream );
         return VLC_EGENERIC;
     }
-    stream_Delete( p_probestream );
-
-
     if ( ReadTTML( p_demux ) != VLC_SUCCESS )
     {
         Close( p_demux );



More information about the vlc-commits mailing list