Commit 3b6a46b8 authored by Laurent Aimar's avatar Laurent Aimar

* access/*: use var_* helpers.

 * access/vcd/ clean up.
parent e34b5beb
...@@ -46,12 +46,12 @@ static void Close( vlc_object_t * ); ...@@ -46,12 +46,12 @@ static void Close( vlc_object_t * );
vlc_module_begin(); vlc_module_begin();
set_description( _("Audio CD input") ); set_description( _("Audio CD input") );
set_capability( "access2", 10 );
set_callbacks( Open, Close );
add_usage_hint( N_("[cdda:][device][@[track]]") );
add_integer( "cdda-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT, add_integer( "cdda-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
CACHING_LONGTEXT, VLC_TRUE ); CACHING_LONGTEXT, VLC_TRUE );
set_capability( "access2", 10 );
set_callbacks( Open, Close );
add_shortcut( "cdda" ); add_shortcut( "cdda" );
add_shortcut( "cddasimple" ); add_shortcut( "cddasimple" );
vlc_module_end(); vlc_module_end();
...@@ -98,7 +98,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -98,7 +98,6 @@ static int Open( vlc_object_t *p_this )
int i; int i;
int i_title = 0; int i_title = 0;
vcddev_t *vcddev; vcddev_t *vcddev;
vlc_value_t val;
/* Command line: cdda://[dev_path][@title] */ /* Command line: cdda://[dev_path][@title] */
if( ( psz = strchr( psz_dup, '@' ) ) ) if( ( psz = strchr( psz_dup, '@' ) ) )
...@@ -117,10 +116,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -117,10 +116,7 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
var_Create( p_access, "cd-audio", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); psz_dup = var_CreateGetString( p_access, "cd-audio" );
var_Get( p_access, "cd-audio", &val );
psz_dup = val.psz_string;
if( *psz_dup == '\0' ) if( *psz_dup == '\0' )
{ {
free( psz_dup ); free( psz_dup );
...@@ -361,7 +357,6 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -361,7 +357,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
int *pi_int; int *pi_int;
int64_t *pi_64; int64_t *pi_64;
input_title_t ***ppp_title; input_title_t ***ppp_title;
vlc_value_t val;
int i; int i;
switch( i_query ) switch( i_query )
...@@ -383,8 +378,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -383,8 +378,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "cdda-caching", &val ); *pi_64 = (int64_t)var_GetInteger( p_access, "cdda-caching" ) * I64C(1000);
*pi_64 = val.i_int * 1000;
break; break;
/* */ /* */
......
...@@ -164,8 +164,8 @@ static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len) ...@@ -164,8 +164,8 @@ static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len)
*****************************************************************************/ *****************************************************************************/
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len) static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
{ {
char *psz_name = 0; char *psz_name = NULL;
vlc_value_t val; char *psz;
int i_mode, i_pos; int i_mode, i_pos;
playlist_t *p_playlist = playlist_t *p_playlist =
...@@ -190,13 +190,12 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len) ...@@ -190,13 +190,12 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
} }
/* Initialize structure */ /* Initialize structure */
var_Create( p_access, "recursive", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); psz = var_CreateGetString( p_access, "recursive" );
var_Get( p_access, "recursive", &val ); if( *psz == '\0' || !strncmp( psz, "none" , 4 ) )
if( *val.psz_string == '\0' || !strncmp( val.psz_string, "none" , 4 ) )
{ {
i_mode = MODE_NONE; i_mode = MODE_NONE;
} }
else if( !strncmp( val.psz_string, "collapse", 8 ) ) else if( !strncmp( psz, "collapse", 8 ) )
{ {
i_mode = MODE_COLLAPSE; i_mode = MODE_COLLAPSE;
} }
...@@ -204,7 +203,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len) ...@@ -204,7 +203,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
{ {
i_mode = MODE_EXPAND; i_mode = MODE_EXPAND;
} }
free( val.psz_string ); free( psz );
/* Make sure we are deleted when we are done */ /* Make sure we are deleted when we are done */
p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE; p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE;
......
...@@ -129,15 +129,14 @@ static int Open( vlc_object_t *p_this ) ...@@ -129,15 +129,14 @@ static int Open( vlc_object_t *p_this )
{ {
access_t *p_access = (access_t*)p_this; access_t *p_access = (access_t*)p_this;
access_sys_t *p_sys; access_sys_t *p_sys;
char *psz_name = p_access->psz_path;
char * psz_name = p_access->psz_path; char *psz;
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
int i_stat; int i_stat;
struct stat stat_info; struct stat stat_info;
#endif #endif
vlc_bool_t b_stdin; vlc_bool_t b_stdin;
vlc_value_t val;
file_entry_t * p_file; file_entry_t * p_file;
...@@ -251,12 +250,10 @@ static int Open( vlc_object_t *p_this ) ...@@ -251,12 +250,10 @@ static int Open( vlc_object_t *p_this )
p_file->psz_name = strdup( psz_name ); p_file->psz_name = strdup( psz_name );
TAB_APPEND( p_sys->i_file, p_sys->file, p_file ); TAB_APPEND( p_sys->i_file, p_sys->file, p_file );
var_Create( p_access, "file-cat", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); psz = var_CreateGetString( p_access, "file-cat" );
var_Get( p_access, "file-cat", &val ); if( *psz )
if( *val.psz_string )
{ {
char *psz_parser = psz_name = val.psz_string; char *psz_parser = psz_name = psz;
int64_t i_size; int64_t i_size;
while( psz_name && *psz_name ) while( psz_name && *psz_name )
...@@ -292,7 +289,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -292,7 +289,7 @@ static int Open( vlc_object_t *p_this )
if( psz_name ) psz_name++; if( psz_name ) psz_name++;
} }
} }
free( val.psz_string ); free( psz );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -515,7 +512,6 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -515,7 +512,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
vlc_bool_t *pb_bool; vlc_bool_t *pb_bool;
int *pi_int; int *pi_int;
int64_t *pi_64; int64_t *pi_64;
vlc_value_t val;
switch( i_query ) switch( i_query )
{ {
...@@ -540,8 +536,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -540,8 +536,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "file-caching", &val ); *pi_64 = (int64_t)var_GetInteger( p_access, "file-caching" ) * I64C(1000);
*pi_64 = val.i_int * 1000;
break; break;
/* */ /* */
case ACCESS_SET_PAUSE_STATE: case ACCESS_SET_PAUSE_STATE:
......
...@@ -94,7 +94,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -94,7 +94,6 @@ static int Open( vlc_object_t *p_this )
access_t *p_access = (access_t*)p_this; access_t *p_access = (access_t*)p_this;
access_sys_t *p_sys; access_sys_t *p_sys;
char *psz; char *psz;
vlc_value_t val;
int i_answer; int i_answer;
char *psz_arg; char *psz_arg;
...@@ -158,15 +157,14 @@ static int Open( vlc_object_t *p_this ) ...@@ -158,15 +157,14 @@ static int Open( vlc_object_t *p_this )
msg_Dbg( p_access, "connection accepted (%d)", i_answer ); msg_Dbg( p_access, "connection accepted (%d)", i_answer );
var_Create( p_access, "ftp-user", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); psz = var_CreateGetString( p_access, "ftp-user" );
var_Get( p_access, "ftp-user", &val ); if( ftp_SendCommand( p_access, "USER %s", psz ) < 0 ||
if( ftp_SendCommand( p_access, "USER %s", val.psz_string ) < 0 ||
ftp_ReadCommand( p_access, &i_answer, NULL ) < 0 ) ftp_ReadCommand( p_access, &i_answer, NULL ) < 0 )
{ {
if( val.psz_string ) free( val.psz_string ); free( psz );
goto exit_error; goto exit_error;
} }
if( val.psz_string ) free( val.psz_string ); free( psz );
switch( i_answer / 100 ) switch( i_answer / 100 )
{ {
...@@ -175,15 +173,14 @@ static int Open( vlc_object_t *p_this ) ...@@ -175,15 +173,14 @@ static int Open( vlc_object_t *p_this )
break; break;
case 3: case 3:
msg_Dbg( p_access, "password needed" ); msg_Dbg( p_access, "password needed" );
var_Create( p_access, "ftp-pwd", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); psz = var_CreateGetString( p_access, "ftp-pwd" );
var_Get( p_access, "ftp-pwd", &val ); if( ftp_SendCommand( p_access, "PASS %s", psz ) < 0 ||
if( ftp_SendCommand( p_access, "PASS %s", val.psz_string ) < 0 ||
ftp_ReadCommand( p_access, &i_answer, NULL ) < 0 ) ftp_ReadCommand( p_access, &i_answer, NULL ) < 0 )
{ {
if( val.psz_string ) free( val.psz_string ); free( psz );
goto exit_error; goto exit_error;
} }
if( val.psz_string ) free( val.psz_string ); free( psz );
switch( i_answer / 100 ) switch( i_answer / 100 )
{ {
...@@ -192,17 +189,15 @@ static int Open( vlc_object_t *p_this ) ...@@ -192,17 +189,15 @@ static int Open( vlc_object_t *p_this )
break; break;
case 3: case 3:
msg_Dbg( p_access, "account needed" ); msg_Dbg( p_access, "account needed" );
var_Create( p_access, "ftp-account", psz = var_CreateGetString( p_access, "ftp-account" );
VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_access, "ftp-account", &val );
if( ftp_SendCommand( p_access, "ACCT %s", if( ftp_SendCommand( p_access, "ACCT %s",
val.psz_string ) < 0 || psz ) < 0 ||
ftp_ReadCommand( p_access, &i_answer, NULL ) < 0 ) ftp_ReadCommand( p_access, &i_answer, NULL ) < 0 )
{ {
if( val.psz_string ) free( val.psz_string ); free( psz );
goto exit_error; goto exit_error;
} }
if( val.psz_string ) free( val.psz_string ); free( psz );
if( i_answer / 100 != 2 ) if( i_answer / 100 != 2 )
{ {
...@@ -372,7 +367,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -372,7 +367,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "ftp-caching", &val ); var_Get( p_access, "ftp-caching", &val );
*pi_64 = val.i_int * 1000; *pi_64 = (int64_t)var_GetInteger( p_access, "ftp-caching" ) * I64C(1000);
break; break;
/* */ /* */
......
...@@ -129,7 +129,7 @@ static int Open ( vlc_object_t *p_this ) ...@@ -129,7 +129,7 @@ static int Open ( vlc_object_t *p_this )
{ {
access_t *p_access = (access_t*)p_this; access_t *p_access = (access_t*)p_this;
access_sys_t *p_sys; access_sys_t *p_sys;
vlc_value_t val; char *psz;
/* First set ipv4/ipv6 */ /* First set ipv4/ipv6 */
var_Create( p_access, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_access, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
...@@ -137,6 +137,7 @@ static int Open ( vlc_object_t *p_this ) ...@@ -137,6 +137,7 @@ static int Open ( vlc_object_t *p_this )
if( *p_access->psz_access ) if( *p_access->psz_access )
{ {
vlc_value_t val;
/* Find out which shortcut was used */ /* Find out which shortcut was used */
if( !strncmp( p_access->psz_access, "http4", 6 ) ) if( !strncmp( p_access->psz_access, "http4", 6 ) )
{ {
...@@ -191,27 +192,19 @@ static int Open ( vlc_object_t *p_this ) ...@@ -191,27 +192,19 @@ static int Open ( vlc_object_t *p_this )
} }
if( !p_sys->psz_user || *p_sys->psz_user == '\0' ) if( !p_sys->psz_user || *p_sys->psz_user == '\0' )
{ {
var_Create( p_access, "http-user", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); p_sys->psz_user = var_CreateGetString( p_access, "http-user" );
var_Get( p_access, "http-user", &val ); p_sys->psz_passwd = var_CreateGetString( p_access, "http-pwd" );
p_sys->psz_user = val.psz_string;
var_Create( p_access, "http-pwd", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_access, "http-pwd", &val );
p_sys->psz_passwd = val.psz_string;
} }
/* Do user agent */ /* Do user agent */
var_Create( p_access, "http-user-agent", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); p_sys->psz_user_agent = var_CreateGetString( p_access, "http-user-agent" );
var_Get( p_access, "http-user-agent", &val );
p_sys->psz_user_agent = val.psz_string;
/* Check proxy */ /* Check proxy */
var_Create( p_access, "http-proxy", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); psz = var_CreateGetString( p_access, "http-proxy" );
var_Get( p_access, "http-proxy", &val ); if( *psz )
if( val.psz_string && *val.psz_string )
{ {
p_sys->b_proxy = VLC_TRUE; p_sys->b_proxy = VLC_TRUE;
vlc_UrlParse( &p_sys->proxy, val.psz_string, 0 ); vlc_UrlParse( &p_sys->proxy, psz, 0 );
} }
else else
{ {
...@@ -219,17 +212,12 @@ static int Open ( vlc_object_t *p_this ) ...@@ -219,17 +212,12 @@ static int Open ( vlc_object_t *p_this )
if( psz_proxy && *psz_proxy ) if( psz_proxy && *psz_proxy )
{ {
p_sys->b_proxy = VLC_TRUE; p_sys->b_proxy = VLC_TRUE;
vlc_UrlParse( &p_sys->proxy, val.psz_string, 0 ); vlc_UrlParse( &p_sys->proxy, psz_proxy, 0 );
} }
if( psz_proxy ) if( psz_proxy )
{
free( psz_proxy ); free( psz_proxy );
}
}
if( val.psz_string )
{
free( val.psz_string );
} }
free( psz );
if( p_sys->b_proxy ) if( p_sys->b_proxy )
{ {
...@@ -497,7 +485,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -497,7 +485,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "http-caching", &val ); var_Get( p_access, "http-caching", &val );
*pi_64 = val.i_int * 1000; *pi_64 = (int64_t)var_GetInteger( p_access, "http-caching" ) * 1000;
break; break;
/* */ /* */
......
...@@ -66,7 +66,6 @@ int E_(MMSHOpen)( access_t *p_access ) ...@@ -66,7 +66,6 @@ int E_(MMSHOpen)( access_t *p_access )
{ {
access_sys_t *p_sys; access_sys_t *p_sys;
char *psz_location = NULL; char *psz_location = NULL;
vlc_value_t val;
/* init p_sys */ /* init p_sys */
...@@ -145,9 +144,6 @@ int E_(MMSHOpen)( access_t *p_access ) ...@@ -145,9 +144,6 @@ int E_(MMSHOpen)( access_t *p_access )
p_access->info.i_size = p_sys->asfh.i_file_size; p_access->info.i_size = p_sys->asfh.i_file_size;
} }
/* Update default_pts to a suitable value for mms access */
var_Get( p_access, "mms-caching", &val );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -171,7 +167,6 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -171,7 +167,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
vlc_bool_t *pb_bool; vlc_bool_t *pb_bool;
int *pi_int; int *pi_int;
int64_t *pi_64; int64_t *pi_64;
vlc_value_t val;
switch( i_query ) switch( i_query )
{ {
...@@ -195,8 +190,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -195,8 +190,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "mms-caching", &val ); *pi_64 = (int64_t)var_GetInteger( p_access, "mms-caching" ) * I64C(1000);
*pi_64 = val.i_int * 1000;
break; break;
/* */ /* */
...@@ -531,10 +525,10 @@ static int Describe( access_t *p_access, char **ppsz_location ) ...@@ -531,10 +525,10 @@ static int Describe( access_t *p_access, char **ppsz_location )
p_sys->asfh.i_min_data_packet_size ); p_sys->asfh.i_min_data_packet_size );
E_( asf_StreamSelect)( &p_sys->asfh, E_( asf_StreamSelect)( &p_sys->asfh,
config_GetInt( p_access, "mms-maxbitrate" ), var_CreateGetInteger( p_access, "mms-maxbitrate" ),
config_GetInt( p_access, "mms-all" ), var_CreateGetInteger( p_access, "mms-all" ),
config_GetInt( p_access, "audio" ), var_CreateGetInteger( p_access, "audio" ),
config_GetInt( p_access, "video" ) ); var_CreateGetInteger( p_access, "video" ) );
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -120,7 +120,6 @@ int E_(MMSTUOpen)( access_t *p_access ) ...@@ -120,7 +120,6 @@ int E_(MMSTUOpen)( access_t *p_access )
access_sys_t *p_sys; access_sys_t *p_sys;
int i_proto; int i_proto;
int i_status; int i_status;
vlc_value_t val;
/* Set up p_access */ /* Set up p_access */
p_access->pf_read = Read; p_access->pf_read = Read;
...@@ -215,10 +214,6 @@ int E_(MMSTUOpen)( access_t *p_access ) ...@@ -215,10 +214,6 @@ int E_(MMSTUOpen)( access_t *p_access )
vlc_UrlClean( &p_sys->url ); vlc_UrlClean( &p_sys->url );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* Update default_pts to a suitable value for mms access */
var_Get( p_access, "mms-caching", &val );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -272,7 +267,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -272,7 +267,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "mms-caching", &val ); var_Get( p_access, "mms-caching", &val );
*pi_64 = val.i_int * 1000; *pi_64 = (int64_t)var_GetInteger( p_access, "mms-caching" ) * I64C(1000);
break; break;
/* */ /* */
...@@ -748,10 +743,10 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto ) ...@@ -748,10 +743,10 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto )
E_( asf_HeaderParse )( &p_sys->asfh, E_( asf_HeaderParse )( &p_sys->asfh,
p_sys->p_header, p_sys->i_header ); p_sys->p_header, p_sys->i_header );
E_( asf_StreamSelect)( &p_sys->asfh, E_( asf_StreamSelect)( &p_sys->asfh,
config_GetInt( p_access, "mms-maxbitrate" ), var_CreateGetInteger( p_access, "mms-maxbitrate" ),
config_GetInt( p_access, "mms-all" ), var_CreateGetInteger( p_access, "mms-all" ),
config_GetInt( p_access, "audio" ), var_CreateGetInteger( p_access, "audio" ),
config_GetInt( p_access, "video" ) ); var_CreateGetInteger( p_access, "video" ) );
/* *** now select stream we want to receive *** */ /* *** now select stream we want to receive *** */
/* TODO take care of stream bitrate TODO */ /* TODO take care of stream bitrate TODO */
......
...@@ -172,7 +172,6 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -172,7 +172,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
vlc_bool_t *pb_bool; vlc_bool_t *pb_bool;
int *pi_int; int *pi_int;
int64_t *pi_64; int64_t *pi_64;
vlc_value_t val;
switch( i_query ) switch( i_query )
{ {
...@@ -199,8 +198,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -199,8 +198,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "tcp-caching", &val ); *pi_64 = (int64_t)var_GetInteger( p_access, "tcp-caching" ) * I64C(1000);
*pi_64 = val.i_int * 1000;
break; break;
/* */ /* */
......
...@@ -103,7 +103,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -103,7 +103,6 @@ static int Open( vlc_object_t *p_this )
char *psz_bind_port = ""; char *psz_bind_port = "";
int i_bind_port = 0; int i_bind_port = 0;
int i_server_port = 0; int i_server_port = 0;
vlc_value_t val;
/* First set ipv4/ipv6 */ /* First set ipv4/ipv6 */
...@@ -112,6 +111,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -112,6 +111,7 @@ static int Open( vlc_object_t *p_this )
if( *p_access->psz_access ) if( *p_access->psz_access )
{ {
vlc_value_t val;
/* Find out which shortcut was used */ /* Find out which shortcut was used */
if( !strncmp( p_access->psz_access, "udp4", 6 ) || if( !strncmp( p_access->psz_access, "udp4", 6 ) ||
!strncmp( p_access->psz_access, "rtp4", 6 )) !strncmp( p_access->psz_access, "rtp4", 6 ))
...@@ -201,9 +201,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -201,9 +201,7 @@ static int Open( vlc_object_t *p_this )
i_server_port = strtol( psz_server_port, NULL, 10 ); i_server_port = strtol( psz_server_port, NULL, 10 );
if( ( i_bind_port = strtol( psz_bind_port, NULL, 10 ) ) == 0 ) if( ( i_bind_port = strtol( psz_bind_port, NULL, 10 ) ) == 0 )
{ {
var_Create( p_access, "server-port", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); i_bind_port = var_CreateGetInteger( p_access, "server-port" );
var_Get( p_access, "server-port", &val );
i_bind_port = val.i_int;
} }
msg_Dbg( p_access, "opening server=%s:%d local=%s:%d", msg_Dbg( p_access, "opening server=%s:%d local=%s:%d",
...@@ -234,13 +232,11 @@ static int Open( vlc_object_t *p_this ) ...@@ -234,13 +232,11 @@ static int Open( vlc_object_t *p_this )
free( psz_name ); free( psz_name );
/* FIXME */ /* FIXME */
var_Create( p_access, "mtu", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); p_sys->i_mtu = var_CreateGetInteger( p_access, "mtu" );
var_Get( p_access, "mtu", &val); if( p_sys->i_mtu <= 1 )
p_sys->i_mtu = val.i_int > 0 ? val.i_int : 1500; /* avoid problem */ p_sys->i_mtu = 1500; /* Avoid problem */
var_Create( p_access, "udp-auto-mtu", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); p_sys->b_auto_mtu = var_CreateGetBool( p_access, "udp-auto-mtu" );;
var_Get( p_access, "udp-auto-mtu", &val);
p_sys->b_auto_mtu = val.b_bool;
/* Update default_pts to a suitable value for udp access */ /* Update default_pts to a suitable value for udp access */
var_Create( p_access, "udp-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_access, "udp-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
...@@ -290,7 +286,7 @@ static int Control( access_t *p_access, int i_query, va_list args ) ...@@ -290,7 +286,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case ACCESS_GET_PTS_DELAY: case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * ); pi_64 = (int64_t*)va_arg( args, int64_t * );
var_Get( p_access, "udp-caching", &val ); var_Get( p_access, "udp-caching", &val );
*pi_64 = val.i_int * 1000; *pi_64 = var_GetInteger( p_access, "udp-caching" ) * 1000;
break; break;
/* */ /* */
......
This diff is collapsed.
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