📄 rc.c
字号:
return VLC_SUCCESS;}static int Volume( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); intf_thread_t *p_intf = (intf_thread_t*)p_this; input_thread_t *p_input = NULL; int i_error = VLC_EGENERIC; p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( !p_input ) return VLC_ENOOBJ; if( p_input ) { vlc_value_t val; var_Get( p_input, "state", &val ); if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) { msg_rc( _("Type 'menu select' or 'pause' to continue.") ); vlc_object_release( p_input ); return VLC_EGENERIC; } vlc_object_release( p_input ); } if ( *newval.psz_string ) { /* Set. */ audio_volume_t i_volume = atoi( newval.psz_string ); if ( (i_volume > (audio_volume_t)AOUT_VOLUME_MAX) ) { msg_rc( "Volume must be in the range %d-%d.", AOUT_VOLUME_MIN, AOUT_VOLUME_MAX ); i_error = VLC_EBADVAR; } else { if( i_volume == AOUT_VOLUME_MIN ) { vlc_value_t keyval; keyval.i_int = config_GetInt( p_intf, "key-vol-mute" ); var_Set( p_intf->p_libvlc, "key-pressed", keyval ); } i_error = aout_VolumeSet( p_this, i_volume ); osd_Volume( p_this ); msg_rc( STATUS_CHANGE "( audio volume: %d )", i_volume ); } } else { /* Get. */ audio_volume_t i_volume; if ( aout_VolumeGet( p_this, &i_volume ) < 0 ) { i_error = VLC_EGENERIC; } else { msg_rc( STATUS_CHANGE "( audio volume: %d )", i_volume ); i_error = VLC_SUCCESS; } } return i_error;}static int VolumeMove( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ VLC_UNUSED(oldval); VLC_UNUSED(p_data); intf_thread_t *p_intf = (intf_thread_t*)p_this; audio_volume_t i_volume; input_thread_t *p_input = NULL; int i_nb_steps = atoi(newval.psz_string); int i_error = VLC_SUCCESS; int i_volume_step = 0; p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( !p_input ) return VLC_ENOOBJ; if( p_input ) { vlc_value_t val; var_Get( p_input, "state", &val ); if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) { msg_rc( _("Type 'menu select' or 'pause' to continue.") ); vlc_object_release( p_input ); return VLC_EGENERIC; } vlc_object_release( p_input ); } i_volume_step = config_GetInt( p_intf->p_libvlc, "volume-step" ); if ( i_nb_steps <= 0 || i_nb_steps > (AOUT_VOLUME_MAX/i_volume_step) ) { i_nb_steps = 1; } if ( !strcmp(psz_cmd, "volup") ) { if ( aout_VolumeUp( p_this, i_nb_steps, &i_volume ) < 0 ) i_error = VLC_EGENERIC; } else { if ( aout_VolumeDown( p_this, i_nb_steps, &i_volume ) < 0 ) i_error = VLC_EGENERIC; } osd_Volume( p_this ); if ( !i_error ) msg_rc( STATUS_CHANGE "( audio volume: %d )", i_volume ); return i_error;}static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ VLC_UNUSED(oldval); VLC_UNUSED(p_data); intf_thread_t *p_intf = (intf_thread_t*)p_this; input_thread_t *p_input = NULL; vout_thread_t * p_vout; const char * psz_variable = NULL; int i_error; p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( !p_input ) return VLC_ENOOBJ; p_vout = vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD ); vlc_object_release( p_input ); if( !p_vout ) return VLC_ENOOBJ; if( !strcmp( psz_cmd, "vcrop" ) ) { psz_variable = "crop"; } else if( !strcmp( psz_cmd, "vratio" ) ) { psz_variable = "aspect-ratio"; } else if( !strcmp( psz_cmd, "vzoom" ) ) { psz_variable = "zoom"; } else if( !strcmp( psz_cmd, "snapshot" ) ) { psz_variable = "video-snapshot"; } if( newval.psz_string && *newval.psz_string ) { /* set */ if( !strcmp( psz_variable, "zoom" ) ) { vlc_value_t val; val.f_float = atof( newval.psz_string ); i_error = var_Set( p_vout, psz_variable, val ); } else { i_error = var_Set( p_vout, psz_variable, newval ); } } else if( !strcmp( psz_cmd, "snapshot" ) ) { vlc_value_t val; val.b_bool = true; i_error = var_Set( p_vout, psz_variable, val ); } else { /* get */ vlc_value_t val_name; vlc_value_t val, text; int i; float f_value = 0.; char *psz_value = NULL; if ( var_Get( p_vout, psz_variable, &val ) < 0 ) { vlc_object_release( p_vout ); return VLC_EGENERIC; } if( !strcmp( psz_variable, "zoom" ) ) { f_value = val.f_float; } else { psz_value = strdup( val.psz_string ); } if ( var_Change( p_vout, psz_variable, VLC_VAR_GETLIST, &val, &text ) < 0 ) { vlc_object_release( p_vout ); return VLC_EGENERIC; } /* Get the descriptive name of the variable */ var_Change( p_vout, psz_variable, VLC_VAR_GETTEXT, &val_name, NULL ); if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable); msg_rc( "+----[ %s ]", val_name.psz_string ); if( !strcmp( psz_variable, "zoom" ) ) { for ( i = 0; i < val.p_list->i_count; i++ ) { if ( f_value == val.p_list->p_values[i].f_float ) msg_rc( "| %f - %s *", val.p_list->p_values[i].f_float, text.p_list->p_values[i].psz_string ); else msg_rc( "| %f - %s", val.p_list->p_values[i].f_float, text.p_list->p_values[i].psz_string ); } } else { for ( i = 0; i < val.p_list->i_count; i++ ) { if ( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) ) msg_rc( "| %s - %s *", val.p_list->p_values[i].psz_string, text.p_list->p_values[i].psz_string ); else msg_rc( "| %s - %s", val.p_list->p_values[i].psz_string, text.p_list->p_values[i].psz_string ); } free( psz_value ); } var_Change( p_vout, psz_variable, VLC_VAR_FREELIST, &val, &text ); 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;}static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ VLC_UNUSED(oldval); VLC_UNUSED(p_data); intf_thread_t *p_intf = (intf_thread_t*)p_this; input_thread_t *p_input = NULL; aout_instance_t * p_aout; const char * psz_variable; vlc_value_t val_name; int i_error; p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( !p_input ) return VLC_ENOOBJ; if( p_input ) { vlc_value_t val; var_Get( p_input, "state", &val ); if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) { msg_rc( _("Type 'menu select' or 'pause' to continue.") ); vlc_object_release( p_input ); return VLC_EGENERIC; } vlc_object_release( p_input ); } p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT, FIND_ANYWHERE ); if ( p_aout == NULL ) return VLC_ENOOBJ; if ( !strcmp( psz_cmd, "adev" ) ) { psz_variable = "audio-device"; } else { psz_variable = "audio-channels"; } /* Get the descriptive name of the variable */ var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_GETTEXT, &val_name, NULL ); if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable); if ( !*newval.psz_string ) { /* Retrieve all registered ***. */ vlc_value_t val, text; int i, i_value; if ( var_Get( (vlc_object_t *)p_aout, psz_variable, &val ) < 0 ) { vlc_object_release( (vlc_object_t *)p_aout ); return VLC_EGENERIC; } i_value = val.i_int; if ( var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_GETLIST, &val, &text ) < 0 ) { vlc_object_release( (vlc_object_t *)p_aout ); return VLC_EGENERIC; } msg_rc( "+----[ %s ]", val_name.psz_string ); for ( i = 0; i < val.p_list->i_count; i++ ) { if ( i_value == val.p_list->p_values[i].i_int ) msg_rc( "| %i - %s *", val.p_list->p_values[i].i_int, text.p_list->p_values[i].psz_string ); else msg_rc( "| %i - %s", val.p_list->p_values[i].i_int, text.p_list->p_values[i].psz_string ); } var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST, &val, &text ); msg_rc( "+----[ end of %s ]", val_name.psz_string ); free( val_name.psz_string ); i_error = VLC_SUCCESS; } else { vlc_value_t val; val.i_int = atoi( newval.psz_string ); i_error = var_Set( (vlc_object_t *)p_aout, psz_variable, val ); } vlc_object_release( (vlc_object_t *)p_aout ); return i_error;}/* OSD menu commands */static int Menu( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); intf_thread_t *p_intf = (intf_thread_t*)p_this; playlist_t *p_playlist = NULL; int i_error = VLC_SUCCESS; vlc_value_t val; if ( !*newval.psz_string ) { msg_rc( _("Please provide one of the following parameters:") ); msg_rc( "[on|off|up|down|left|right|select]" ); return VLC_EGENERIC; } p_playlist = pl_Yield( p_this ); if( p_playlist->p_input ) { var_Get( p_playlist->p_input, "state", &val ); if( ( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) && ( strcmp( newval.psz_string, "select" ) != 0 ) ) { msg_rc( _("Type 'menu select' or 'pause' to continue.") ); vlc_object_release( p_playlist ); return VLC_EGENERIC; } } vlc_object_release( p_playlist ); val.psz_string = strdup( newval.psz_string ); if( !val.psz_string ) return VLC_ENOMEM; if( !strcmp( val.psz_string, "on" ) || !strcmp( val.psz_string, "show" )) osd_MenuShow( p_this ); else if( !strcmp( val.ps
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -