Commit 496d33dc authored by Rafaël Carré's avatar Rafaël Carré

playlist demuxers: return -1 in case of error, 0 in case of eof, 1 else; like...

playlist demuxers: return -1 in case of error, 0 in case of eof, 1 else; like any correct demuxer. (we always return eof since playlists don't need 2 successive demuxing).
fix a corner case bug in ifo.c
parent f4d12855
......@@ -251,7 +251,7 @@ static int Demux( demux_t *p_demux )
p_sys->i_data_len += 1024;
p_sys->psz_data = realloc( p_sys->psz_data, p_sys->i_data_len * sizeof( char * ) +1 );
}
if( p_sys->i_data_len <= 0 ) return VLC_EGENERIC;
if( p_sys->i_data_len <= 0 ) return -1;
}
psz_parse = p_sys->psz_data;
......@@ -688,7 +688,7 @@ static int Demux( demux_t *p_demux )
#endif
}
HANDLE_PLAY_AND_RELEASE;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -287,7 +287,7 @@ static int Demux( demux_t *p_demux )
}
HANDLE_PLAY_AND_RELEASE;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -127,7 +127,7 @@ static int Demux( demux_t *p_demux )
}
HANDLE_PLAY_AND_RELEASE;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static struct
......
......@@ -222,7 +222,7 @@ static int Demux( demux_t *p_demux )
p_sys->p_playlist = NULL;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -57,7 +57,7 @@ int E_(Import_IFO)( vlc_object_t *p_this )
const byte_t *p_peek;
i_peek = stream_Peek( p_demux->s, &p_peek, 8 );
if( strncmp( p_peek, "DVDVIDEO", 8 ) )
if( i_peek != 8 || memcmp( p_peek, "DVDVIDEO", 8 ) )
return VLC_EGENERIC;
}
else
......@@ -95,7 +95,7 @@ static int Demux( demux_t *p_demux )
HANDLE_PLAY_AND_RELEASE;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -120,7 +120,7 @@ int Demux( demux_t *p_demux )
xml_ReaderDelete( p_xml, p_xml_reader );
if( p_xml )
xml_Delete( p_xml );
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
/** \brief dummy function for demux callback interface */
......
......@@ -219,7 +219,7 @@ static int Demux( demux_t *p_demux )
}
}
HANDLE_PLAY_AND_RELEASE;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -235,7 +235,7 @@ static int Demux( demux_t *p_demux )
}
HANDLE_PLAY_AND_RELEASE;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -320,7 +320,7 @@ static int Demux( demux_t *p_demux )
}
HANDLE_PLAY_AND_RELEASE;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -375,7 +375,7 @@ static int Demux( demux_t *p_demux )
free( psz_src );
free( psz_mimetype );
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -377,7 +377,7 @@ static int Demux ( demux_t *p_demux )
if( !p_child )
{
msg_Err( p_demux, "A valid playlistitem could not be created" );
return VLC_EGENERIC;
return -1;
}
input_ItemCopyOptions( p_current_input, p_child );
......@@ -406,7 +406,7 @@ static int Demux ( demux_t *p_demux )
input_ItemAddSubItem( p_current_input, p_child );
HANDLE_PLAY_AND_RELEASE
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
static int Control( demux_t *p_demux, int i_query, va_list args )
......
......@@ -147,7 +147,7 @@ static int Demux( demux_t *p_demux )
HANDLE_PLAY_AND_RELEASE;
p_sys->p_playlist = NULL;
return -1; /* Needed for correct operation of go back */
return 0; /* Needed for correct operation of go back */
}
#define GET_VALUE( a ) \
......
......@@ -70,7 +70,7 @@ void E_(Close_xspf)( vlc_object_t *p_this )
*/
int Demux( demux_t *p_demux )
{
int i_ret = VLC_SUCCESS;
int i_ret = 1;
xml_t *p_xml = NULL;
xml_reader_t *p_xml_reader = NULL;
char *psz_name = NULL;
......@@ -83,43 +83,44 @@ int Demux( demux_t *p_demux )
/* create new xml parser from stream */
p_xml = xml_Create( p_demux );
if( !p_xml )
i_ret = VLC_ENOMOD;
i_ret = -1;
else
{
p_xml_reader = xml_ReaderCreate( p_xml, p_demux->s );
if( !p_xml_reader )
i_ret = VLC_EGENERIC;
i_ret = -1;
}
/* locating the root node */
if( i_ret == VLC_SUCCESS )
if( i_ret == 1 )
{
do
{
if( xml_ReaderRead( p_xml_reader ) != 1 )
{
msg_Err( p_demux, "can't read xml stream" );
i_ret = VLC_EGENERIC;
i_ret = -1;
}
} while( i_ret == VLC_SUCCESS &&
xml_ReaderNodeType( p_xml_reader ) != XML_READER_STARTELEM );
}
/* checking root node name */
if( i_ret == VLC_SUCCESS )
if( i_ret == 1 )
{
psz_name = xml_ReaderName( p_xml_reader );
if( !psz_name || strcmp( psz_name, "playlist" ) )
{
msg_Err( p_demux, "invalid root node name: %s", psz_name );
i_ret = VLC_EGENERIC;
i_ret = -1;
}
FREE_NAME();
}
if( i_ret == VLC_SUCCESS )
if( i_ret == 1 )
i_ret = parse_playlist_node( p_demux, p_playlist, p_current_input,
p_xml_reader, "playlist" )
? VLC_SUCCESS : VLC_EGENERIC;
p_xml_reader, "playlist" ) ? 0 : -1;
HANDLE_PLAY_AND_RELEASE;
if( p_xml_reader )
xml_ReaderDelete( p_xml, p_xml_reader );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment