From 295b0e07523b7e9daf6c7ed76eec02d2dcfd80f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Tue, 17 Aug 2010 21:56:05 +0200 Subject: [PATCH] Use var_Inherit* when applicable. --- modules/access/alsa.c | 6 +++--- modules/access/cdda.c | 14 +++++++------- modules/access/eyetv.m | 7 ++----- modules/access/file.c | 4 ++-- modules/access/ftp.c | 6 +++--- modules/access/mmap.c | 2 +- modules/access/oss.c | 6 +++--- modules/access/pvr.c | 30 +++++++++++++++--------------- modules/access/sftp.c | 4 ++-- modules/access/smb.c | 6 +++--- modules/access/udp.c | 2 +- 11 files changed, 42 insertions(+), 45 deletions(-) diff --git a/modules/access/alsa.c b/modules/access/alsa.c index 54085ad6c2..31b7366503 100644 --- a/modules/access/alsa.c +++ b/modules/access/alsa.c @@ -247,9 +247,9 @@ static int DemuxOpen( vlc_object_t *p_this ) p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) ); if( p_sys == NULL ) return VLC_ENOMEM; - p_sys->i_sample_rate = var_CreateGetInteger( p_demux, CFG_PREFIX "samplerate" ); - p_sys->b_stereo = var_CreateGetBool( p_demux, CFG_PREFIX "stereo" ); - p_sys->i_cache = var_CreateGetInteger( p_demux, CFG_PREFIX "caching" ); + p_sys->i_sample_rate = var_InheritInteger( p_demux, CFG_PREFIX "samplerate" ); + p_sys->b_stereo = var_InheritBool( p_demux, CFG_PREFIX "stereo" ); + p_sys->i_cache = var_InheritInteger( p_demux, CFG_PREFIX "caching" ); p_sys->p_es = NULL; p_sys->p_block = NULL; p_sys->i_next_demux_date = -1; diff --git a/modules/access/cdda.c b/modules/access/cdda.c index 48c664b29e..1d6fe3cce4 100644 --- a/modules/access/cdda.c +++ b/modules/access/cdda.c @@ -144,7 +144,7 @@ static int Open( vlc_object_t *p_this ) if( !p_access->psz_access || !*p_access->psz_access ) return VLC_EGENERIC; - psz_name = var_CreateGetString( p_this, "cd-audio" ); + psz_name = var_InheritString( p_this, "cd-audio" ); if( !psz_name || !*psz_name ) { free( psz_name ); @@ -172,7 +172,7 @@ static int Open( vlc_object_t *p_this ) p_sys->vcddev = vcddev; /* Do we play a single track ? */ - p_sys->i_track = var_CreateGetInteger( p_access, "cdda-track" ) - 1; + p_sys->i_track = var_InheritInteger( p_access, "cdda-track" ) - 1; if( p_sys->i_track < 0 ) { @@ -211,10 +211,10 @@ static int Open( vlc_object_t *p_this ) p_sys->waveheader.DataChunkID = VLC_FOURCC('d', 'a', 't', 'a'); p_sys->waveheader.DataLength = 0; /* we just don't know */ - p_sys->i_first_sector = var_CreateGetInteger( p_access, - "cdda-first-sector" ); - p_sys->i_last_sector = var_CreateGetInteger( p_access, - "cdda-last-sector" ); + p_sys->i_first_sector = var_InheritInteger( p_access, + "cdda-first-sector" ); + p_sys->i_last_sector = var_InheritInteger( p_access, + "cdda-last-sector" ); /* Tracknumber in MRL */ if( p_sys->i_first_sector < 0 || p_sys->i_last_sector < 0 ) { @@ -606,7 +606,7 @@ static int GetTracks( access_t *p_access, input_item_t *p_current ) #ifdef HAVE_LIBCDDB static cddb_disc_t *GetCDDBInfo( access_t *p_access, int i_titles, int *p_sectors ) { - if( var_CreateGetInteger( p_access, "album-art" ) == ALBUM_ART_WHEN_ASKED ) + if( var_InheritInteger( p_access, "album-art" ) == ALBUM_ART_WHEN_ASKED ) return NULL; /* */ diff --git a/modules/access/eyetv.m b/modules/access/eyetv.m index 6933e233bb..051c361e40 100644 --- a/modules/access/eyetv.m +++ b/modules/access/eyetv.m @@ -167,13 +167,10 @@ static int Open( vlc_object_t *p_this ) if( !p_sys ) return VLC_ENOMEM; - p_sys->i_pts_delay = var_CreateGetInteger( p_access, "eyetv-caching" ); - - int val = var_CreateGetInteger( p_access, "eyetv-channel" ); + p_sys->i_pts_delay = var_InheritInteger( p_access, "eyetv-caching" ); msg_Dbg( p_access, "coming up" ); - - selectChannel( p_this, val ); + selectChannel( p_this, var_InheritInteger( p_access, "eyetv-channel" ) ); /* socket */ memset(&publicAddr, 0, sizeof(publicAddr)); diff --git a/modules/access/file.c b/modules/access/file.c index d0dd7c2888..59f6c6790e 100644 --- a/modules/access/file.c +++ b/modules/access/file.c @@ -216,9 +216,9 @@ int Open( vlc_object_t *p_this ) p_access->p_sys = p_sys; p_sys->i_nb_reads = 0; p_sys->fd = fd; - p_sys->caching = var_CreateGetInteger (p_access, "file-caching"); + p_sys->caching = var_InheritInteger (p_access, "file-caching"); if (IsRemote(fd)) - p_sys->caching += var_CreateGetInteger (p_access, "network-caching"); + p_sys->caching += var_InheritInteger (p_access, "network-caching"); p_sys->b_pace_control = true; if (S_ISREG (st.st_mode)) diff --git a/modules/access/ftp.c b/modules/access/ftp.c index 07cbf9b2a8..0a4b707c3e 100644 --- a/modules/access/ftp.c +++ b/modules/access/ftp.c @@ -156,7 +156,7 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys ) if( p_sys->url.psz_username && *p_sys->url.psz_username ) psz = strdup( p_sys->url.psz_username ); else - psz = var_CreateGetString( p_access, "ftp-user" ); + psz = var_InheritString( p_access, "ftp-user" ); if( !psz ) return -1; @@ -178,7 +178,7 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys ) if( p_sys->url.psz_password && *p_sys->url.psz_password ) psz = strdup( p_sys->url.psz_password ); else - psz = var_CreateGetString( p_access, "ftp-pwd" ); + psz = var_InheritString( p_access, "ftp-pwd" ); if( !psz ) return -1; @@ -197,7 +197,7 @@ static int Login( vlc_object_t *p_access, access_sys_t *p_sys ) break; case 3: msg_Dbg( p_access, "account needed" ); - psz = var_CreateGetString( p_access, "ftp-account" ); + psz = var_InheritString( p_access, "ftp-account" ); if( ftp_SendCommand( p_access, p_sys, "ACCT %s", psz ) < 0 || ftp_ReadCommand( p_access, p_sys, &i_answer, NULL ) < 0 ) diff --git a/modules/access/mmap.c b/modules/access/mmap.c index 2a03fce52e..2c7dfbfc35 100644 --- a/modules/access/mmap.c +++ b/modules/access/mmap.c @@ -88,7 +88,7 @@ static int Open (vlc_object_t *p_this) assert ((INT64_C(1) << 63) == ((off_t)(INT64_C(1) << 63))); - if (!var_CreateGetBool (p_this, "file-mmap")) + if (!var_InheritBool (p_this, "file-mmap")) return VLC_EGENERIC; /* disabled */ STANDARD_BLOCK_ACCESS_INIT; diff --git a/modules/access/oss.c b/modules/access/oss.c index 3fe0b7c7ff..dbcd949437 100644 --- a/modules/access/oss.c +++ b/modules/access/oss.c @@ -170,9 +170,9 @@ static int DemuxOpen( vlc_object_t *p_this ) p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) ); if( p_sys == NULL ) return VLC_ENOMEM; - p_sys->i_sample_rate = var_CreateGetInteger( p_demux, CFG_PREFIX "samplerate" ); - p_sys->b_stereo = var_CreateGetBool( p_demux, CFG_PREFIX "stereo" ); - p_sys->i_cache = var_CreateGetInteger( p_demux, CFG_PREFIX "caching" ); + p_sys->i_sample_rate = var_InheritInteger( p_demux, CFG_PREFIX "samplerate" ); + p_sys->b_stereo = var_InheritBool( p_demux, CFG_PREFIX "stereo" ); + p_sys->i_cache = var_InheritInteger( p_demux, CFG_PREFIX "caching" ); p_sys->i_fd = -1; p_sys->p_es = NULL; p_sys->p_block = NULL; diff --git a/modules/access/pvr.c b/modules/access/pvr.c index 6669879321..2bd417e069 100644 --- a/modules/access/pvr.c +++ b/modules/access/pvr.c @@ -560,21 +560,21 @@ static int Open( vlc_object_t * p_this ) /* defaults values */ var_Create( p_access, "pvr-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); - p_sys->psz_videodev = var_CreateGetString( p_access, "pvr-device" ); - p_sys->psz_radiodev = var_CreateGetString( p_access, "pvr-radio-device" ); - p_sys->i_standard = var_CreateGetInteger( p_access, "pvr-norm" ); - p_sys->i_width = var_CreateGetInteger( p_access, "pvr-width" ); - p_sys->i_height = var_CreateGetInteger( p_access, "pvr-height" ); - p_sys->i_frequency = var_CreateGetInteger( p_access, "pvr-frequency" ); - p_sys->i_framerate = var_CreateGetInteger( p_access, "pvr-framerate" ); - p_sys->i_keyint = var_CreateGetInteger( p_access, "pvr-keyint" ); - p_sys->i_bframes = var_CreateGetInteger( p_access, "pvr-bframes" ); - p_sys->i_bitrate = var_CreateGetInteger( p_access, "pvr-bitrate" ); - p_sys->i_bitrate_peak = var_CreateGetInteger( p_access, "pvr-bitrate-peak" ); - p_sys->i_bitrate_mode = var_CreateGetInteger( p_access, "pvr-bitrate-mode" ); - p_sys->i_audio_bitmask = var_CreateGetInteger( p_access, "pvr-audio-bitmask" ); - p_sys->i_volume = var_CreateGetInteger( p_access, "pvr-audio-volume" ); - p_sys->i_input = var_CreateGetInteger( p_access, "pvr-channel" ); + p_sys->psz_videodev = var_InheritString( p_access, "pvr-device" ); + p_sys->psz_radiodev = var_InheritString( p_access, "pvr-radio-device" ); + p_sys->i_standard = var_InheritInteger( p_access, "pvr-norm" ); + p_sys->i_width = var_InheritInteger( p_access, "pvr-width" ); + p_sys->i_height = var_InheritInteger( p_access, "pvr-height" ); + p_sys->i_frequency = var_InheritInteger( p_access, "pvr-frequency" ); + p_sys->i_framerate = var_InheritInteger( p_access, "pvr-framerate" ); + p_sys->i_keyint = var_InheritInteger( p_access, "pvr-keyint" ); + p_sys->i_bframes = var_InheritInteger( p_access, "pvr-bframes" ); + p_sys->i_bitrate = var_InheritInteger( p_access, "pvr-bitrate" ); + p_sys->i_bitrate_peak = var_InheritInteger( p_access, "pvr-bitrate-peak" ); + p_sys->i_bitrate_mode = var_InheritInteger( p_access, "pvr-bitrate-mode" ); + p_sys->i_audio_bitmask = var_InheritInteger( p_access, "pvr-audio-bitmask" ); + p_sys->i_volume = var_InheritInteger( p_access, "pvr-audio-volume" ); + p_sys->i_input = var_InheritInteger( p_access, "pvr-channel" ); /* parse command line options */ psz_tofree = strdup( p_access->psz_location ); diff --git a/modules/access/sftp.c b/modules/access/sftp.c index 9f419a63d8..9c451a6246 100644 --- a/modules/access/sftp.c +++ b/modules/access/sftp.c @@ -142,7 +142,7 @@ static int Open( vlc_object_t* p_this ) } if( url.i_port <= 0 ) - i_port = var_CreateGetInteger( p_access, "sftp-port" ); + i_port = var_InheritInteger( p_access, "sftp-port" ); else i_port = url.i_port; @@ -209,7 +209,7 @@ static int Open( vlc_object_t* p_this ) /* Create the two variables */ var_Create( p_access, "sftp-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); - p_sys->i_read_size = var_CreateGetInteger( p_access, "sftp-readsize" ); + p_sys->i_read_size = var_InheritInteger( p_access, "sftp-readsize" ); free( psz_password ); free( psz_username ); diff --git a/modules/access/smb.c b/modules/access/smb.c index abe67a7b23..4d06b0b3dc 100644 --- a/modules/access/smb.c +++ b/modules/access/smb.c @@ -184,11 +184,11 @@ static int Open( vlc_object_t *p_this ) /* Build an SMB URI * smb://[[[domain;]user[:password@]]server[/share[/path[/file]]]] */ - if( !psz_user ) psz_user = var_CreateGetString( p_access, "smb-user" ); + if( !psz_user ) psz_user = var_InheritString( p_access, "smb-user" ); if( psz_user && !*psz_user ) { free( psz_user ); psz_user = NULL; } - if( !psz_pwd ) psz_pwd = var_CreateGetString( p_access, "smb-pwd" ); + if( !psz_pwd ) psz_pwd = var_InheritString( p_access, "smb-pwd" ); if( psz_pwd && !*psz_pwd ) { free( psz_pwd ); psz_pwd = NULL; } - if( !psz_domain ) psz_domain = var_CreateGetString( p_access, "smb-domain" ); + if( !psz_domain ) psz_domain = var_InheritString( p_access, "smb-domain" ); if( psz_domain && !*psz_domain ) { free( psz_domain ); psz_domain = NULL; } #ifdef WIN32 diff --git a/modules/access/udp.c b/modules/access/udp.c index a57e8da30f..d243a290ea 100644 --- a/modules/access/udp.c +++ b/modules/access/udp.c @@ -110,7 +110,7 @@ static int Open( vlc_object_t *p_this ) } } - i_bind_port = var_CreateGetInteger( p_access, "server-port" ); + i_bind_port = var_InheritInteger( p_access, "server-port" ); /* Parse psz_name syntax : * [serveraddr[:serverport]][@[bindaddr]:[bindport]] */ -- 2.39.2