/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h> /* malloc(), free() */
#include <ctype.h> /* isspace() */
#include <vlc/vlc.h>
int E_(Import_Shoutcast)( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
- demux_sys_t *p_sys;
- char *psz_ext;
-
- psz_ext = strrchr ( p_demux->psz_path, '.' );
-
- if( !p_demux->psz_demux || strcmp(p_demux->psz_demux, "shout-winamp") )
- {
+ if( !isDemux( p_demux, "shout-winamp" ) )
return VLC_EGENERIC;
- }
- msg_Dbg( p_demux, "using shoutcast playlist import");
- p_demux->pf_control = Control;
- p_demux->pf_demux = Demux;
- p_demux->p_sys = p_sys = malloc( sizeof(demux_sys_t) );
- if( p_sys == NULL )
- {
- msg_Err( p_demux, "out of memory" );
- return VLC_ENOMEM;
- }
-
- p_sys->p_playlist = NULL;
- p_sys->p_xml = NULL;
- p_sys->p_xml_reader = NULL;
+ STANDARD_DEMUX_INIT_MSG( "using shoutcast playlist reader" );
+ p_demux->p_sys->p_playlist = NULL;
+ p_demux->p_sys->p_xml = NULL;
+ p_demux->p_sys->p_xml_reader = NULL;
/* Do we want to list adult content ? */
var_Create( p_demux, "shoutcast-show-adult",
VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
- p_sys->b_adult = var_GetBool( p_demux, "shoutcast-show-adult" );
+ p_demux->p_sys->b_adult = var_GetBool( p_demux, "shoutcast-show-adult" );
return VLC_SUCCESS;
}
char *psz_eltname = NULL; /* tag name */
input_item_t *p_input;
-#define FREE(a) if( a ) free( a ); a = NULL;
while( xml_ReaderRead( p_sys->p_xml_reader ) == 1 )
{
int i_type;
xml_ReaderValue( p_sys->p_xml_reader );
if( !psz_attrname || !psz_attrvalue )
{
- FREE(psz_attrname);
- FREE(psz_attrvalue);
+ FREENULL(psz_attrname);
+ FREENULL(psz_attrvalue);
free(psz_eltname);
/*FIXME: isn't return a bit too much. what about break*/
return -1;
p_sys->p_current, p_sys->p_item_in_category,
(p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
PLAYLIST_APPEND );
- FREE( psz_name );
+ FREENULL( psz_name );
}
- FREE( psz_eltname );
+ FREENULL( psz_eltname );
break;
}
}
if( !psz_attrname || !psz_attrvalue )
{
free(psz_eltname);
- FREE(psz_attrname);
- FREE(psz_attrvalue);
+ FREENULL(psz_attrname);
+ FREENULL(psz_attrvalue);
return -1;
}
if( !psz_attrname || !psz_attrvalue )
{
free(psz_eltname);
- FREE(psz_attrname);
- FREE(psz_attrvalue);
+ FREENULL(psz_attrname);
+ FREENULL(psz_attrvalue);
return -1;
}
( psz_base || ( psz_rt && psz_load &&
( p_sys->b_adult || strcmp( psz_rt, "NC17" ) ) ) ) )
{
- playlist_item_t *p_item;
char *psz_mrl = NULL;
if( psz_rt || psz_load )
{
(p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
PLAYLIST_APPEND );
- FREE( psz_name );
- FREE( psz_mt )
- FREE( psz_id )
- FREE( psz_br )
- FREE( psz_genre )
- FREE( psz_ct )
- FREE( psz_lc )
- FREE( psz_rt )
+ FREENULL( psz_name );
+ FREENULL( psz_mt )
+ FREENULL( psz_id )
+ FREENULL( psz_br )
+ FREENULL( psz_genre )
+ FREENULL( psz_ct )
+ FREENULL( psz_lc )
+ FREENULL( psz_rt )
}
free( psz_eltname );
break;
}
return 0;
}
-#undef FREE
static int Control( demux_t *p_demux, int i_query, va_list args )
{