Skip to content
Snippets Groups Projects
Commit 5d259c01 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

pls: handle FindPrefix() failure and simplify

parent e73a376d
No related branches found
No related tags found
No related merge requests found
......@@ -109,7 +109,7 @@ vlc_module_begin ()
set_description( N_("PLS playlist import") )
add_shortcut( "playlist", "pls-open" )
set_capability( "demux", 10 )
set_callbacks( Import_PLS, Close_PLS )
set_callbacks( Import_PLS, NULL )
add_submodule ()
set_description( N_("B4S playlist import") )
add_shortcut( "playlist", "b4s-open", "shout-b4s" )
......
......@@ -39,7 +39,6 @@ int Import_RAM ( vlc_object_t * );
void Close_RAM ( vlc_object_t * );
int Import_PLS ( vlc_object_t * );
void Close_PLS ( vlc_object_t * );
int Import_B4S ( vlc_object_t * );
......
......@@ -34,11 +34,6 @@
#include "playlist.h"
struct demux_sys_t
{
char *psz_prefix;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
......@@ -61,24 +56,19 @@ int Import_PLS( vlc_object_t *p_this )
}
else return VLC_EGENERIC;
STANDARD_DEMUX_INIT_MSG( "found valid PLS playlist file");
p_demux->p_sys->psz_prefix = FindPrefix( p_demux );
msg_Dbg( p_demux, "found valid PLS playlist file");
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
return VLC_SUCCESS;
}
/*****************************************************************************
* Deactivate: frees unused data
*****************************************************************************/
void Close_PLS( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
free( p_demux->p_sys->psz_prefix );
free( p_demux->p_sys );
}
static int Demux( demux_t *p_demux )
{
char *psz_prefix = FindPrefix( p_demux );
if( unlikely(psz_prefix == NULL) )
return VLC_DEMUXER_EOF;
char *psz_name = NULL;
char *psz_line;
char *psz_mrl = NULL;
......@@ -162,7 +152,7 @@ static int Demux( demux_t *p_demux )
{
free( psz_mrl_orig );
psz_mrl_orig =
psz_mrl = ProcessMRL( psz_value, p_demux->p_sys->psz_prefix );
psz_mrl = ProcessMRL( psz_value, psz_prefix );
if( !strncasecmp( psz_key, "Ref", sizeof("Ref") -1 ) )
{
......@@ -202,5 +192,6 @@ static int Demux( demux_t *p_demux )
input_item_node_PostAndDelete( p_subitems );
vlc_gc_decref(p_current_input);
free( psz_prefix );
return 0; /* Needed for correct operation of go back */
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment