b_daemon = true;
/* lets check if we need to write the pidfile */
- psz_pidfile = config_GetPsz( p_libvlc, "pidfile" );
+ psz_pidfile = var_CreateGetNonEmptyString( p_libvlc, "pidfile" );
if( psz_pidfile != NULL )
{
FILE *pidfile;
priv->i_verbose = config_GetInt( p_libvlc, "verbose" );
/* Check if the user specified a custom language */
- psz_language = config_GetPsz( p_libvlc, "language" );
- if( psz_language && *psz_language && strcmp( psz_language, "auto" ) )
+ psz_language = var_CreateGetNonEmptyString( p_libvlc, "language" );
+ if( psz_language && strcmp( psz_language, "auto" ) )
{
/* Reset the default domain */
SetLanguage( psz_language );
abort();
}
/* Check for help on modules */
- if( (p_tmp = config_GetPsz( p_libvlc, "module" )) )
+ if( (p_tmp = var_CreateGetNonEmptyString( p_libvlc, "module" )) )
{
Help( p_libvlc, p_tmp );
free( p_tmp );
/*
* Message queue options
*/
- char * psz_verbose_objects = config_GetPsz( p_libvlc, "verbose-objects" );
+ char * psz_verbose_objects = var_CreateGetNonEmptyString( p_libvlc, "verbose-objects" );
if( psz_verbose_objects )
{
char * psz_object, * iter = psz_verbose_objects;
vlc_object_attach( p_playlist, p_libvlc );
/* Add service discovery modules */
- psz_modules = config_GetPsz( p_playlist, "services-discovery" );
- if( psz_modules && *psz_modules )
+ psz_modules = var_CreateGetNonEmptyString( p_playlist, "services-discovery" );
+ if( psz_modules )
{
char *p = psz_modules, *m;
while( ( m = strsep( &p, " :," ) ) != NULL )
#ifdef ENABLE_VLM
/* Initialize VLM if vlm-conf is specified */
- psz_parser = config_GetPsz( p_libvlc, "vlm-conf" );
- if( psz_parser && *psz_parser )
+ psz_parser = var_CreateGetNonEmptyString( p_libvlc, "vlm-conf" );
+ if( psz_parser )
{
priv->p_vlm = vlm_New( p_libvlc );
if( !priv->p_vlm )
all interfaces as they can use it) */
var_Create( p_libvlc, "volume-change", VLC_VAR_BOOL );
- psz_modules = config_GetPsz( p_libvlc, "extraintf" );
- psz_control = config_GetPsz( p_libvlc, "control" );
+ psz_modules = var_CreateGetNonEmptyString( p_libvlc, "extraintf" );
+ psz_control = var_CreateGetNonEmptyString( p_libvlc, "control" );
- if( psz_modules && *psz_modules && psz_control && *psz_control )
+ if( psz_modules && psz_control )
{
char* psz_tmp;
if( asprintf( &psz_tmp, "%s:%s", psz_modules, psz_control ) != -1 )
psz_modules = psz_tmp;
}
}
- else if( psz_control && *psz_control )
+ else if( psz_control )
{
free( psz_modules );
psz_modules = strdup( psz_control );
#ifdef WIN32
if( config_GetInt( p_libvlc, "prefer-system-codecs") > 0 )
{
- char *psz_codecs = config_GetPsz( p_playlist, "codec" );
+ char *psz_codecs = var_CreateGetNonEmptyString( p_playlist, "codec" );
if( psz_codecs )
{
char *psz_morecodecs;
if( asprintf(&psz_morecodecs, "%s,dmo,quicktime", psz_codecs) != -1 )
{
- config_PutPsz( p_libvlc, "codec", psz_morecodecs);
+ var_SetString( p_libvlc, "codec", psz_morecodecs);
free( psz_morecodecs );
}
+ free( psz_codecs );
}
else
- config_PutPsz( p_libvlc, "codec", "dmo,quicktime");
- free( psz_codecs );
+ var_SetString( p_libvlc, "codec", "dmo,quicktime");
}
#endif
if( b_daemon )
{
- psz_pidfile = config_GetPsz( p_libvlc, "pidfile" );
+ psz_pidfile = var_CreateGetNonEmptyString( p_libvlc, "pidfile" );
if( psz_pidfile != NULL )
{
msg_Dbg( p_libvlc, "removing pid file %s", psz_pidfile );
if( !psz_module ) /* requesting the default interface */
{
- char *psz_interface = config_GetPsz( p_libvlc, "intf" );
- if( !psz_interface || !*psz_interface ) /* "intf" has not been set */
+ char *psz_interface = var_CreateGetNonEmptyString( p_libvlc, "intf" );
+ if( !psz_interface ) /* "intf" has not been set */
{
#ifndef WIN32
if( b_daemon )
}
/* Try to create the interface */
- if( intf_Create( p_libvlc, psz_module ? psz_module : "$intf" ) )
- {
+ int ret = intf_Create( p_libvlc, psz_module ? psz_module : "$intf" );
+ if( ret )
msg_Err( p_libvlc, "interface \"%s\" initialization failed",
psz_module ? psz_module : "default" );
- return VLC_EGENERIC;
- }
- return VLC_SUCCESS;
+ var_Destroy( p_libvlc, "intf" );
+ return ret;
}
static vlc_mutex_t exit_lock = VLC_STATIC_MUTEX;
static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
char *psz_list )
{
- if( psz_list && *psz_list )
+ assert( psz_list );
+
+ char *psz_cur = psz_list;
+ char *psz_next;
+ while( psz_cur && *psz_cur )
{
- char *psz_cur = psz_list;
- char *psz_next;
- while( psz_cur && *psz_cur )
+ vlc_value_t val, text;
+ psz_next = strchr( psz_cur, ',' );
+ if( psz_next )
{
- vlc_value_t val, text;
- psz_next = strchr( psz_cur, ',' );
- if( psz_next )
- {
- *psz_next = '\0';
- psz_next++;
- }
- val.psz_string = psz_cur;
- text.psz_string = psz_cur;
- var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, &val, &text);
- psz_cur = psz_next;
+ *psz_next = '\0';
+ psz_next++;
}
+ val.psz_string = psz_cur;
+ text.psz_string = psz_cur;
+ var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, &val, &text);
+ psz_cur = psz_next;
}
}
var_Create( p_vout, "crop-update", VLC_VAR_VOID );
/* Add custom crop ratios */
- psz_buf = config_GetPsz( p_vout, "custom-crop-ratios" );
- AddCustomRatios( p_vout, "crop", psz_buf );
- free( psz_buf );
+ psz_buf = var_CreateGetNonEmptyString( p_vout, "custom-crop-ratios" );
+ if( psz_buf )
+ {
+ AddCustomRatios( p_vout, "crop", psz_buf );
+ free( psz_buf );
+ }
var_AddCallback( p_vout, "crop", CropCallback, NULL );
var_Get( p_vout, "crop", &old_val );
}
/* Add custom aspect ratios */
- psz_buf = config_GetPsz( p_vout, "custom-aspect-ratios" );
- AddCustomRatios( p_vout, "aspect-ratio", psz_buf );
- free( psz_buf );
+ psz_buf = var_CreateGetNonEmptyString( p_vout, "custom-aspect-ratios" );
+ if( psz_buf )
+ {
+ AddCustomRatios( p_vout, "aspect-ratio", psz_buf );
+ free( psz_buf );
+ }
var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
var_Get( p_vout, "aspect-ratio", &old_val );