[vlc-commits] pls: handle FindPrefix() failure and simplify
Rémi Denis-Courmont
git at videolan.org
Mon Jul 25 23:44:46 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 26 00:01:03 2016 +0300| [5d259c01b8bff5cdae4431062b0b8eca0d3b9d28] | committer: Rémi Denis-Courmont
pls: handle FindPrefix() failure and simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d259c01b8bff5cdae4431062b0b8eca0d3b9d28
---
modules/demux/playlist/playlist.c | 2 +-
modules/demux/playlist/playlist.h | 1 -
modules/demux/playlist/pls.c | 27 +++++++++------------------
3 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index a15595f..b5cfbdb 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -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" )
diff --git a/modules/demux/playlist/playlist.h b/modules/demux/playlist/playlist.h
index c8d1830..eb366e5 100644
--- a/modules/demux/playlist/playlist.h
+++ b/modules/demux/playlist/playlist.h
@@ -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 * );
diff --git a/modules/demux/playlist/pls.c b/modules/demux/playlist/pls.c
index 0a6b062..54fe010 100644
--- a/modules/demux/playlist/pls.c
+++ b/modules/demux/playlist/pls.c
@@ -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 */
}
More information about the vlc-commits
mailing list