这篇教程C++ var_Change函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中var_Change函数的典型用法代码示例。如果您正苦于以下问题:C++ var_Change函数的具体用法?C++ var_Change怎么用?C++ var_Change使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了var_Change函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: getIntfvoid ThemeRepository::parseDirectory( const string &rDir_locale ){ DIR *pDir; char *pszDirContent; vlc_value_t val, text; // Path separator const string &sep = OSFactory::instance( getIntf() )->getDirSeparator(); // Open the dir // FIXME: parseDirectory should be invoked with UTF-8 input instead!! string rDir = sFromLocale( rDir_locale ); pDir = utf8_opendir( rDir.c_str() ); if( pDir == NULL ) { // An error occurred msg_Dbg( getIntf(), "cannot open directory %s", rDir.c_str() ); return; } // While we still have entries in the directory while( ( pszDirContent = utf8_readdir( pDir ) ) != NULL ) { string name = pszDirContent; string extension; if( name.size() > 4 ) { extension = name.substr( name.size() - 4, 4 ); } if( extension == ".vlt" || extension == ".wsz" ) { string path = rDir + sep + name; msg_Dbg( getIntf(), "found skin %s", path.c_str() ); // Add the theme in the popup menu string shortname = name.substr( 0, name.size() - 4 ); val.psz_string = strdup( path.c_str() ); text.psz_string = strdup( shortname.c_str() ); var_Change( getIntf(), "intf-skins", VLC_VAR_ADDCHOICE, &val, &text ); free( val.psz_string ); free( text.psz_string ); } free( pszDirContent ); } closedir( pDir );}
开发者ID:rdp,项目名称:vlc-1,代码行数:49,
示例2: input_SendEventLengthvoid input_SendEventLength( input_thread_t *p_input, mtime_t i_length ){ vlc_value_t val; /* FIXME ugly + what about meta change event ? */ if( var_GetTime( p_input, "length" ) == i_length ) return; input_item_SetDuration( p_input->p->p_item, i_length ); val.i_time = i_length; var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL ); Trigger( p_input, INPUT_EVENT_LENGTH );}
开发者ID:vlcchina,项目名称:vlc-player-experimental,代码行数:15,
示例3: var_Changevoid InputManager::UpdateNavigation(){ /* Update navigation status */ vlc_value_t val; val.i_int = 0; vlc_value_t val2; val2.i_int = 0; var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); if( val.i_int > 0 ) { /* p_input != NULL since val.i_int != 0 */ var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val2, NULL ); emit titleChanged( val.i_int > 1 ); emit chapterChanged( val2.i_int > 1 ); } else emit chapterChanged( false ); if( hasInput() ) emit inputCanSeek( var_GetBool( p_input, "can-seek" ) ); else emit inputCanSeek( false );}
开发者ID:DayDayUpCQ,项目名称:vlc,代码行数:24,
示例4: VarListAddstatic void VarListAdd( input_thread_t *p_input, const char *psz_variable, int i_event, int i_value, const char *psz_text ){ vlc_value_t val; vlc_value_t text; val.i_int = i_value; text.psz_string = (char*)psz_text; var_Change( p_input, psz_variable, VLC_VAR_ADDCHOICE, &val, psz_text ? &text : NULL ); Trigger( p_input, i_event );}
开发者ID:vlcchina,项目名称:vlc-player-experimental,代码行数:15,
示例5: vlclua_var_get_liststatic int vlclua_var_get_list( lua_State *L ){ vlc_value_t val; vlc_value_t text; vlc_object_t **pp_obj = luaL_checkudata( L, 1, "vlc_object" ); const char *psz_var = luaL_checkstring( L, 2 ); int i_ret = var_Change( *pp_obj, psz_var, VLC_VAR_GETCHOICES, &val, &text ); if( i_ret < 0 ) return vlclua_push_ret( L, i_ret ); vlclua_pushlist( L, val.p_list ); vlclua_pushlist( L, text.p_list ); var_FreeList( &val, &text ); return 2;}
开发者ID:BossKing,项目名称:vlc,代码行数:17,
示例6: Probe/** * Initializes list of devices. */static void Probe (vlc_object_t *obj){ /* Due to design bug in audio output core, this hack is required: */ if (var_Type (obj, "audio-device")) return; /* The variable does not exist - first call. */ vlc_value_t text; var_Create (obj, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE); text.psz_string = _("Audio Device"); var_Change (obj, "audio-device", VLC_VAR_SETTEXT, &text, NULL); GetDevices (obj, NULL); var_AddCallback (obj, "audio-device", aout_ChannelsRestart, NULL); var_TriggerCallback (obj, "intf-change");}
开发者ID:Italianmoose,项目名称:Stereoscopic-VLC,代码行数:21,
示例7: while/***************************************************************************** * ChapterMenu::AttachedToWindow *****************************************************************************/void ChapterMenu::AttachedToWindow(){ BMenuItem * item; while( ( item = RemoveItem( 0L ) ) ) { delete item; } input_thread_t * p_input; p_input = (input_thread_t *) vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( !p_input ) { return; } vlc_value_t val; BMessage * message; if( !var_Get( p_input, "chapter", &val ) ) { vlc_value_t val_list, text_list; var_Change( p_input, "chapter", VLC_VAR_GETCHOICES, &val_list, &text_list ); for( int i = 0; i < val_list.p_list->i_count; i++ ) { message = new BMessage( TOGGLE_CHAPTER ); message->AddInt32( "index", val_list.p_list->p_values[i].i_int ); item = new BMenuItem( text_list.p_list->p_values[i].psz_string, message ); if( val_list.p_list->p_values[i].i_int == val.i_int ) { item->SetMarked( true ); } AddItem( item ); } var_FreeList( &val_list, &text_list ); } vlc_object_release( p_input ); BMenu::AttachedToWindow();}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:45,
示例8: sectionMenuvoid InputManager::sectionMenu(){ if( hasInput() ) { vlc_value_t val, text; if( var_Change( p_input, "title 0", VLC_VAR_GETLIST, &val, &text ) < 0 ) return; /* XXX is it "Root" or "Title" we want here ?" (set 0 by default) */ int root = 0; for( int i = 0; i < val.p_list->i_count; i++ ) { if( !strcmp( text.p_list->p_values[i].psz_string, "Title" ) ) root = i; } var_FreeList( &val, &text ); var_SetInteger( p_input, "title 0", root ); }}
开发者ID:RodrigoNieves,项目名称:vlc,代码行数:21,
示例9: PositionCallbackstatic int PositionCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); /* Update "length" for better intf behaviour */ const int64_t i_length = var_GetInteger( p_input, "length" ); if( i_length > 0 && newval.f_float >= 0.f && newval.f_float <= 1.f ) { vlc_value_t val; val.i_int = i_length * newval.f_float; var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL ); } input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &newval ); return VLC_SUCCESS;}
开发者ID:IAPark,项目名称:vlc,代码行数:21,
示例10: AddCustomRatiosstatic void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var, char *psz_list ){ assert( psz_list ); char *psz_cur = psz_list; char *psz_next; while( psz_cur && *psz_cur ) { vlc_value_t val, text; psz_next = strchr( psz_cur, ',' ); if( psz_next ) { *psz_next = '/0'; psz_next++; } val.psz_string = psz_cur; text.psz_string = psz_cur; var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, &val, &text); psz_cur = psz_next; }}
开发者ID:metakermit,项目名称:vlc,代码行数:22,
示例11: test_limitsstatic void test_limits( libvlc_int_t *p_libvlc ){ vlc_value_t val; val.i_int = 0; var_Create( p_libvlc, "bla", VLC_VAR_INTEGER ); var_Change( p_libvlc, "bla", VLC_VAR_GETMIN, &val, NULL ); assert( val.i_int == 0 ); val.i_int = -1234; var_Change( p_libvlc, "bla", VLC_VAR_SETMIN, &val, NULL ); val.i_int = 12345; var_Change( p_libvlc, "bla", VLC_VAR_SETMAX, &val, NULL ); var_Change( p_libvlc, "bla", VLC_VAR_GETMIN, &val, NULL ); assert( val.i_int == -1234 ); var_Change( p_libvlc, "bla", VLC_VAR_GETMAX, &val, NULL ); assert( val.i_int == 12345 ); var_SetInteger( p_libvlc, "bla", -123456 ); assert( var_GetInteger( p_libvlc, "bla" ) == -1234 ); var_SetInteger( p_libvlc, "bla", 1234 ); assert( var_GetInteger( p_libvlc, "bla" ) == 1234 ); var_SetInteger( p_libvlc, "bla", 12346 ); assert( var_GetInteger( p_libvlc, "bla" ) == 12345 ); val.i_int = 42; var_Change( p_libvlc, "bla", VLC_VAR_SETSTEP, &val, NULL ); var_SetInteger( p_libvlc, "bla", 20 ); val.i_int = 0; var_Change( p_libvlc, "bla", VLC_VAR_GETSTEP, &val, NULL ); assert( val.i_int == 42 ); var_SetInteger( p_libvlc, "bla", 20 ); assert( var_GetInteger( p_libvlc, "bla" ) == 0 ); var_SetInteger( p_libvlc, "bla", 21 ); assert( var_GetInteger( p_libvlc, "bla" ) == 42 ); var_Destroy( p_libvlc, "bla" );}
开发者ID:Adatan,项目名称:vlc,代码行数:41,
示例12: libvlc_media_player_get_chapter_count_for_titleint libvlc_media_player_get_chapter_count_for_title( libvlc_media_player_t *p_mi, int i_title ){ input_thread_t *p_input_thread; vlc_value_t val; p_input_thread = libvlc_get_input_thread ( p_mi ); if( !p_input_thread ) return -1; char *psz_name; if( asprintf( &psz_name, "title %2i", i_title ) == -1 ) { vlc_object_release( p_input_thread ); return -1; } int i_ret = var_Change( p_input_thread, psz_name, VLC_VAR_CHOICESCOUNT, &val, NULL ); vlc_object_release( p_input_thread ); free( psz_name ); return i_ret == VLC_SUCCESS ? val.i_int : -1;}
开发者ID:Three-DS,项目名称:VLC-2.1.4,代码行数:23,
示例13: clearvoid AspectRatioComboBox::updateRatios(){ /* Clear the list before updating */ clear(); vlc_value_t val_list, text_list; vout_thread_t* p_vout = THEMIM->getVout(); /* Disable if there is no vout */ if( p_vout == NULL ) { addItem( qtr("Aspect Ratio") ); setDisabled( true ); return; } var_Change( p_vout, "aspect-ratio", VLC_VAR_GETLIST, &val_list, &text_list ); for( int i = 0; i < val_list.p_list->i_count; i++ ) addItem( qfu( text_list.p_list->p_values[i].psz_string ), QString( val_list.p_list->p_values[i].psz_string ) ); setEnabled( true ); var_FreeList( &val_list, &text_list ); vlc_object_release( p_vout );}
开发者ID:371816210,项目名称:vlc_vlc,代码行数:23,
示例14: TimeCallbackstatic int TimeCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ){ input_thread_t *p_input = (input_thread_t*)p_this; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data); /* Update "position" for better intf behaviour */ const int64_t i_length = var_GetInteger( p_input, "length" ); if( i_length > 0 && newval.i_int >= 0 && newval.i_int <= i_length ) { vlc_value_t val; val.f_float = (double)newval.i_int/(double)i_length; var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL ); /* * Notify the intf that a new event has been occurred. * XXX this is a bit hackish but it's the only way to do it now. */ var_SetInteger( p_input, "intf-event", INPUT_EVENT_POSITION ); } input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &newval ); return VLC_SUCCESS;}
开发者ID:0xheart0,项目名称:vlc,代码行数:24,
示例15: activateTeletextvoid InputManager::activateTeletext( bool b_enable ){ vlc_value_t list; vlc_value_t text; if( hasInput() && !var_Change( p_input, "teletext-es", VLC_VAR_GETLIST, &list, &text ) ) { if( list.p_list->i_count > 0 ) { /* Prefer the page 100 if it is present */ int i; for( i = 0; i < text.p_list->i_count; i++ ) { /* The description is the page number as a string */ const char *psz_page = text.p_list->p_values[i].psz_string; if( psz_page && !strcmp( psz_page, "100" ) ) break; } if( i >= list.p_list->i_count ) i = 0; var_SetInteger( p_input, "spu-es", b_enable ? list.p_list->p_values[i].i_int : -1 ); } var_FreeList( &list, &text ); }}
开发者ID:RodrigoNieves,项目名称:vlc,代码行数:24,
示例16: assertvoid VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal ){ input_thread_t* pInput = (input_thread_t*) p_obj; assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput ); if( !getIntf()->p_sys->p_input ) { msg_Dbg( getIntf(), "new input %p detected", pInput ); getIntf()->p_sys->p_input = pInput; vlc_object_hold( pInput ); } switch( newVal.i_int ) { case INPUT_EVENT_STATE: { int state = var_GetInteger( pInput, "state" ); SET_BOOL( m_cVarStopped, false ); SET_BOOL( m_cVarPlaying, state != PAUSE_S ); SET_BOOL( m_cVarPaused, state == PAUSE_S ); break; } case INPUT_EVENT_POSITION: { float pos = var_GetFloat( pInput, "position" ); SET_STREAMTIME( m_cVarTime, pos, false ); SET_BOOL( m_cVarSeekable, pos != 0.0 ); break; } case INPUT_EVENT_RATE: { float rate = var_GetFloat( pInput, "rate" ); char* buffer; if( asprintf( &buffer, "%.3g", rate ) != -1 ) { SET_TEXT( m_cVarSpeed, UString( getIntf(), buffer ) ); free( buffer ); } break; } case INPUT_EVENT_ES: { // Do we have audio vlc_value_t audio_es; var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT, &audio_es, NULL ); SET_BOOL( m_cVarHasAudio, audio_es.i_int > 0 ); break; } case INPUT_EVENT_VOUT: { vout_thread_t* pVout = input_GetVout( pInput ); SET_BOOL( m_cVarHasVout, pVout != NULL ); if( !pVout || pVout == m_pVout ) { // end of input or vout reuse (nothing to do) if( pVout ) vlc_object_release( pVout ); break; } if( m_pVout ) { // remove previous Vout callbacks var_DelCallback( m_pVout, "mouse-moved", onGenericCallback, this ); vlc_object_release( m_pVout ); m_pVout = NULL; } // add new Vout callbackx var_AddCallback( pVout, "mouse-moved", onGenericCallback, this ); m_pVout = pVout; break; } case INPUT_EVENT_AOUT: { audio_output_t* pAout = input_GetAout( pInput ); // end of input or aout reuse (nothing to do) if( !pAout || pAout == m_pAout ) { if( pAout ) vlc_object_release( pAout ); break; } // remove previous Aout if any if( m_pAout ) { var_DelCallback( m_pAout, "audio-filter", onGenericCallback, this ); if( m_bEqualizer_started )//.........这里部分代码省略.........
开发者ID:RodrigoNieves,项目名称:vlc,代码行数:101,
示例17: ProcessGesturestatic void ProcessGesture( intf_thread_t *p_intf ){ intf_sys_t *p_sys = p_intf->p_sys; playlist_t *p_playlist = pl_Get( p_intf ); /* Do something */ /* If you modify this, please try to follow this convention: Start with LEFT, RIGHT for playback related commands and UP, DOWN, for other commands */ switch( p_sys->i_pattern ) { case LEFT: { msg_Dbg( p_intf, "Go backward in the movie!" ); input_thread_t *p_input = playlist_CurrentInput( p_playlist ); if( p_input == NULL ) break; int it = var_InheritInteger( p_intf , "short-jump-size" ); if( it > 0 ) var_SetTime( p_input, "time-offset", -CLOCK_FREQ * it ); vlc_object_release( p_input ); break; } case RIGHT: { msg_Dbg( p_intf, "Go forward in the movie!" ); input_thread_t *p_input = playlist_CurrentInput( p_playlist ); if( p_input == NULL ) break; int it = var_InheritInteger( p_intf , "short-jump-size" ); if( it > 0 ) var_SetTime( p_input, "time-offset", CLOCK_FREQ * it ); vlc_object_release( p_input ); break; } case GESTURE(LEFT,UP,NONE,NONE): msg_Dbg( p_intf, "Going slower." ); var_TriggerCallback( p_playlist, "rate-slower" ); break; case GESTURE(RIGHT,UP,NONE,NONE): msg_Dbg( p_intf, "Going faster." ); var_TriggerCallback( p_playlist, "rate-faster" ); break; case GESTURE(LEFT,RIGHT,NONE,NONE): case GESTURE(RIGHT,LEFT,NONE,NONE): { msg_Dbg( p_intf, "Play/Pause" ); input_thread_t *p_input = playlist_CurrentInput( p_playlist ); if( p_input == NULL ) break; int i_state = var_GetInteger( p_input, "state" ); i_state = (i_state == PLAYING_S) ? PAUSE_S : PLAYING_S; var_SetInteger( p_input, "state", i_state ); vlc_object_release( p_input ); break; } case GESTURE(LEFT,DOWN,NONE,NONE): playlist_Prev( p_playlist ); break; case GESTURE(RIGHT,DOWN,NONE,NONE): playlist_Next( p_playlist ); break; case UP: msg_Dbg(p_intf, "Louder"); playlist_VolumeUp( p_playlist, 1, NULL ); break; case DOWN: msg_Dbg(p_intf, "Quieter"); playlist_VolumeDown( p_playlist, 1, NULL ); break; case GESTURE(UP,DOWN,NONE,NONE): case GESTURE(DOWN,UP,NONE,NONE): msg_Dbg( p_intf, "Mute sound" ); playlist_MuteToggle( p_playlist ); break; case GESTURE(UP,RIGHT,NONE,NONE): { input_thread_t *p_input = playlist_CurrentInput( p_playlist ); if( p_input == NULL ) break; vlc_value_t list, list2; var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES, &list, &list2 );//.........这里部分代码省略.........
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:101,
示例18: Inputstatic int Input( 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_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; /* Parse commands that only require an input */ if( !strcmp( psz_cmd, "pause" ) ) { val.i_int = PAUSE_S; var_Set( p_input, "state", 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)atoi( 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, "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_rtci( "Currently playing chapter %d/%d/n", 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 = VLC_TRUE; var_Set( p_input, "next-chapter", val ); } else if( !strcmp( psz_cmd, "chapter_p" ) ) { val.b_bool = VLC_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" ) ) { if ( *newval.psz_string ) { /* Set. */ val.i_int = atoi( newval.psz_string ); var_Set( p_input, "title", val ); } else { vlc_value_t val_list; /* Get. */ var_Get( p_input, "title", &val ); var_Change( p_input, "title", VLC_VAR_GETCHOICES, &val_list, NULL ); msg_rtci( "Currently playing title %d/%d/n", val.i_int, val_list.p_list->i_count ); var_Change( p_this, "title", VLC_VAR_FREELIST, &val_list, NULL );//.........这里部分代码省略.........
开发者ID:forthyen,项目名称:SDesk,代码行数:101,
示例19: CreateChoicesMenustatic int CreateChoicesMenu( intf_thread_t *p_intf, GtkMenu *submenu, const char *psz_var, vlc_object_t *p_object, bool b_root ){ vlc_value_t val, val_list, text_list; int i_type, i; /* Check the type of the object variable */ i_type = var_Type( p_object, psz_var ); /* Make sure we want to display the variable */ if( !g_list_length(GTK_MENU_SHELL(submenu)->children) && IsMenuEmpty( psz_var, p_object, b_root ) ) return VLC_EGENERIC; switch( i_type & VLC_VAR_TYPE ) { case VLC_VAR_VOID: case VLC_VAR_BOOL: case VLC_VAR_VARIABLE: case VLC_VAR_STRING: case VLC_VAR_INTEGER: case VLC_VAR_FLOAT: break; default: /* Variable doesn't exist or isn't handled */ return VLC_EGENERIC; } if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, &text_list ) < 0 ) { return VLC_EGENERIC; }#define CURVAL val_list.p_list->p_values[i]#define CURTEXT text_list.p_list->p_values[i].psz_string for( i = 0; i < val_list.p_list->i_count; i++ ) { vlc_value_t another_val; char string[16] = {0}; char *menutext = string; switch( i_type & VLC_VAR_TYPE ) { case VLC_VAR_VARIABLE: { GtkWidget *subsubmenu = gtk_menu_new(); GtkWidget *submenuitem = gtk_menu_item_new_with_label( CURTEXT ? CURTEXT : CURVAL.psz_string ); gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), subsubmenu); gtk_menu_append( submenu, submenuitem ); CreateChoicesMenu( p_intf, GTK_MENU(subsubmenu), CURVAL.psz_string, p_object, false ); break; } case VLC_VAR_STRING: var_Get( p_object, psz_var, &val ); another_val.psz_string = strdup( CURVAL.psz_string ); menutext = CURTEXT ? CURTEXT : another_val.psz_string; CreateAndConnect( p_intf, submenu, psz_var, menutext, "", ITEM_RADIO, p_object, another_val, i_type, val.psz_string && !strcmp( val.psz_string, CURVAL.psz_string ) ); free( val.psz_string ); break; case VLC_VAR_INTEGER: var_Get( p_object, psz_var, &val ); if( CURTEXT ) menutext = CURTEXT; else snprintf( menutext, sizeof(string)-1, "%"PRId64, CURVAL.i_int ); CreateAndConnect( p_intf, submenu, psz_var, menutext, "", ITEM_RADIO, p_object, CURVAL, i_type, ( CURVAL.i_int == val.i_int ) && CheckTitle( p_object, psz_var ) ); break; case VLC_VAR_FLOAT: var_Get( p_object, psz_var, &val ); if( CURTEXT ) menutext = CURTEXT; else snprintf( menutext, sizeof(string)-1, "%.2f", CURVAL.f_float ); CreateAndConnect( p_intf, submenu, psz_var, menutext, "", ITEM_RADIO, p_object, CURVAL, i_type, CURVAL.f_float == val.f_float ); break; default: break; } } /* clean up everything */ var_FreeList( &val_list, &text_list );#undef CURVAL#undef CURTEXT return !g_list_length(GTK_MENU_SHELL(submenu)->children) ? VLC_EGENERIC : VLC_SUCCESS;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:97,
示例20: AudioConfigstatic int AudioConfig( 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_this; aout_instance_t * p_aout; const char * psz_variable; vlc_value_t val_name; int i_error; 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_rtci( "+----[ %s ]/n", 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_rtci( "| %i - %s */n", val.p_list->p_values[i].i_int, text.p_list->p_values[i].psz_string ); else msg_rtci( "| %i - %s/n", 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_rtci( "+----[ end of %s ]/n", val_name.psz_string ); if( 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;}
开发者ID:forthyen,项目名称:SDesk,代码行数:74,
示例21: UpdateItemstatic void UpdateItem( intf_thread_t *p_intf, GtkMenu *menu, const char *psz_var, vlc_object_t *p_object, bool b_submenu ){ vlc_value_t val, text; int i_type; /* Check the type of the object variable */ /* This HACK is needed so we have a radio button for audio and video tracks instread of a checkbox */ if( !strcmp( psz_var, "audio-es" ) || !strcmp( psz_var, "video-es" ) ) i_type = VLC_VAR_INTEGER | VLC_VAR_HASCHOICE; else i_type = var_Type( p_object, psz_var ); switch( i_type & VLC_VAR_TYPE ) { case VLC_VAR_VOID: case VLC_VAR_BOOL: case VLC_VAR_VARIABLE: case VLC_VAR_STRING: case VLC_VAR_INTEGER: case VLC_VAR_FLOAT: break; default: /* Variable doesn't exist or isn't handled */ return; } /* Make sure we want to display the variable */ if( !g_list_length(GTK_MENU_SHELL(menu)->children) && IsMenuEmpty( psz_var, p_object, true ) ) { return; } /* Get the descriptive name of the variable */ int i_ret = var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL ); if( i_ret != VLC_SUCCESS ) { text.psz_string = NULL; } /* Some specific stuff */ bool forceDisabled = false; if( !strcmp( psz_var, "spu-es" ) ) { vlc_object_t *p_vout = get_vout(p_intf); forceDisabled = ( p_vout == NULL ); if( p_vout ) vlc_object_release( p_vout ); } if( i_type & VLC_VAR_HASCHOICE ) { /* Append choices menu */ if( b_submenu ) { GtkWidget *item = gtk_menu_item_new_with_label( text.psz_string ? text.psz_string : psz_var ); GtkWidget *submenu = gtk_menu_new( ); gtk_menu_append( menu, item ); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); if( CreateChoicesMenu( p_intf, GTK_MENU(submenu), psz_var, p_object, true ) ) gtk_widget_set_sensitive(item, false); if( forceDisabled ) gtk_widget_set_sensitive(item, false); } else { if( CreateChoicesMenu( p_intf, menu, psz_var, p_object, true ) ) gtk_widget_set_sensitive(menu, false); } FREENULL( text.psz_string ); return; } switch( i_type & VLC_VAR_TYPE ) { case VLC_VAR_VOID: var_Get( p_object, psz_var, &val ); CreateAndConnect( p_intf, menu, psz_var, text.psz_string, "", ITEM_NORMAL, p_object, val, i_type, false ); break; case VLC_VAR_BOOL: var_Get( p_object, psz_var, &val ); val.b_bool = !val.b_bool; CreateAndConnect( p_intf, menu, psz_var, text.psz_string, "", ITEM_CHECK, p_object, val, i_type, !val.b_bool ); break; } FREENULL( text.psz_string );}
开发者ID:CSRedRat,项目名称:vlc,代码行数:94,
示例22: SkinObjectThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf ){ vlc_value_t val, text; // Create a variable to add items in wxwindows popup menu var_Create( pIntf, "intf-skins", VLC_VAR_STRING | VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND ); text.psz_string = _("Select skin"); var_Change( pIntf, "intf-skins", VLC_VAR_SETTEXT, &text, NULL ); // Scan vlt files in the resource path OSFactory *pOsFactory = OSFactory::instance( pIntf ); list<string> resPath = pOsFactory->getResourcePath(); list<string>::const_iterator it; for( it = resPath.begin(); it != resPath.end(); ++it ) { parseDirectory( *it ); } // retrieve skins from skins directories and locate default skins map<string,string>::const_iterator itmap, itdefault; for( itmap = m_skinsMap.begin(); itmap != m_skinsMap.end(); ++itmap ) { string name = itmap->first; string path = itmap->second; val.psz_string = (char*) path.c_str(); text.psz_string = (char*) name.c_str(); var_Change( getIntf(), "intf-skins", VLC_VAR_ADDCHOICE, &val, &text ); if( name == "Default" ) itdefault = itmap; } // retrieve last skins stored or skins requested by user char* psz_current = var_InheritString( getIntf(), "skins2-last" ); string current = string( psz_current ? psz_current : "" ); free( psz_current ); // check if skins exists and is readable bool b_readable = !ifstream( current.c_str() ).fail(); msg_Dbg( getIntf(), "requested skins %s is %s accessible", current.c_str(), b_readable ? "" : "NOT" ); // set the default skins if given skins not accessible if( !b_readable ) current = itdefault->second; // save this valid skins for reuse config_PutPsz( getIntf(), "skins2-last", current.c_str() ); // Update repository updateRepository(); // Set the callback var_AddCallback( pIntf, "intf-skins", changeSkin, this ); // variable for opening a dialog box to change skins var_Create( pIntf, "intf-skins-interactive", VLC_VAR_VOID | VLC_VAR_ISCOMMAND ); text.psz_string = _("Open skin ..."); var_Change( pIntf, "intf-skins-interactive", VLC_VAR_SETTEXT, &text, NULL ); // Set the callback var_AddCallback( pIntf, "intf-skins-interactive", changeSkin, this );}
开发者ID:Italianmoose,项目名称:Stereoscopic-VLC,代码行数:68,
示例23: Open/***************************************************************************** * Open: open the audio device *****************************************************************************/static int Open ( vlc_object_t *p_this ){ aout_instance_t *p_aout = (aout_instance_t *)p_this; SDL_AudioSpec desired, obtained; int i_nb_channels; vlc_value_t val, text; /* Check that no one uses the DSP. */ uint32_t i_flags = SDL_INIT_AUDIO; if( SDL_WasInit( i_flags ) ) { return VLC_EGENERIC; } i_flags |= SDL_INIT_EVENTTHREAD;#ifndef NDEBUG /* In debug mode you may want vlc to dump a core instead of staying * stuck */ i_flags |= SDL_INIT_NOPARACHUTE;#endif /* Initialize library */ if( SDL_Init( i_flags ) < 0 ) { msg_Err( p_aout, "cannot initialize SDL (%s)", SDL_GetError() ); return VLC_EGENERIC; } if( var_Get( p_aout, "audio-device", &val ) != VLC_ENOVAR ) { /* The user has selected an audio device. */ if ( val.i_int == AOUT_VAR_STEREO ) { p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; } else if ( val.i_int == AOUT_VAR_MONO ) { p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER; } } i_nb_channels = aout_FormatNbChannels( &p_aout->output.output ); if ( i_nb_channels > 2 ) { /* SDL doesn't support more than two channels. */ i_nb_channels = 2; p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; } desired.freq = p_aout->output.output.i_rate; desired.format = AUDIO_S16SYS; desired.channels = i_nb_channels; desired.callback = SDLCallback; desired.userdata = p_aout; desired.samples = FRAME_SIZE; /* Open the sound device. */ if( SDL_OpenAudio( &desired, &obtained ) < 0 ) { return VLC_EGENERIC; } SDL_PauseAudio( 0 ); /* Now have a look at what we got. */ switch ( obtained.format ) { case AUDIO_S16LSB: p_aout->output.output.i_format = VLC_CODEC_S16L; break; case AUDIO_S16MSB: p_aout->output.output.i_format = VLC_CODEC_S16B; break; case AUDIO_U16LSB: p_aout->output.output.i_format = VLC_CODEC_U16L; break; case AUDIO_U16MSB: p_aout->output.output.i_format = VLC_CODEC_U16B; break; case AUDIO_S8: p_aout->output.output.i_format = VLC_CODEC_S8; break; case AUDIO_U8: p_aout->output.output.i_format = VLC_CODEC_U8; break; } /* Volume is entirely done in software. */ aout_VolumeSoftInit( p_aout ); if ( obtained.channels != i_nb_channels ) { p_aout->output.output.i_physical_channels = (obtained.channels == 2 ? AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT : AOUT_CHAN_CENTER); if ( var_Type( p_aout, "audio-device" ) == 0 ) { var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); text.psz_string = _("Audio Device"); var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL );//.........这里部分代码省略.........
开发者ID:Italianmoose,项目名称:Stereoscopic-VLC,代码行数:101,
示例24: intf_Create/** * Create and start an interface. * * @param p_this the calling vlc_object_t * @param psz_module a preferred interface module * @return VLC_SUCCESS or an error code */int intf_Create( vlc_object_t *p_this, const char *psz_module ){ libvlc_int_t *p_libvlc = p_this->p_libvlc; intf_thread_t * p_intf; /* Allocate structure */ p_intf = vlc_custom_create( p_libvlc, sizeof( *p_intf ), "interface" ); if( !p_intf ) return VLC_ENOMEM; /* Variable used for interface spawning */ vlc_value_t val, text; var_Create( p_intf, "intf-add", VLC_VAR_STRING | VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND ); text.psz_string = _("Add Interface"); var_Change( p_intf, "intf-add", VLC_VAR_SETTEXT, &text, NULL );#if !defined(WIN32) && defined(HAVE_ISATTY) if( isatty( 0 ) )#endif { val.psz_string = (char *)"rc"; text.psz_string = (char *)_("Console"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); } val.psz_string = (char *)"telnet"; text.psz_string = (char *)_("Telnet"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); val.psz_string = (char *)"http"; text.psz_string = (char *)_("Web"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); val.psz_string = (char *)"logger"; text.psz_string = (char *)_("Debug logging"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); val.psz_string = (char *)"gestures"; text.psz_string = (char *)_("Mouse Gestures"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL ); /* Attach interface to LibVLC */#if defined( __APPLE__ ) p_intf->b_should_run_on_first_thread = false;#endif /* Choose the best module */ p_intf->p_cfg = NULL; char *psz_parser = *psz_module == '$' ? var_CreateGetString(p_intf,psz_module+1) : strdup( psz_module ); char *psz_tmp = config_ChainCreate( &p_intf->psz_intf, &p_intf->p_cfg, psz_parser ); free( psz_tmp ); free( psz_parser ); p_intf->p_module = module_need( p_intf, "interface", p_intf->psz_intf, true ); if( p_intf->p_module == NULL ) { msg_Err( p_intf, "no suitable interface module" ); goto error; }#if defined( __APPLE__ ) /* Hack to get Mac OS X Cocoa runtime running * (it needs access to the main thread) */ if( p_intf->b_should_run_on_first_thread ) { if( vlc_clone( &p_intf->thread, MonitorLibVLCDeath, p_intf, VLC_THREAD_PRIORITY_LOW ) ) { msg_Err( p_intf, "cannot spawn libvlc death monitoring thread" ); goto error; } assert( p_intf->pf_run ); p_intf->pf_run( p_intf ); /* It is monitoring libvlc, not the p_intf */ vlc_object_kill( p_intf->p_libvlc ); vlc_join( p_intf->thread, NULL ); } else#endif /* Run the interface in a separate thread */ if( p_intf->pf_run && vlc_clone( &p_intf->thread, RunInterface, p_intf, VLC_THREAD_PRIORITY_LOW ) ) { msg_Err( p_intf, "cannot spawn interface thread" ); goto error; } vlc_mutex_lock( &lock ); p_intf->p_next = libvlc_priv( p_libvlc )->p_intf; libvlc_priv( p_libvlc )->p_intf = p_intf;//.........这里部分代码省略.........
开发者ID:CSRedRat,项目名称:vlc,代码行数:101,
示例25: RunInterface/***************************************************************************** * RunInterface: setups necessary data and give control to the interface *****************************************************************************/static void* RunInterface( vlc_object_t *p_this ){ intf_thread_t *p_intf = (intf_thread_t *)p_this; vlc_value_t val, text; char *psz_intf; /* Variable used for interface spawning */ var_Create( p_intf, "intf-add", VLC_VAR_STRING | VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND ); text.psz_string = _("Add Interface"); var_Change( p_intf, "intf-add", VLC_VAR_SETTEXT, &text, NULL ); val.psz_string = (char *)"rc"; text.psz_string = (char *)_("Console"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); val.psz_string = (char *)"telnet"; text.psz_string = (char *)_("Telnet Interface"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); val.psz_string = (char *)"http"; text.psz_string = (char *)_("Web Interface"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); val.psz_string = (char *)"logger"; text.psz_string = (char *)_("Debug logging"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); val.psz_string = (char *)"gestures"; text.psz_string = (char *)_("Mouse Gestures"); var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text ); var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL ); do { /* Give control to the interface */ if( p_intf->pf_run ) p_intf->pf_run( p_intf ); else { vlc_object_lock( p_intf ); while( vlc_object_alive( p_intf ) ) vlc_object_wait( p_intf ); vlc_object_unlock( p_intf ); } if( !p_intf->psz_switch_intf ) { break; } /* Make sure the old interface is completely uninitialized */ module_Unneed( p_intf, p_intf->p_module ); /* Provide ability to switch the main interface on the fly */ psz_intf = p_intf->psz_switch_intf; p_intf->psz_switch_intf = NULL; vlc_object_lock( p_intf ); p_intf->b_die = false; /* FIXME */ p_intf->b_dead = false; vlc_object_unlock( p_intf ); p_intf->psz_intf = psz_intf; p_intf->p_module = module_Need( p_intf, "interface", psz_intf, 0 ); } while( p_intf->p_module ); return NULL;}
开发者ID:mahaserver,项目名称:MHSVLC,代码行数:70,
示例26: aout_DecNew/** * Creates an audio output */int aout_DecNew( audio_output_t *p_aout, const audio_sample_format_t *p_format, const audio_replay_gain_t *p_replay_gain, const aout_request_vout_t *p_request_vout ){ /* Sanitize audio format */ unsigned i_channels = aout_FormatNbChannels( p_format ); if( i_channels != p_format->i_channels && AOUT_FMT_LINEAR( p_format ) ) { msg_Err( p_aout, "incompatible audio channels count with layout mask" ); return -1; } if( p_format->i_rate > 352800 ) { msg_Err( p_aout, "excessive audio sample frequency (%u)", p_format->i_rate ); return -1; } if( p_format->i_rate < 4000 ) { msg_Err( p_aout, "too low audio sample frequency (%u)", p_format->i_rate ); return -1; } var_Create (p_aout, "stereo-mode", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT); vlc_value_t txt; txt.psz_string = _("Stereo audio mode"); var_Change (p_aout, "stereo-mode", VLC_VAR_SETTEXT, &txt, NULL); aout_owner_t *owner = aout_owner(p_aout); /* TODO: reduce lock scope depending on decoder's real need */ aout_OutputLock (p_aout); /* Create the audio output stream */ owner->volume = aout_volume_New (p_aout, p_replay_gain); atomic_store (&owner->restart, 0); owner->input_format = *p_format; owner->mixer_format = owner->input_format; owner->request_vout = *p_request_vout; if (aout_OutputNew (p_aout, &owner->mixer_format)) goto error; aout_volume_SetFormat (owner->volume, owner->mixer_format.i_format); /* Create the audio filtering "input" pipeline */ owner->filters = aout_FiltersNew (p_aout, p_format, &owner->mixer_format, &owner->request_vout); if (owner->filters == NULL) { aout_OutputDelete (p_aout);error: aout_volume_Delete (owner->volume); owner->volume = NULL; aout_OutputUnlock (p_aout); var_Destroy (p_aout, "stereo-mode"); return -1; } owner->sync.end = VLC_TS_INVALID; owner->sync.resamp_type = AOUT_RESAMPLING_NONE; owner->sync.discontinuity = true; aout_OutputUnlock (p_aout); atomic_init (&owner->buffers_lost, 0); atomic_init (&owner->buffers_played, 0); return 0;}
开发者ID:etix,项目名称:vlc,代码行数:74,
示例27: Open/** * It creates a Direct3D vout display. */static int Open(vlc_object_t *object){ vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys; /* Allocate structure */ vd->sys = sys = calloc(1, sizeof(vout_display_sys_t)); if (!sys) return VLC_ENOMEM; if (Direct3DCreate(vd)) { msg_Err(vd, "Direct3D could not be initialized"); Direct3DDestroy(vd); free(sys); return VLC_EGENERIC; } sys->use_desktop = var_CreateGetBool(vd, "direct3d-desktop"); sys->reset_device = false; sys->reset_device = false; sys->allow_hw_yuv = var_CreateGetBool(vd, "directx-hw-yuv"); sys->desktop_save.is_fullscreen = vd->cfg->is_fullscreen; sys->desktop_save.is_on_top = false; sys->desktop_save.win.left = var_InheritInteger(vd, "video-x"); sys->desktop_save.win.right = vd->cfg->display.width; sys->desktop_save.win.top = var_InheritInteger(vd, "video-y"); sys->desktop_save.win.bottom = vd->cfg->display.height; if (CommonInit(vd)) goto error; /* */ video_format_t fmt; if (Direct3DOpen(vd, &fmt)) { msg_Err(vd, "Direct3D could not be opened"); goto error; } /* */ vout_display_info_t info = vd->info; info.is_slow = true; info.has_double_click = true; info.has_hide_mouse = false; info.has_pictures_invalid = true; info.has_event_thread = true; /* Interaction */ vlc_mutex_init(&sys->lock); sys->ch_desktop = false; sys->desktop_requested = sys->use_desktop; vlc_value_t val; val.psz_string = _("Desktop"); var_Change(vd, "direct3d-desktop", VLC_VAR_SETTEXT, &val, NULL); var_AddCallback(vd, "direct3d-desktop", DesktopCallback, NULL); /* Setup vout_display now that everything is fine */ vd->fmt = fmt; vd->info = info; vd->pool = Pool; vd->prepare = Prepare; vd->display = Display; vd->control = Control; vd->manage = Manage; /* Fix state in case of desktop mode */ if (sys->use_desktop && vd->cfg->is_fullscreen) vout_display_SendEventFullscreen(vd, false); return VLC_SUCCESS;error: Direct3DClose(vd); CommonClean(vd); Direct3DDestroy(vd); free(vd->sys); return VLC_EGENERIC;}
开发者ID:banketree,项目名称:faplayer,代码行数:81,
注:本文中的var_Change函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ var_Create函数代码示例 C++ var_AddCallback函数代码示例 |