X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcontrol%2Frc.c;h=2c6d574137c31ad9b3bf3c3f7b13771a025b738f;hb=37a4d52044737bfaac6140a8e0a65d8f4e22987d;hp=995d2d1bf67030294337312f4f34ae5af7de87ec;hpb=90a6468ca739c70b4e50a4270d4ad862acefa037;p=vlc diff --git a/modules/control/rc.c b/modules/control/rc.c index 995d2d1bf6..2c6d574137 100644 --- a/modules/control/rc.c +++ b/modules/control/rc.c @@ -34,7 +34,6 @@ #include #include /* ENOMEM */ -#include #include #include @@ -48,10 +47,6 @@ #ifdef HAVE_UNISTD_H # include #endif - -#ifdef HAVE_SYS_TIME_H -# include -#endif #include #include @@ -220,14 +215,14 @@ static int Activate( vlc_object_t *p_this ) #ifndef WIN32 #if defined(HAVE_ISATTY) /* Check that stdin is a TTY */ - if( !config_GetInt( p_intf, "rc-fake-tty" ) && !isatty( 0 ) ) + if( !var_InheritInteger( p_intf, "rc-fake-tty" ) && !isatty( 0 ) ) { msg_Warn( p_intf, "fd 0 is not a TTY" ); return VLC_EGENERIC; } #endif - psz_unix_path = config_GetPsz( p_intf, "rc-unix" ); + psz_unix_path = var_InheritString( p_intf, "rc-unix" ); if( psz_unix_path ) { int i_socket; @@ -295,7 +290,7 @@ static int Activate( vlc_object_t *p_this ) #endif /* !WIN32 */ if( ( pi_socket == NULL ) && - ( psz_host = config_GetPsz( p_intf, "rc-host" ) ) != NULL ) + ( psz_host = var_InheritString( p_intf, "rc-host" ) ) != NULL ) { vlc_url_t url; @@ -334,7 +329,7 @@ static int Activate( vlc_object_t *p_this ) p_intf->pf_run = Run; #ifdef WIN32 - p_intf->p_sys->b_quiet = config_GetInt( p_intf, "rc-quiet" ); + p_intf->p_sys->b_quiet = var_InheritInteger( p_intf, "rc-quiet" ); if( !p_intf->p_sys->b_quiet ) { CONSOLE_INTRO_MSG; } #else CONSOLE_INTRO_MSG; @@ -444,10 +439,10 @@ static void RegisterCallbacks( intf_thread_t *p_intf ) static void Run( intf_thread_t *p_intf ) { input_thread_t * p_input = NULL; - playlist_t * p_playlist = pl_Hold( p_intf ); + playlist_t * p_playlist = pl_Get( p_intf ); char p_buffer[ MAX_LINE_LENGTH + 1 ]; - bool b_showpos = config_GetInt( p_intf, "rc-show-pos" ); + bool b_showpos = var_InheritInteger( p_intf, "rc-show-pos" ); bool b_longhelp = false; int i_size = 0; @@ -739,45 +734,34 @@ static void Run( intf_thread_t *p_intf ) } else if( !strcmp( psz_cmd, "key" ) || !strcmp( psz_cmd, "hotkey" ) ) { - var_SetInteger( p_intf->p_libvlc, "key-pressed", - config_GetInt( p_intf, psz_arg ) ); + var_SetInteger( p_intf->p_libvlc, "key-action", + vlc_GetActionId( psz_arg ) ); } else switch( psz_cmd[0] ) { case 'f': case 'F': + { + bool fs; + + if( !strncasecmp( psz_arg, "on", 2 ) ) + var_SetBool( p_playlist, "fullscreen", fs = true ); + else if( !strncasecmp( psz_arg, "off", 3 ) ) + var_SetBool( p_playlist, "fullscreen", fs = false ); + else + fs = var_ToggleBool( p_playlist, "fullscreen" ); + if( p_input ) { - vout_thread_t *p_vout; - p_vout = input_GetVout( p_input ); - + vout_thread_t *p_vout = input_GetVout( p_input ); if( p_vout ) { - vlc_value_t val; - bool b_update = false; - var_Get( p_vout, "fullscreen", &val ); - val.b_bool = !val.b_bool; - if( !strncmp( psz_arg, "on", 2 ) - && ( val.b_bool == true ) ) - { - b_update = true; - val.b_bool = true; - } - else if( !strncmp( psz_arg, "off", 3 ) - && ( val.b_bool == false ) ) - { - b_update = true; - val.b_bool = false; - } - else if( strncmp( psz_arg, "off", 3 ) - && strncmp( psz_arg, "on", 2 ) ) - b_update = true; - if( b_update ) var_Set( p_vout, "fullscreen", val ); + var_SetBool( p_vout, "fullscreen", fs ); vlc_object_release( p_vout ); } } break; - + } case 's': case 'S': ; @@ -805,8 +789,6 @@ static void Run( intf_thread_t *p_intf ) vlc_object_release( p_input ); } - pl_Release( p_intf ); - var_DelCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, p_intf ); vlc_restorecancel( canc ); } @@ -962,8 +944,8 @@ static void RateChanged( intf_thread_t *p_intf, input_thread_t *p_input ) { vlc_mutex_lock( &p_intf->p_sys->status_lock ); - msg_rc( STATUS_CHANGE "( new rate: %d )", - var_GetInteger( p_input, "rate" ) ); + msg_rc( STATUS_CHANGE "( new rate: %.3f )", + var_GetFloat( p_input, "rate" ) ); vlc_mutex_unlock( &p_intf->p_sys->status_lock ); } static void PositionChanged( intf_thread_t *p_intf, @@ -1059,9 +1041,9 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, { if( var_GetBool( p_input, "can-rate" ) ) { - int i_rate = var_GetInteger( p_input, "rate" ); - i_rate = (i_rate < 0) ? -i_rate : i_rate * 2; - var_SetInteger( p_input, "rate", i_rate ); + float f_rate = var_GetFloat( p_input, "rate" ); + f_rate = (f_rate < 0) ? -f_rate : f_rate * 2; + var_SetFloat( p_input, "rate", f_rate ); } else { @@ -1073,9 +1055,9 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, { if( var_GetBool( p_input, "can-rewind" ) ) { - int i_rate = var_GetInteger( p_input, "rate" ); - i_rate = (i_rate > 0) ? -i_rate : i_rate / 2; - var_SetInteger( p_input, "rate", i_rate ); + float f_rate = var_GetFloat( p_input, "rate" ); + f_rate = (f_rate > 0) ? -f_rate : f_rate * 2; + var_SetFloat( p_input, "rate", f_rate ); } else { @@ -1591,7 +1573,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd, playlist_CurrentInput( p_intf->p_sys->p_playlist ); vout_thread_t * p_vout; const char * psz_variable = NULL; - int i_error; + int i_error = VLC_SUCCESS; if( !p_input ) return VLC_ENOOBJ; @@ -1637,7 +1619,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd, } else if( !strcmp( psz_cmd, "snapshot" ) ) { - i_error = var_SetBool( p_vout, psz_variable, true ); + var_TriggerCallback( p_vout, psz_variable ); } else { @@ -1705,8 +1687,6 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd, msg_rc( "+----[ end of %s ]", val_name.psz_string ); free( val_name.psz_string ); - - i_error = VLC_SUCCESS; } vlc_object_release( p_vout ); return i_error; @@ -2108,7 +2088,7 @@ static input_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl ) else if( *psz_item ) { i_options++; - ppsz_options = realloc( ppsz_options, i_options * sizeof(char *) ); + ppsz_options = xrealloc( ppsz_options, i_options * sizeof(char *) ); ppsz_options[i_options - 1] = &psz_item[1]; }