[vlc-devel] [PATCH 5/5] ttml/wpl: on probing if we don't match, seek back where we started
Ilkka Ollakka
ileoo at videolan.org
Sat Oct 3 14:25:01 CEST 2015
Xml reader reads stream so we need to seek to where we started, so we
don't fubar probing for later modules. This seemed to hit for srt
probing.
---
modules/demux/playlist/wpl.c | 3 +++
modules/demux/ttml.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/modules/demux/playlist/wpl.c b/modules/demux/playlist/wpl.c
index 121ffd2..575d806 100644
--- a/modules/demux/playlist/wpl.c
+++ b/modules/demux/playlist/wpl.c
@@ -175,6 +175,7 @@ int Import_WPL( vlc_object_t* p_this )
!demux_IsPathExtension( p_demux, ".zpl" ) )
return VLC_EGENERIC;
+ const uint64_t i_start_pos = stream_Tell( p_demux->s );
DEMUX_INIT_COMMON();
demux_sys_t* p_sys = p_demux->p_sys;
@@ -184,6 +185,7 @@ int Import_WPL( vlc_object_t* p_this )
{
msg_Err( p_demux, "Failed to create an XML reader" );
Close_WPL( p_this );
+ stream_Seek( p_demux->s, i_start_pos );
return VLC_EGENERIC;
}
@@ -193,6 +195,7 @@ 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_Seek( p_demux->s, i_start_pos );
return VLC_EGENERIC;
}
diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 5f4661c..dfe3711 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -451,6 +451,7 @@ static int Open( vlc_object_t* p_this )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
+ const uint64_t i_start_pos = stream_Tell( p_demux->s );
p_demux->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
if ( unlikely( p_sys == NULL ) )
return VLC_ENOMEM;
@@ -474,11 +475,13 @@ 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_Seek( p_demux->s, i_start_pos );
return VLC_EGENERIC;
}
if ( ReadTTML( p_demux ) != VLC_SUCCESS )
{
Close( p_demux );
+ stream_Seek( p_demux->s, i_start_pos );
return VLC_EGENERIC;
}
if ( p_sys->b_has_head )
--
2.5.2
More information about the vlc-devel
mailing list