⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rc.c

📁 uclinux 下的vlc播放器源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            {                msg_rc( "%s: returned %i (%s)",                         psz_cmd, i_ret, vlc_error( i_ret ) );            }        }        else if( !strcmp( psz_cmd, "logout" ) )        {            /* Close connection */            if( p_intf->p_sys->i_socket != -1 )            {                net_Close( p_intf->p_sys->i_socket );            }            p_intf->p_sys->i_socket = -1;        }        else if( !strcmp( psz_cmd, "info" ) )        {            if( p_input )            {                int i, j;                vlc_mutex_lock( &p_input->input.p_item->lock );                for ( i = 0; i < p_input->input.p_item->i_categories; i++ )                {                    info_category_t *p_category =                        p_input->input.p_item->pp_categories[i];                    msg_rc( "+----[ %s ]", p_category->psz_name );                    msg_rc( "| " );                    for ( j = 0; j < p_category->i_infos; j++ )                    {                        info_t *p_info = p_category->pp_infos[j];                        msg_rc( "| %s: %s", p_info->psz_name,                                p_info->psz_value );                    }                    msg_rc( "| " );                }                msg_rc( "+----[ end of stream info ]" );                vlc_mutex_unlock( &p_input->input.p_item->lock );            }            else            {                msg_rc( "no input" );            }        }        else if( !strcmp( psz_cmd, "is_playing" ) )        {            if( ! p_input )            {                msg_rc( "0" );            }            else            {                msg_rc( "1" );            }        }        else if( !strcmp( psz_cmd, "get_time" ) )        {            if( ! p_input )            {                msg_rc("0");            }            else            {                vlc_value_t time;                var_Get( p_input, "time", &time );                msg_rc( "%i", time.i_time / 1000000);            }        }        else if( !strcmp( psz_cmd, "get_length" ) )        {            if( ! p_input )            {                msg_rc("0");            }            else            {                vlc_value_t time;                var_Get( p_input, "length", &time );                msg_rc( "%i", time.i_time / 1000000);            }        }        else if( !strcmp( psz_cmd, "get_title" ) )        {            if( ! p_input )            {                msg_rc("");            }            else            {                msg_rc( "%s", p_input->input.p_item->psz_name );            }        }        else if( !strcmp( psz_cmd, "longhelp" ) || !strncmp( psz_cmd, "h", 1 )                 || !strncmp( psz_cmd, "H", 1 ) || !strncmp( psz_cmd, "?", 1 ) )        {            if( !strcmp( psz_cmd, "longhelp" ) || !strncmp( psz_cmd, "H", 1 ) )                 b_longhelp = VLC_TRUE;            else b_longhelp = VLC_FALSE;            Help( p_intf, b_longhelp );        }        else if( !strcmp( psz_cmd, "check-updates" ) )        {            checkUpdates( p_intf, psz_arg );        }        else switch( psz_cmd[0] )        {        case 'f':        case 'F':            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;                    vlc_bool_t b_update = VLC_FALSE;                    var_Get( p_vout, "fullscreen", &val );                    val.b_bool = !val.b_bool;                    if( !strncmp(psz_arg, "on", 2) && (val.b_bool == VLC_TRUE) )                    {                        b_update = VLC_TRUE;                        val.b_bool = VLC_TRUE;                    }                    else if( !strncmp(psz_arg, "off", 3)  && (val.b_bool == VLC_FALSE) )                    {                        b_update = VLC_TRUE;                        val.b_bool = VLC_FALSE;                    }                    else if( strncmp(psz_arg, "off", 3) && strncmp(psz_arg, "on", 2) )                        b_update = VLC_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_vlc, "volume-change", VolumeChanged, p_intf );}static void Help( intf_thread_t *p_intf, vlc_bool_t 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(_("| 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(_("| 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(_("| strack [X] . . . . . . . set/get subtitles track"));    msg_rc(_("| menu [on|off|up|down|left|right|select] use menu"));    msg_rc(  "| ");    if (b_longhelp)    {        msg_rc(_("| marq-marquee STRING  . . overlay STRING in video"));        msg_rc(_("| marq-x X . . . . . . . . . . . .offset from left"));        msg_rc(_("| marq-y Y . . . . . . . . . . . . offset from top"));        msg_rc(_("| marq-position #. . .  .relative position control"));        msg_rc(_("| marq-color # . . . . . . . . . . font color, RGB"));        msg_rc(_("| marq-opacity # . . . . . . . . . . . . . opacity"));        msg_rc(_("| marq-timeout T. . . . . . . . . . timeout, in ms"));        msg_rc(_("| marq-size # . . . . . . . . font size, in pixels"));        msg_rc(  "| ");        msg_rc(_("| time-format STRING . . . overlay STRING in video"));        msg_rc(_("| time-x X . . . . . . . . . . . .offset from left"));        msg_rc(_("| time-y Y . . . . . . . . . . . . offset from top"));        msg_rc(_("| time-position #. . . . . . . . relative position"));        msg_rc(_("| time-color # . . . . . . . . . . font color, RGB"));        msg_rc(_("| time-opacity # . . . . . . . . . . . . . opacity"));        msg_rc(_("| time-size # . . . . . . . . font size, in pixels"));        msg_rc(  "| ");        msg_rc(_("| logo-file STRING . . .the overlay file path/name"));        msg_rc(_("| logo-x X . . . . . . . . . . . .offset from left"));        msg_rc(_("| logo-y Y . . . . . . . . . . . . offset from top"));        msg_rc(_("| logo-position #. . . . . . . . relative position"));        msg_rc(_("| logo-transparency #. . . . . . . . .transparency"));        msg_rc(  "| ");        msg_rc(_("| mosaic-alpha # . . . . . . . . . . . . . . alpha"));        msg_rc(_("| mosaic-height #. . . . . . . . . . . . . .height"));        msg_rc(_("| mosaic-width # . . . . . . . . . . . . . . width"));        msg_rc(_("| mosaic-xoffset # . . . .top left corner position"));        msg_rc(_("| mosaic-yoffset # . . . .top left corner position"));        msg_rc(_("| mosaic-align 0..2,4..6,8..10. . .mosaic alignment"));        msg_rc(_("| mosaic-vborder # . . . . . . . . vertical border"));        msg_rc(_("| mosaic-hborder # . . . . . . . horizontal border"));        msg_rc(_("| mosaic-position {0=auto,1=fixed} . . . .position"));        msg_rc(_("| mosaic-rows #. . . . . . . . . . .number of rows"));        msg_rc(_("| mosaic-cols #. . . . . . . . . . .number of cols"));        msg_rc(_("| mosaic-keep-aspect-ratio {0,1} . . .aspect ratio"));        msg_rc(  "| ");        msg_rc(_("| check-updates [newer] [equal] [older]\n"                 "|               [undef] [info] [source] [binary] [plugin]"));        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 ){    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 ){    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 ){    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 = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_PARENT );        if( p_playlist )        {            char cmd[5] = "";            switch( p_playlist->status.i_status )            {            case PLAYLIST_STOPPED:                strncpy( &cmd[0], "stop", 4);                cmd[4] = '\0';                break;            case PLAYLIST_RUNNING:                strncpy( &cmd[0], "play", 4);                cmd[4] = '\0';                break;            case PLAYLIST_PAUSED:                strncpy( &cmd[0], "pause", 5);                cmd[5] = '\0';                break;            } /* var_GetInteger( p_input, "state" )  */            msg_rc( STATUS_CHANGE "( %s state: %d )", &cmd[0], 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 ){    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 );    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -