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

📄 rpn.c

📁 uclinux 下的vlc播放器源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
        else if( !strcmp( s, "vlc_object_exists" ) )        {            char *psz_object = E_(SSPop)( st );            vlc_bool_t b_need_release;            vlc_object_t *p_object = GetVLCObject( p_intf, psz_object,                                                   &b_need_release );            if( b_need_release && p_object != NULL )                vlc_object_release( p_object );            if( p_object != NULL )                E_(SSPush)( st, "1" );            else                E_(SSPush)( st, "0" );        }        else if( !strcmp( s, "vlc_config_set" ) )        {            char *psz_variable = E_(SSPop)( st );            int i_type = config_GetType( p_intf, psz_variable );            switch( i_type & VLC_VAR_TYPE )            {            case VLC_VAR_BOOL:            case VLC_VAR_INTEGER:                config_PutInt( p_intf, psz_variable, E_(SSPopN)( st, vars ) );                break;            case VLC_VAR_STRING:            case VLC_VAR_MODULE:            case VLC_VAR_FILE:            case VLC_VAR_DIRECTORY:            {                char *psz_string = E_(SSPop)( st );                config_PutPsz( p_intf, psz_variable, psz_string );                free( psz_string );                break;            }            case VLC_VAR_FLOAT:            {                char *psz_string = E_(SSPop)( st );                config_PutFloat( p_intf, psz_variable, atof(psz_string) );                free( psz_string );                break;            }            default:                msg_Warn( p_intf, "vlc_config_set called on unknown var (%s)",                          psz_variable );            }            free( psz_variable );        }        else if( !strcmp( s, "vlc_config_get" ) )        {            char *psz_variable = E_(SSPop)( st );            int i_type = config_GetType( p_intf, psz_variable );            switch( i_type & VLC_VAR_TYPE )            {            case VLC_VAR_BOOL:            case VLC_VAR_INTEGER:                E_(SSPushN)( st, config_GetInt( p_intf, psz_variable ) );                break;            case VLC_VAR_STRING:            case VLC_VAR_MODULE:            case VLC_VAR_FILE:            case VLC_VAR_DIRECTORY:            {                char *psz_string = config_GetPsz( p_intf, psz_variable );                E_(SSPush)( st, psz_string );                free( psz_string );                break;            }            case VLC_VAR_FLOAT:            {                char psz_string[20];                lldiv_t value = lldiv( config_GetFloat( p_intf, psz_variable )                                       * 1000000, 1000000 );                snprintf( psz_string, sizeof(psz_string), I64Fd".%06u",                          value.quot, (unsigned int)value.rem );                E_(SSPush)( st, psz_string );                break;            }            default:                msg_Warn( p_intf, "vlc_config_get called on unknown var (%s)",                          psz_variable );            }            free( psz_variable );        }        else if( !strcmp( s, "vlc_config_save" ) )        {            char *psz_module = E_(SSPop)( st );            int i_result;            if( !*psz_module )            {                free( psz_module );                psz_module = NULL;            }            i_result = config_SaveConfigFile( p_intf, psz_module );            if( psz_module != NULL )                free( psz_module );            E_(SSPushN)( st, i_result );        }        else if( !strcmp( s, "vlc_config_reset" ) )        {            config_ResetAll( p_intf );        }        /* 6. playlist functions */        else if( !strcmp( s, "playlist_add" ) )        {            char *psz_name = E_(SSPop)( st );            char *mrl = E_(SSPop)( st );            char *tmp;            playlist_item_t *p_item;            int i_id;            tmp = E_(ToUTF8)( p_intf, psz_name );            free( psz_name );            psz_name = tmp;            tmp = E_(ToUTF8)( p_intf, mrl );            free( mrl );            mrl = tmp;            if( !*psz_name )            {                p_item = E_(MRLParse)( p_intf, mrl, mrl );            }            else            {                p_item = E_(MRLParse)( p_intf, mrl, psz_name );            }            if( p_item == NULL || p_item->input.psz_uri == NULL ||                 !*p_item->input.psz_uri )            {                i_id = VLC_EGENERIC;                msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );            }            else            {                i_id = playlist_AddItem( p_sys->p_playlist, p_item,                                         PLAYLIST_APPEND, PLAYLIST_END );                msg_Dbg( p_intf, "requested mrl add: %s", mrl );            }            E_(SSPushN)( st, i_id );            free( mrl );            free( psz_name );        }        else if( !strcmp( s, "playlist_empty" ) )        {            playlist_LockClear( p_sys->p_playlist );            msg_Dbg( p_intf, "requested playlist empty" );        }        else if( !strcmp( s, "playlist_delete" ) )        {            int i_id = E_(SSPopN)( st, vars );            playlist_LockDelete( p_sys->p_playlist, i_id );            msg_Dbg( p_intf, "requested playlist delete: %d", i_id );        }        else if( !strcmp( s, "playlist_move" ) )        {            int i_newpos = E_(SSPopN)( st, vars );            int i_pos = E_(SSPopN)( st, vars );            if ( i_pos < i_newpos )            {                playlist_Move( p_sys->p_playlist, i_pos, i_newpos + 1 );            }            else            {                playlist_Move( p_sys->p_playlist, i_pos, i_newpos );            }            msg_Dbg( p_intf, "requested to move playlist item %d to %d",                     i_pos, i_newpos);        }        else if( !strcmp( s, "playlist_sort" ) )        {            int i_order = E_(SSPopN)( st, vars );            int i_sort = E_(SSPopN)( st, vars );            i_order = i_order % 2;            i_sort = i_sort % 9;            playlist_RecursiveNodeSort(  p_sys->p_playlist,                                         p_sys->p_playlist->p_general,                                         i_sort, i_order );            msg_Dbg( p_intf, "requested sort playlist by : %d in order : %d",                     i_sort, i_order );        }        else if( !strcmp( s, "services_discovery_add" ) )        {            char *psz_sd = E_(SSPop)( st );            playlist_ServicesDiscoveryAdd( p_sys->p_playlist, psz_sd );            free( psz_sd );        }        else if( !strcmp( s, "services_discovery_remove" ) )        {            char *psz_sd = E_(SSPop)( st );            playlist_ServicesDiscoveryRemove( p_sys->p_playlist, psz_sd );            free( psz_sd );        }        else if( !strcmp( s, "services_discovery_is_loaded" ) )        {            char *psz_sd = E_(SSPop)( st );            E_(SSPushN)( st,            playlist_IsServicesDiscoveryLoaded( p_sys->p_playlist, psz_sd ) );            free( psz_sd );        }        else if( !strcmp( s, "vlc_volume_set" ) )        {            char *psz_vol = E_(SSPop)( st );            int i_value;            audio_volume_t i_volume;            aout_VolumeGet( p_intf, &i_volume );            if( psz_vol[0] == '+' )            {                i_value = atoi( psz_vol );                if( (i_volume + i_value) > AOUT_VOLUME_MAX )                    aout_VolumeSet( p_intf, AOUT_VOLUME_MAX );                else                    aout_VolumeSet( p_intf, i_volume + i_value );            }            else if( psz_vol[0] == '-' )            {                i_value = atoi( psz_vol );                if( (i_volume + i_value) < AOUT_VOLUME_MIN )                    aout_VolumeSet( p_intf, AOUT_VOLUME_MIN );                else                    aout_VolumeSet( p_intf, i_volume + i_value );            }            else if( strstr( psz_vol, "%") != NULL )            {                i_value = atoi( psz_vol );                if( i_value < 0 ) i_value = 0;                if( i_value > 400 ) i_value = 400;                aout_VolumeSet( p_intf, (i_value * (AOUT_VOLUME_MAX - AOUT_VOLUME_MIN))/400+AOUT_VOLUME_MIN);            }            else            {                i_value = atoi( psz_vol );                if( i_value > AOUT_VOLUME_MAX ) i_value = AOUT_VOLUME_MAX;                if( i_value < AOUT_VOLUME_MIN ) i_value = AOUT_VOLUME_MIN;                aout_VolumeSet( p_intf, i_value );            }            aout_VolumeGet( p_intf, &i_volume );            free( psz_vol );        }        else if( !strcmp( s, "vlc_get_meta" ) )        {            char *psz_meta = E_(SSPop)( st );            char *psz_val = NULL;            if( p_sys->p_input && p_sys->p_input->input.p_item )            {#define p_item  p_sys->p_input->input.p_item                if( !strcmp( psz_meta, "ARTIST" ) )                {                    psz_val = vlc_input_item_GetInfo( p_item,                                _(VLC_META_INFO_CAT), _(VLC_META_ARTIST) );                }                else if( !strcmp( psz_meta, "TITLE" ) )                {                    psz_val = vlc_input_item_GetInfo( p_item,                                _(VLC_META_INFO_CAT), _(VLC_META_TITLE) );                    if( psz_val == NULL )                        psz_val == strdup( p_item->psz_name );                }                else if( !strcmp( psz_meta, "ALBUM" ) )                {                    psz_val = vlc_input_item_GetInfo( p_item,                                _(VLC_META_INFO_CAT), _(VLC_META_COLLECTION) );                }                else if( !strcmp( psz_meta, "GENRE" ) )                {                    psz_val = vlc_input_item_GetInfo( p_item,                                _(VLC_META_INFO_CAT), _(VLC_META_GENRE) );                }                else                {                    psz_val = vlc_input_item_GetInfo( p_item,                                            _(VLC_META_INFO_CAT), psz_meta );                }#undef p_item            }            if( psz_val == NULL ) psz_val = strdup( "" );            E_(SSPush)( st, psz_val );            free( psz_meta );            free( psz_val );        }        else if( !strcmp( s, "vlm_command" ) || !strcmp( s, "vlm_cmd" ) )        {            char *psz_elt;            char *psz_cmd = strdup( "" );            char *psz_error;            vlm_message_t *vlm_answer;            /* make sure that we have a vlm object */            if( p_intf->p_sys->p_vlm == NULL )                p_intf->p_sys->p_vlm = vlm_New( p_intf );            /* vlm command uses the ';' delimiter             * (else we can't know when to stop) */            while( strcmp( psz_elt = E_(SSPop)( st ), "" )                   && strcmp( psz_elt, ";" ) )            {                char *psz_buf =                    (char *)malloc( strlen( psz_cmd ) + strlen( psz_elt ) + 2 );                sprintf( psz_buf, "%s %s", psz_cmd, psz_elt );                free( psz_cmd );                free( psz_elt );                psz_cmd = psz_buf;            }            msg_Dbg( p_intf, "executing vlm command: %s", psz_cmd );            vlm_ExecuteCommand( p_intf->p_sys->p_vlm, psz_cmd, &vlm_answer );            if( vlm_answer->psz_value == NULL )            {                psz_error = strdup( "" );            }            else            {                psz_error = malloc( strlen(vlm_answer->psz_name) +                                    strlen(vlm_answer->psz_value) +                                    strlen( " : ") + 1 );                sprintf( psz_error , "%s : %s" , vlm_answer->psz_name,                                                 vlm_answer->psz_value );            }            E_(mvar_AppendNewVar)( vars, "vlm_error", psz_error );            /* this is kind of a duplicate but we need to have the message             * without the command name for the "export" command */            E_(mvar_AppendNewVar)( vars, "vlm_value", vlm_answer->psz_value );            vlm_MessageDelete( vlm_answer );            free( psz_cmd );            free( psz_error );        }        else if( !strcmp( s, "snapshot" ) )        {            if( p_sys->p_input )            {                vout_thread_t *p_vout;                p_vout = vlc_object_find( p_sys->p_input,                                          VLC_OBJECT_VOUT, FIND_CHILD );                if( p_vout )                {                    vout_Control( p_vout, VOUT_SNAPSHOT );                    vlc_object_release( p_vout );                    msg_Dbg( p_intf, "requested snapshot" );                }            }            break;        }        else        {            E_(SSPush)( st, s );        }    }}

⌨️ 快捷键说明

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