[vlc-devel] [PATCH 18/21] input/input: use stream-fragments to handle MRL-sections
Filip Roséen
filip at atch.se
Sun Jul 31 22:42:27 CEST 2016
---
src/input/input.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/input/input.c b/src/input/input.c
index 0da797c..05d28c2 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2209,7 +2209,7 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
if( unlikely(in == NULL) )
return NULL;
- const char *psz_access, *psz_demux, *psz_path, *psz_anchor = NULL;
+ const char *psz_access, *psz_demux, *psz_path;
assert( psz_mrl );
char *psz_dup = strdup( psz_mrl );
@@ -2229,12 +2229,6 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
msg_Dbg( p_input, "`%s' gives access `%s' demux `%s' path `%s'",
psz_mrl, psz_access, psz_demux, psz_path );
- /* Find optional titles and seekpoints */
- in->i_title_start = in->i_title_end =
- in->i_seekpoint_start = in->i_seekpoint_end = -1;
-
- MRLSections( psz_anchor, in );
-
if( p_input->p->master == NULL /* XXX ugly */)
{ /* On master stream only, use input-list */
char *str = var_InheritString( p_input, "input-list" );
@@ -2293,6 +2287,26 @@ static input_source_t *InputSourceNew( input_thread_t *p_input,
p_input->b_preparsing, p_input );
free( psz_dup );
+ /* parse title/seekpoint data present in the MRL */
+
+ in->i_title_start = in->i_seekpoint_start = -1;
+ in->i_title_end = in->i_seekpoint_end = -1;
+
+ if( in->p_demux && vlc_stream_PeekFragment( in->p_demux->s ) )
+ {
+ stream_t* s = in->p_demux->s;
+ char* sdata = vlc_stream_PopFragment( s );
+
+ if( vlc_stream_PeekFragment( s ) || MRLSections( sdata, in ) )
+ {
+ /* too many fragments, or MRLSections failed */
+ demux_Delete( in->p_demux );
+ in->p_demux = NULL;
+ }
+
+ free( sdata );
+ }
+
if( in->p_demux == NULL )
{
if( !b_in_can_fail && !input_Stopped( p_input ) )
--
2.9.2
More information about the vlc-devel
mailing list