📄 rc.c
字号:
if( p_input ) { vout_thread_t *p_vout; p_vout = vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD ); 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 ); vlc_object_release( p_vout ); } } break; case 's': case 'S': ; break; case '\0': /* Ignore empty lines */ break; default: msg_rc(_("Unknown command `%s'. Type `help' for help."), psz_cmd); break; } /* Command processed */ i_size = 0; p_buffer[0] = 0; } msg_rc( STATUS_CHANGE "( stop state: 0 )" ); msg_rc( STATUS_CHANGE "( quit )" ); if( p_input ) { var_DelCallback( p_input, "state", StateChanged, p_intf ); var_DelCallback( p_input, "rate-faster", RateChanged, p_intf ); var_DelCallback( p_input, "rate-slower", RateChanged, p_intf ); var_DelCallback( p_input, "rate", RateChanged, p_intf ); var_DelCallback( p_input, "time-offset", TimeOffsetChanged, p_intf ); vlc_object_release( p_input ); p_input = NULL; } if( p_playlist ) { vlc_object_release( p_playlist ); p_playlist = NULL; } var_DelCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, p_intf );}static void Help( intf_thread_t *p_intf, bool b_longhelp){ msg_rc(_("+----[ Remote control commands ]")); msg_rc( "| "); msg_rc(_("| add XYZ . . . . . . . . . . . . add XYZ to playlist")); msg_rc(_("| enqueue XYZ . . . . . . . . . queue XYZ to playlist")); msg_rc(_("| playlist . . . . . show items currently in playlist")); msg_rc(_("| play . . . . . . . . . . . . . . . . . . play stream")); msg_rc(_("| stop . . . . . . . . . . . . . . . . . . stop stream")); msg_rc(_("| next . . . . . . . . . . . . . . next playlist item")); msg_rc(_("| prev . . . . . . . . . . . . previous playlist item")); msg_rc(_("| goto . . . . . . . . . . . . . . goto item at index")); msg_rc(_("| repeat [on|off] . . . . toggle playlist item repeat")); msg_rc(_("| loop [on|off] . . . . . . . . . toggle playlist loop")); msg_rc(_("| random [on|off] . . . . . . . toggle random jumping")); msg_rc(_("| clear . . . . . . . . . . . . . . clear the playlist")); msg_rc(_("| status . . . . . . . . . . . current playlist status")); msg_rc(_("| title [X] . . . . . . set/get title in current item")); msg_rc(_("| title_n . . . . . . . . next title in current item")); msg_rc(_("| title_p . . . . . . previous title in current item")); msg_rc(_("| chapter [X] . . . . set/get chapter in current item")); msg_rc(_("| chapter_n . . . . . . next chapter in current item")); msg_rc(_("| chapter_p . . . . previous chapter in current item")); msg_rc( "| "); msg_rc(_("| seek X . . . seek in seconds, for instance `seek 12'")); msg_rc(_("| pause . . . . . . . . . . . . . . . . toggle pause")); msg_rc(_("| fastforward . . . . . . . . . set to maximum rate")); msg_rc(_("| rewind . . . . . . . . . . . . set to minimum rate")); msg_rc(_("| faster . . . . . . . . . . faster playing of stream")); msg_rc(_("| slower . . . . . . . . . . slower playing of stream")); msg_rc(_("| normal . . . . . . . . . . normal playing of stream")); msg_rc(_("| f [on|off] . . . . . . . . . . . . toggle fullscreen")); msg_rc(_("| info . . . . . information about the current stream")); msg_rc(_("| stats . . . . . . . . show statistical information")); msg_rc(_("| get_time . . seconds elapsed since stream's beginning")); msg_rc(_("| is_playing . . . . 1 if a stream plays, 0 otherwise")); msg_rc(_("| get_title . . . . . the title of the current stream")); msg_rc(_("| get_length . . . . the length of the current stream")); msg_rc( "| "); msg_rc(_("| volume [X] . . . . . . . . . . set/get audio volume")); msg_rc(_("| volup [X] . . . . . . . raise audio volume X steps")); msg_rc(_("| voldown [X] . . . . . . lower audio volume X steps")); msg_rc(_("| adev [X] . . . . . . . . . . . set/get audio device")); msg_rc(_("| achan [X]. . . . . . . . . . set/get audio channels")); msg_rc(_("| atrack [X] . . . . . . . . . . . set/get audio track")); msg_rc(_("| vtrack [X] . . . . . . . . . . . set/get video track")); msg_rc(_("| vratio [X] . . . . . . . set/get video aspect ratio")); msg_rc(_("| vcrop [X] . . . . . . . . . . . set/get video crop")); msg_rc(_("| vzoom [X] . . . . . . . . . . . set/get video zoom")); msg_rc(_("| snapshot . . . . . . . . . . . . take video snapshot")); msg_rc(_("| strack [X] . . . . . . . . . set/get subtitles track")); msg_rc(_("| key [hotkey name] . . . . . . simulate hotkey press")); msg_rc(_("| menu . . [on|off|up|down|left|right|select] use menu")); msg_rc( "| "); if (b_longhelp) { msg_rc(_("| @name marq-marquee STRING . . overlay STRING in video")); msg_rc(_("| @name marq-x X . . . . . . . . . . . .offset from left")); msg_rc(_("| @name marq-y Y . . . . . . . . . . . . offset from top")); msg_rc(_("| @name marq-position #. . . .relative position control")); msg_rc(_("| @name marq-color # . . . . . . . . . . font color, RGB")); msg_rc(_("| @name marq-opacity # . . . . . . . . . . . . . opacity")); msg_rc(_("| @name marq-timeout T. . . . . . . . . . timeout, in ms")); msg_rc(_("| @name marq-size # . . . . . . . . font size, in pixels")); msg_rc( "| "); msg_rc(_("| @name logo-file STRING . . .the overlay file path/name")); msg_rc(_("| @name logo-x X . . . . . . . . . . . .offset from left")); msg_rc(_("| @name logo-y Y . . . . . . . . . . . . offset from top")); msg_rc(_("| @name logo-position #. . . . . . . . relative position")); msg_rc(_("| @name logo-transparency #. . . . . . . . .transparency")); msg_rc( "| "); msg_rc(_("| @name mosaic-alpha # . . . . . . . . . . . . . . alpha")); msg_rc(_("| @name mosaic-height #. . . . . . . . . . . . . .height")); msg_rc(_("| @name mosaic-width # . . . . . . . . . . . . . . width")); msg_rc(_("| @name mosaic-xoffset # . . . .top left corner position")); msg_rc(_("| @name mosaic-yoffset # . . . .top left corner position")); msg_rc(_("| @name mosaic-offsets x,y(,x,y)*. . . . list of offsets")); msg_rc(_("| @name mosaic-align 0..2,4..6,8..10. . .mosaic alignment")); msg_rc(_("| @name mosaic-vborder # . . . . . . . . vertical border")); msg_rc(_("| @name mosaic-hborder # . . . . . . . horizontal border")); msg_rc(_("| @name mosaic-position {0=auto,1=fixed} . . . .position")); msg_rc(_("| @name mosaic-rows #. . . . . . . . . . .number of rows")); msg_rc(_("| @name mosaic-cols #. . . . . . . . . . .number of cols")); msg_rc(_("| @name mosaic-order id(,id)* . . . . order of pictures ")); msg_rc(_("| @name mosaic-keep-aspect-ratio {0,1} . . .aspect ratio")); msg_rc( "| "); } msg_rc(_("| help . . . . . . . . . . . . . . . this help message")); msg_rc(_("| longhelp . . . . . . . . . . . a longer help message")); msg_rc(_("| logout . . . . . . . exit (if in socket connection)")); msg_rc(_("| quit . . . . . . . . . . . . . . . . . . . quit vlc")); msg_rc( "| "); msg_rc(_("+----[ end of help ]"));}/******************************************************************** * Status callback routines ********************************************************************/static int TimeOffsetChanged( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval); intf_thread_t *p_intf = (intf_thread_t*)p_data; input_thread_t *p_input = NULL; vlc_mutex_lock( &p_intf->p_sys->status_lock ); p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( p_input ) { msg_rc( STATUS_CHANGE "( time-offset: %d )", var_GetInteger( p_input, "time-offset" ) ); vlc_object_release( p_input ); } vlc_mutex_unlock( &p_intf->p_sys->status_lock ); return VLC_SUCCESS;}static int VolumeChanged( 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(newval); intf_thread_t *p_intf = (intf_thread_t*)p_data; vlc_mutex_lock( &p_intf->p_sys->status_lock ); msg_rc( STATUS_CHANGE "( audio volume: %d )", config_GetInt( p_this, "volume") ); vlc_mutex_unlock( &p_intf->p_sys->status_lock ); return VLC_SUCCESS;}static int StateChanged( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); intf_thread_t *p_intf = (intf_thread_t*)p_data; playlist_t *p_playlist = NULL; input_thread_t *p_input = NULL; vlc_mutex_lock( &p_intf->p_sys->status_lock ); p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( p_input ) { p_playlist = pl_Yield( p_input ); char cmd[6]; switch( p_playlist->status.i_status ) { case PLAYLIST_STOPPED: strcpy( cmd, "stop" ); break; case PLAYLIST_RUNNING: strcpy( cmd, "play" ); break; case PLAYLIST_PAUSED: strcpy( cmd, "pause" ); break; default: cmd[0] = '\0'; } /* var_GetInteger( p_input, "state" ) */ msg_rc( STATUS_CHANGE "( %s state: %d ): %s", cmd, newval.i_int, ppsz_input_state[ newval.i_int ] ); vlc_object_release( p_playlist ); vlc_object_release( p_input ); } vlc_mutex_unlock( &p_intf->p_sys->status_lock ); return VLC_SUCCESS;}static int RateChanged( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval); intf_thread_t *p_intf = (intf_thread_t*)p_data; input_thread_t *p_input = NULL; vlc_mutex_lock( &p_intf->p_sys->status_lock ); p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( p_input ) { msg_rc( STATUS_CHANGE "( new rate: %d )", var_GetInteger( p_input, "rate" ) ); vlc_object_release( p_input ); } vlc_mutex_unlock( &p_intf->p_sys->status_lock ); return VLC_SUCCESS;}/******************************************************************** * Command routines ********************************************************************/static int Input( 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; vlc_value_t val; p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( !p_input ) return VLC_ENOOBJ; var_Get( p_input, "state", &val ); if( ( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) && ( strcmp( psz_cmd, "pause" ) != 0 ) ) { msg_rc( _("Press menu select or pause to continue.") ); vlc_object_release( p_input ); return VLC_EGENERIC; } /* Parse commands that only require an input */ if( !strcmp( psz_cmd, "pause" ) ) { val.i_int = config_GetInt( p_intf, "key-play-pause" ); var_Set( p_intf->p_libvlc, "key-pressed", val ); vlc_object_release( p_input ); return VLC_SUCCESS; } else if( !strcmp( psz_cmd, "seek" ) ) { if( strlen( newval.psz_string ) > 0 && newval.psz_string[strlen( newval.psz_string ) - 1] == '%' ) { val.f_float = (float)atof( newval.psz_string ) / 100.0; var_Set( p_input, "position", val ); } else { val.i_time = ((int64_t)atoi( newval.psz_string )) * 1000000; var_Set( p_input, "time", val ); } vlc_object_release( p_input ); return VLC_SUCCESS; } else if ( !strcmp( psz_cmd, "fastforward" ) ) { val.i_int = config_GetInt( p_intf, "key-jump+extrashort" ); var_Set( p_intf->p_libvlc, "key-pressed", val ); vlc_object_release( p_input ); return VLC_SUCCESS; } else if ( !strcmp( psz_cmd, "rewind" ) ) { val.i_int = config_GetInt( p_intf, "key-jump-extrashort" ); var_Set( p_intf->p_libvlc, "key-pressed", val ); vlc_object_release( p_input ); return VLC_SUCCESS; } else if ( !strcmp( psz_cmd, "faster" ) ) { var_Set( p_input, "rate-faster", val ); vlc_object_release( p_input ); return VLC_SUCCESS; } else if ( !strcmp( psz_cmd, "slower" ) ) { var_Set( p_input, "rate-slower", val ); vlc_object_release( p_input ); return VLC_SUCCESS; } else if ( !strcmp( psz_cmd, "normal" ) ) { val.i_int = INPUT_RATE_DEFAULT; var_Set( p_input, "rate", val ); vlc_object_release( p_input ); return VLC_SUCCESS; } else if( !strcmp( psz_cmd, "chapter" ) || !strcmp( psz_cmd, "chapter_n" ) || !strcmp( psz_cmd, "chapter_p" ) ) { if( !strcmp( psz_cmd, "chapter" ) ) { if ( *newval.psz_string ) { /* Set. */ val.i_int = atoi( newval.psz_string ); var_Set( p_input, "chapter", val ); } else { vlc_value_t val_list; /* Get. */ var_Get( p_input, "chapter", &val ); var_Change( p_input, "chapter", VLC_VAR_GETCHOICES, &val_list, NULL ); msg_rc( "Currently playing chapter %d/%d.", val.i_int, val_list.p_list->i_count ); var_Change( p_this, "chapter", VLC_VAR_FREELIST, &val_list, NULL ); } } else if( !strcmp( psz_cmd, "chapter_n" ) ) { val.b_bool = true; var_Set( p_input, "next-chapter", val ); } else if( !strcmp( psz_cmd, "chapter_p" ) ) { val.b_bool = true; var_Set( p_input, "prev-chapter", val ); } vlc_object_release( p_input ); return VLC_SUCCESS; } else if( !strcmp( psz_cmd, "title" ) || !strcmp( psz_cmd, "title_n" ) || !strcmp( psz_cmd, "title_p" ) ) { if( !strcmp( psz_cmd, "title" ) )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -