这篇教程C++ var_Get函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中var_Get函数的典型用法代码示例。如果您正苦于以下问题:C++ var_Get函数的具体用法?C++ var_Get怎么用?C++ var_Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了var_Get函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: aout_OutputNew/***************************************************************************** * aout_OutputNew : allocate a new output and rework the filter pipeline ***************************************************************************** * This function is entered with the mixer lock. *****************************************************************************/int aout_OutputNew( aout_instance_t * p_aout, audio_sample_format_t * p_format ){ /* Retrieve user defaults. */ int i_rate = var_InheritInteger( p_aout, "aout-rate" ); vlc_value_t val, text; /* kludge to avoid a fpu error when rate is 0... */ if( i_rate == 0 ) i_rate = -1; memcpy( &p_aout->output.output, p_format, sizeof(audio_sample_format_t) ); if ( i_rate != -1 ) p_aout->output.output.i_rate = i_rate; aout_FormatPrepare( &p_aout->output.output ); /* Find the best output plug-in. */ p_aout->output.p_module = module_need( p_aout, "audio output", "$aout", false ); if ( p_aout->output.p_module == NULL ) { msg_Err( p_aout, "no suitable audio output module" ); return -1; } if ( var_Type( p_aout, "audio-channels" ) == (VLC_VAR_INTEGER | VLC_VAR_HASCHOICE) ) { /* The user may have selected a different channels configuration. */ var_Get( p_aout, "audio-channels", &val ); if ( val.i_int == AOUT_VAR_CHAN_RSTEREO ) { p_aout->output.output.i_original_channels |= AOUT_CHAN_REVERSESTEREO; } else if ( val.i_int == AOUT_VAR_CHAN_STEREO ) { p_aout->output.output.i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; } else if ( val.i_int == AOUT_VAR_CHAN_LEFT ) { p_aout->output.output.i_original_channels = AOUT_CHAN_LEFT; } else if ( val.i_int == AOUT_VAR_CHAN_RIGHT ) { p_aout->output.output.i_original_channels = AOUT_CHAN_RIGHT; } else if ( val.i_int == AOUT_VAR_CHAN_DOLBYS ) { p_aout->output.output.i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_DOLBYSTEREO; } } else if ( p_aout->output.output.i_physical_channels == AOUT_CHAN_CENTER && (p_aout->output.output.i_original_channels & AOUT_CHAN_PHYSMASK) == (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) ) { /* Mono - create the audio-channels variable. */ var_Create( p_aout, "audio-channels", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); text.psz_string = _("Audio Channels"); var_Change( p_aout, "audio-channels", VLC_VAR_SETTEXT, &text, NULL ); val.i_int = AOUT_VAR_CHAN_STEREO; text.psz_string = _("Stereo"); var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val, &text ); val.i_int = AOUT_VAR_CHAN_LEFT; text.psz_string = _("Left"); var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val, &text ); val.i_int = AOUT_VAR_CHAN_RIGHT; text.psz_string = _("Right"); var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val, &text ); if ( p_aout->output.output.i_original_channels & AOUT_CHAN_DUALMONO ) { /* Go directly to the left channel. */ p_aout->output.output.i_original_channels = AOUT_CHAN_LEFT; var_SetInteger( p_aout, "audio-channels", AOUT_VAR_CHAN_LEFT ); } var_AddCallback( p_aout, "audio-channels", aout_ChannelsRestart, NULL ); } else if ( p_aout->output.output.i_physical_channels == (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) && (p_aout->output.output.i_original_channels & (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) ) { /* Stereo - create the audio-channels variable. */ var_Create( p_aout, "audio-channels", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); text.psz_string = _("Audio Channels"); var_Change( p_aout, "audio-channels", VLC_VAR_SETTEXT, &text, NULL ); if ( p_aout->output.output.i_original_channels & AOUT_CHAN_DOLBYSTEREO ) { val.i_int = AOUT_VAR_CHAN_DOLBYS; text.psz_string = _("Dolby Surround"); } else {//.........这里部分代码省略.........
开发者ID:banketree,项目名称:faplayer,代码行数:101,
示例2: InitWindowSize/***************************************************************************** * InitWindowSize: find the initial dimensions the video window should have. ***************************************************************************** * This function will check the "width", "height" and "zoom" config options and * will calculate the size that the video window should have. *****************************************************************************/static void InitWindowSize( vout_thread_t *p_vout, unsigned *pi_width, unsigned *pi_height ){ vlc_value_t val; int i_width, i_height; uint64_t ll_zoom;#define FP_FACTOR 1000 /* our fixed point factor */ var_Get( p_vout, "width", &val ); i_width = val.i_int; var_Get( p_vout, "height", &val ); i_height = val.i_int; var_Get( p_vout, "zoom", &val ); ll_zoom = (uint64_t)( FP_FACTOR * val.f_float ); if( i_width > 0 && i_height > 0) { *pi_width = (int)( i_width * ll_zoom / FP_FACTOR ); *pi_height = (int)( i_height * ll_zoom / FP_FACTOR ); goto initwsize_end; } else if( i_width > 0 ) { *pi_width = (int)( i_width * ll_zoom / FP_FACTOR ); *pi_height = (int)( p_vout->fmt_in.i_visible_height * ll_zoom * p_vout->fmt_in.i_sar_den * i_width / p_vout->fmt_in.i_sar_num / FP_FACTOR / p_vout->fmt_in.i_visible_width ); goto initwsize_end; } else if( i_height > 0 ) { *pi_height = (int)( i_height * ll_zoom / FP_FACTOR ); *pi_width = (int)( p_vout->fmt_in.i_visible_width * ll_zoom * p_vout->fmt_in.i_sar_num * i_height / p_vout->fmt_in.i_sar_den / FP_FACTOR / p_vout->fmt_in.i_visible_height ); goto initwsize_end; } if( p_vout->fmt_in.i_sar_num == 0 || p_vout->fmt_in.i_sar_den == 0 ) { msg_Warn( p_vout, "fucked up aspect" ); *pi_width = (int)( p_vout->fmt_in.i_visible_width * ll_zoom / FP_FACTOR ); *pi_height = (int)( p_vout->fmt_in.i_visible_height * ll_zoom /FP_FACTOR); } else if( p_vout->fmt_in.i_sar_num >= p_vout->fmt_in.i_sar_den ) { *pi_width = (int)( p_vout->fmt_in.i_visible_width * ll_zoom * p_vout->fmt_in.i_sar_num / p_vout->fmt_in.i_sar_den / FP_FACTOR ); *pi_height = (int)( p_vout->fmt_in.i_visible_height * ll_zoom / FP_FACTOR ); } else { *pi_width = (int)( p_vout->fmt_in.i_visible_width * ll_zoom / FP_FACTOR ); *pi_height = (int)( p_vout->fmt_in.i_visible_height * ll_zoom * p_vout->fmt_in.i_sar_den / p_vout->fmt_in.i_sar_num / FP_FACTOR ); }initwsize_end: msg_Dbg( p_vout, "window size: %dx%d", p_vout->i_window_width, p_vout->i_window_height );#undef FP_FACTOR}
开发者ID:mahaserver,项目名称:MHSVLC,代码行数:71,
示例3: EqzInitstatic int EqzInit( filter_t *p_filter, int i_rate ){ filter_sys_t *p_sys = p_filter->p_sys; eqz_config_t cfg; int i, ch; vlc_value_t val1, val2, val3; vlc_object_t *p_aout = p_filter->p_parent; int i_ret = VLC_ENOMEM; bool b_vlcFreqs = var_InheritBool( p_aout, "equalizer-vlcfreqs" ); EqzCoeffs( i_rate, 1.0f, b_vlcFreqs, &cfg ); /* Create the static filter config */ p_sys->i_band = cfg.i_band; p_sys->f_alpha = (float *)malloc( p_sys->i_band * sizeof(float) ); // sunqueen modify p_sys->f_beta = (float *)malloc( p_sys->i_band * sizeof(float) ); // sunqueen modify p_sys->f_gamma = (float *)malloc( p_sys->i_band * sizeof(float) ); // sunqueen modify if( !p_sys->f_alpha || !p_sys->f_beta || !p_sys->f_gamma ) goto error; for( i = 0; i < p_sys->i_band; i++ ) { p_sys->f_alpha[i] = cfg.band[i].f_alpha; p_sys->f_beta[i] = cfg.band[i].f_beta; p_sys->f_gamma[i] = cfg.band[i].f_gamma; } /* Filter dyn config */ p_sys->b_2eqz = false; p_sys->f_gamp = 1.0f; p_sys->f_amp = (float *)malloc( p_sys->i_band * sizeof(float) ); // sunqueen modify if( !p_sys->f_amp ) goto error; for( i = 0; i < p_sys->i_band; i++ ) { p_sys->f_amp[i] = 0.0f; } /* Filter state */ for( ch = 0; ch < 32; ch++ ) { p_sys->x[ch][0] = p_sys->x[ch][1] = p_sys->x2[ch][0] = p_sys->x2[ch][1] = 0.0f; for( i = 0; i < p_sys->i_band; i++ ) { p_sys->y[ch][i][0] = p_sys->y[ch][i][1] = p_sys->y2[ch][i][0] = p_sys->y2[ch][i][1] = 0.0f; } } p_sys->psz_newbands = NULL; var_Create( p_aout, "equalizer-bands", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_aout, "equalizer-preset", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); p_sys->b_2eqz = var_CreateGetBool( p_aout, "equalizer-2pass" ); var_Create( p_aout, "equalizer-preamp", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT ); /* Get initial values */ var_Get( p_aout, "equalizer-preset", &val1 ); var_Get( p_aout, "equalizer-bands", &val2 ); var_Get( p_aout, "equalizer-preamp", &val3 ); p_sys->b_first = true; PresetCallback( VLC_OBJECT( p_aout ), NULL, val1, val1, p_sys ); BandsCallback( VLC_OBJECT( p_aout ), NULL, val2, val2, p_sys ); PreampCallback( VLC_OBJECT( p_aout ), NULL, val3, val3, p_sys ); p_sys->b_first = false; free( val1.psz_string ); /* Exit if we have no preset and no bands value */ if (p_sys->psz_newbands == NULL && (!val2.psz_string || !*val2.psz_string)) { msg_Err(p_filter, "No preset selected"); free( val2.psz_string ); free( p_sys->f_amp ); i_ret = VLC_EGENERIC; goto error; } /* Register preset bands (for intf) if : */ /* We have no bands info --> the preset info must be given to the intf */ /* or The bands info matches the preset */ if( ( p_sys->psz_newbands && *(val2.psz_string) && strstr( p_sys->psz_newbands, val2.psz_string ) ) || !*val2.psz_string ) { var_SetString( p_aout, "equalizer-bands", p_sys->psz_newbands ); if( p_sys->f_newpreamp == p_sys->f_gamp ) var_SetFloat( p_aout, "equalizer-preamp", p_sys->f_newpreamp ); } free( val2.psz_string ); /* Add our own callbacks *///.........这里部分代码省略.........
开发者ID:Aki-Liang,项目名称:vlc-2.1.0.oldlib-2010,代码行数:101,
示例4: vlc_object_find/***************************************************************************** * InterfaceWindow::UpdateInterface *****************************************************************************/void InterfaceWindow::UpdateInterface(){ if( !p_input ) { p_input = (input_thread_t *) vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); } else if( p_input->b_dead ) { vlc_object_release( p_input ); p_input = NULL; } /* Get ready to update the interface */ if( LockWithTimeout( INTERFACE_LOCKING_TIMEOUT ) != B_OK ) { return; } if( b_playlist_update ) {#if 0 if( fPlaylistWindow->Lock() ) { fPlaylistWindow->UpdatePlaylist( true ); fPlaylistWindow->Unlock(); b_playlist_update = false; }#endif p_mediaControl->SetEnabled( !playlist_IsEmpty( p_playlist ) ); } if( p_input ) { vlc_value_t val; p_mediaControl->SetEnabled( true ); bool hasTitles = !var_Get( p_input, "title", &val ); bool hasChapters = !var_Get( p_input, "chapter", &val ); p_mediaControl->SetStatus( var_GetInteger( p_input, "state" ), var_GetInteger( p_input, "rate" ) ); var_Get( p_input, "position", &val ); p_mediaControl->SetProgress( val.f_float ); _SetMenusEnabled( true, hasChapters, hasTitles ); _UpdateSpeedMenu( var_GetInteger( p_input, "rate" ) ); // enable/disable skip buttons#if 0 bool canSkipPrev; bool canSkipNext; p_wrapper->GetNavCapabilities( &canSkipPrev, &canSkipNext ); p_mediaControl->SetSkippable( canSkipPrev, canSkipNext );#endif audio_volume_t i_volume; aout_VolumeGet( p_intf, &i_volume ); p_mediaControl->SetAudioEnabled( true ); p_mediaControl->SetMuted( i_volume ); } else { p_mediaControl->SetAudioEnabled( false ); _SetMenusEnabled( false ); if( !playlist_IsEmpty( p_playlist ) ) { p_mediaControl->SetProgress( 0 );#if 0 // enable/disable skip buttons bool canSkipPrev; bool canSkipNext; p_wrapper->GetNavCapabilities( &canSkipPrev, &canSkipNext ); p_mediaControl->SetSkippable( canSkipPrev, canSkipNext );#endif } else { p_mediaControl->SetEnabled( false ); } } Unlock(); fLastUpdateTime = system_time();}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:88,
示例5: OpenEncoder/***************************************************************************** * OpenEncoder: probe the encoder and return score *****************************************************************************/static int OpenEncoder( vlc_object_t *p_this ){ encoder_t *p_enc = (encoder_t *)p_this; encoder_sys_t *p_sys; vlc_value_t val; if( p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','g','a') && p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','2','a') && p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','2',' ') && !p_enc->b_force ) { return VLC_EGENERIC; } if( p_enc->fmt_in.audio.i_channels > 2 ) { msg_Err( p_enc, "doesn't support > 2 channels" ); return VLC_EGENERIC; } /* Allocate the memory needed to store the decoder's structure */ if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL ) { msg_Err( p_enc, "out of memory" ); return VLC_EGENERIC; } p_enc->p_sys = p_sys; p_enc->pf_encode_audio = Encode; p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE; p_enc->fmt_out.i_codec = VLC_FOURCC('m','p','g','a'); sout_CfgParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); p_sys->p_toolame = toolame_init(); /* Set options */ toolame_setSampleFreq( p_sys->p_toolame, p_enc->fmt_out.audio.i_rate ); var_Get( p_enc, ENC_CFG_PREFIX "vbr", &val ); if ( val.b_bool ) { FLOAT i_quality; var_Get( p_enc, ENC_CFG_PREFIX "quality", &val ); i_quality = val.i_int; if ( i_quality > 50.0 ) i_quality = 50.0; if ( i_quality < 0.0 ) i_quality = 0.0; toolame_setVBR( p_sys->p_toolame, 1 ); toolame_setVBRLevel( p_sys->p_toolame, i_quality ); } else { toolame_setBitrate( p_sys->p_toolame, p_enc->fmt_out.i_bitrate / 1000 ); } if ( p_enc->fmt_in.audio.i_channels == 1 ) { toolame_setMode( p_sys->p_toolame, MPG_MD_MONO ); } else { var_Get( p_enc, ENC_CFG_PREFIX "mode", &val ); switch ( val.i_int ) { case 1: toolame_setMode( p_sys->p_toolame, MPG_MD_DUAL_CHANNEL ); break; case 2: toolame_setMode( p_sys->p_toolame, MPG_MD_JOINT_STEREO ); break; case 0: default: toolame_setMode( p_sys->p_toolame, MPG_MD_STEREO ); break; } } if ( toolame_init_params( p_sys->p_toolame ) ) { msg_Err( p_enc, "toolame initialization failed" ); return -VLC_EGENERIC; } p_sys->i_nb_samples = 0; aout_DateInit( &p_sys->pts, p_enc->fmt_out.audio.i_rate ); return VLC_SUCCESS;}
开发者ID:sdelmas,项目名称:SDesk,代码行数:91,
示例6: mvar_Newmvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name, input_thread_t *p_input, const char *psz_variable ){ intf_sys_t *p_sys = p_intf->p_sys; mvar_t *s = mvar_New( name, "set" ); vlc_value_t val, val_list, text_list; int i_type, i; if( p_input == NULL ) { return s; } /* Check the type of the object variable */ i_type = var_Type( p_sys->p_input, psz_variable ); /* Make sure we want to display the variable */ if( i_type & VLC_VAR_HASCHOICE ) { var_Change( p_sys->p_input, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL ); if( val.i_int == 0 ) return s; if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 ) return s; } else { return s; } 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: break; default: /* Variable doesn't exist or isn't handled */ return s; } if( var_Get( p_sys->p_input, psz_variable, &val ) < 0 ) { return s; } if( var_Change( p_sys->p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list ) < 0 ) { if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string ); return s; } for( i = 0; i < val_list.p_list->i_count; i++ ) { char psz_int[16]; mvar_t *itm; switch( i_type & VLC_VAR_TYPE ) { case VLC_VAR_STRING: itm = mvar_New( name, "set" ); mvar_AppendNewVar( itm, "name", text_list.p_list->p_values[i].psz_string ); mvar_AppendNewVar( itm, "id", val_list.p_list->p_values[i].psz_string ); snprintf( psz_int, sizeof(psz_int), "%d", ( !strcmp( val.psz_string, val_list.p_list->p_values[i].psz_string ) && !( i_type & VLC_VAR_ISCOMMAND ) ) ); mvar_AppendNewVar( itm, "selected", psz_int ); mvar_AppendVar( s, itm ); break; case VLC_VAR_INTEGER: itm = mvar_New( name, "set" ); mvar_AppendNewVar( itm, "name", text_list.p_list->p_values[i].psz_string ); snprintf( psz_int, sizeof(psz_int), "%d", val_list.p_list->p_values[i].i_int ); mvar_AppendNewVar( itm, "id", psz_int ); snprintf( psz_int, sizeof(psz_int), "%d", ( val.i_int == val_list.p_list->p_values[i].i_int ) && !( i_type & VLC_VAR_ISCOMMAND ) ); mvar_AppendNewVar( itm, "selected", psz_int ); mvar_AppendVar( s, itm ); break; default: break; } } /* clean up everything */ if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string ); var_FreeList( &val_list, &text_list ); return s;}
开发者ID:cobr123,项目名称:qtVlc,代码行数:96,
示例7: Open/***************************************************************************** * Open: *****************************************************************************/static int Open( vlc_object_t *p_this ){ sout_stream_t *p_stream = (sout_stream_t*)p_this; sout_stream_sys_t *p_sys; vlc_value_t val; char *psz_files, *psz_sizes; int i_height = 0, i_width = 0; p_sys = calloc( 1, sizeof(sout_stream_sys_t) ); if( !p_sys ) return VLC_ENOMEM; p_sys->p_out = sout_StreamNew( p_stream->p_sout, p_stream->psz_next ); if( !p_sys->p_out ) { msg_Err( p_stream, "cannot create chain" ); free( p_sys ); return VLC_EGENERIC; } config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); var_Get( p_stream, SOUT_CFG_PREFIX "files", &val ); psz_files = val.psz_string; var_Get( p_stream, SOUT_CFG_PREFIX "sizes", &val ); psz_sizes = val.psz_string; p_sys->i_nb_pictures = 0; while ( psz_files && *psz_files ) { char * psz_file = psz_files; char * psz_size = psz_sizes; while ( *psz_files && *psz_files != ':' ) psz_files++; if ( *psz_files == ':' ) *psz_files++ = '/0'; if ( *psz_sizes ) { while ( *psz_sizes && *psz_sizes != ':' ) psz_sizes++; if ( *psz_sizes == ':' ) *psz_sizes++ = '/0'; if ( sscanf( psz_size, "%dx%d", &i_width, &i_height ) != 2 ) { msg_Err( p_stream, "bad size %s for file %s", psz_size, psz_file ); free( p_sys ); return VLC_EGENERIC; } } if ( UnpackFromFile( p_stream, psz_file, i_width, i_height, &p_sys->p_pictures[p_sys->i_nb_pictures] ) < 0 ) { free( p_sys ); return VLC_EGENERIC; } p_sys->i_nb_pictures++; } var_Get( p_stream, SOUT_CFG_PREFIX "aspect-ratio", &val ); if ( val.psz_string ) { char *psz_parser = strchr( val.psz_string, ':' ); if( psz_parser ) { *psz_parser++ = '/0'; p_sys->i_aspect = atoi( val.psz_string ) * VOUT_ASPECT_FACTOR / atoi( psz_parser ); } else { msg_Warn( p_stream, "bad aspect ratio %s", val.psz_string ); p_sys->i_aspect = 4 * VOUT_ASPECT_FACTOR / 3; } free( val.psz_string ); } else { p_sys->i_aspect = 4 * VOUT_ASPECT_FACTOR / 3; } var_Get( p_stream, SOUT_CFG_PREFIX "port", &val ); p_sys->i_fd = net_ListenUDP1( VLC_OBJECT(p_stream), NULL, val.i_int ); if ( p_sys->i_fd < 0 ) { free( p_sys ); return VLC_EGENERIC; } var_Get( p_stream, SOUT_CFG_PREFIX "command", &val ); p_sys->i_cmd = val.i_int;//.........这里部分代码省略.........
开发者ID:FLYKingdom,项目名称:vlc,代码行数:101,
示例8: Run//.........这里部分代码省略......... continue; } if( !strcmp( c, "DOWN" ) ) { vlc_value_t val; val.psz_string = "DOWN"; if (var_Set( p_vout, "key-pressed", val ) != VLC_SUCCESS) { msg_Warn( p_intf, "key-press failed" ); } continue; } } if( !strcmp( c, "PLAY" ) ) { p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist ) { playlist_Play( p_playlist ); vlc_object_release( p_playlist ); } continue; } if( !strcmp( c, "PLAYPAUSE" ) ) { vlc_value_t val; val.i_int = PLAYING_S; if( p_input ) { var_Get( p_input, "state", &val ); } if( p_input && val.i_int != PAUSE_S ) { vout_OSDMessage( VLC_OBJECT(p_intf), DEFAULT_CHAN, _( "Pause" ) ); val.i_int = PAUSE_S; var_Set( p_input, "state", val ); } else { p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist ) { vlc_mutex_lock( &p_playlist->object_lock ); if( p_playlist->i_size ) { vlc_mutex_unlock( &p_playlist->object_lock ); vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Play" ) ); playlist_Play( p_playlist ); vlc_object_release( p_playlist ); } } } continue; } else if( p_input ) { if( !strcmp( c, "AUDIO_TRACK" ) ) { vlc_value_t val, list, list2;
开发者ID:forthyen,项目名称:SDesk,代码行数:67,
示例9: EqzInitstatic int EqzInit( filter_t *p_filter, int i_rate ){ filter_sys_t *p_sys = p_filter->p_sys; const eqz_config_t *p_cfg; int i, ch; vlc_value_t val1, val2, val3; vlc_object_t *p_aout = p_filter->p_parent; int i_ret = VLC_ENOMEM; /* Select the config */ if( i_rate == 48000 ) { p_cfg = &eqz_config_48000_10b; } else if( i_rate == 44100 ) { p_cfg = &eqz_config_44100_10b; } else { /* TODO compute the coeffs on the fly */ msg_Err( p_filter, "rate not supported" ); return VLC_EGENERIC; } /* Create the static filter config */ p_sys->i_band = p_cfg->i_band; p_sys->f_alpha = malloc( p_sys->i_band * sizeof(float) ); p_sys->f_beta = malloc( p_sys->i_band * sizeof(float) ); p_sys->f_gamma = malloc( p_sys->i_band * sizeof(float) ); if( !p_sys->f_alpha || !p_sys->f_beta || !p_sys->f_gamma ) goto error; for( i = 0; i < p_sys->i_band; i++ ) { p_sys->f_alpha[i] = p_cfg->band[i].f_alpha; p_sys->f_beta[i] = p_cfg->band[i].f_beta; p_sys->f_gamma[i] = p_cfg->band[i].f_gamma; } /* Filter dyn config */ p_sys->b_2eqz = false; p_sys->f_gamp = 1.0; p_sys->f_amp = malloc( p_sys->i_band * sizeof(float) ); if( !p_sys->f_amp ) goto error; for( i = 0; i < p_sys->i_band; i++ ) { p_sys->f_amp[i] = 0.0; } /* Filter state */ for( ch = 0; ch < 32; ch++ ) { p_sys->x[ch][0] = p_sys->x[ch][1] = p_sys->x2[ch][0] = p_sys->x2[ch][1] = 0.0; for( i = 0; i < p_sys->i_band; i++ ) { p_sys->y[ch][i][0] = p_sys->y[ch][i][1] = p_sys->y2[ch][i][0] = p_sys->y2[ch][i][1] = 0.0; } } var_Create( p_aout, "equalizer-bands", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_aout, "equalizer-preset", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); p_sys->b_2eqz = var_CreateGetBool( p_aout, "equalizer-2pass" ); var_Create( p_aout, "equalizer-preamp", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT ); /* Get initial values */ var_Get( p_aout, "equalizer-preset", &val1 ); var_Get( p_aout, "equalizer-bands", &val2 ); var_Get( p_aout, "equalizer-preamp", &val3 ); p_sys->b_first = true; PresetCallback( VLC_OBJECT( p_aout ), NULL, val1, val1, p_sys ); BandsCallback( VLC_OBJECT( p_aout ), NULL, val2, val2, p_sys ); PreampCallback( VLC_OBJECT( p_aout ), NULL, val3, val3, p_sys ); p_sys->b_first = false; free( val1.psz_string ); /* Register preset bands (for intf) if : */ /* We have no bands info --> the preset info must be given to the intf */ /* or The bands info matches the preset */ if (p_sys->psz_newbands == NULL) { msg_Err(p_filter, "No preset selected"); free( val2.psz_string ); free( p_sys->f_amp ); i_ret = VLC_EGENERIC; goto error; }//.........这里部分代码省略.........
开发者ID:hustcalm,项目名称:vlc-player,代码行数:101,
示例10: Open/***************************************************************************** * Open *****************************************************************************/static int Open( vlc_object_t *p_this ){ sout_stream_t *p_stream = (sout_stream_t *)p_this; sout_stream_sys_t *p_sys; vlc_value_t val; config_ChainParse( p_stream, CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); p_sys = malloc( sizeof( sout_stream_sys_t ) ); if( !p_sys ) return VLC_ENOMEM; p_stream->p_sys = p_sys; p_sys->b_inited = false; p_sys->psz_id = var_CreateGetString( p_stream, CFG_PREFIX "id" ); p_sys->i_height = var_CreateGetIntegerCommand( p_stream, CFG_PREFIX "height" ); var_AddCallback( p_stream, CFG_PREFIX "height", HeightCallback, p_stream ); p_sys->i_width = var_CreateGetIntegerCommand( p_stream, CFG_PREFIX "width" ); var_AddCallback( p_stream, CFG_PREFIX "width", WidthCallback, p_stream ); var_Get( p_stream, CFG_PREFIX "sar", &val ); if( val.psz_string ) { char *psz_parser = strchr( val.psz_string, ':' ); if( psz_parser ) { *psz_parser++ = '/0'; p_sys->i_sar_num = atoi( val.psz_string ); p_sys->i_sar_den = atoi( psz_parser ); vlc_ureduce( &p_sys->i_sar_num, &p_sys->i_sar_den, p_sys->i_sar_num, p_sys->i_sar_den, 0 ); } else { msg_Warn( p_stream, "bad aspect ratio %s", val.psz_string ); p_sys->i_sar_num = p_sys->i_sar_den = 1; } free( val.psz_string ); } else { p_sys->i_sar_num = p_sys->i_sar_den = 1; } p_sys->i_chroma = 0; val.psz_string = var_GetNonEmptyString( p_stream, CFG_PREFIX "chroma" ); if( val.psz_string && strlen( val.psz_string ) >= 4 ) { memcpy( &p_sys->i_chroma, val.psz_string, 4 ); msg_Dbg( p_stream, "Forcing image chroma to 0x%.8x (%4.4s)", p_sys->i_chroma, (char*)&p_sys->i_chroma ); } free( val.psz_string );#define INT_COMMAND( a ) do { / var_Create( p_stream, CFG_PREFIX #a, / VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); / var_AddCallback( p_stream, CFG_PREFIX #a, a ## Callback, / p_stream ); } while(0) INT_COMMAND( alpha ); INT_COMMAND( x ); INT_COMMAND( y );#undef INT_COMMAND p_stream->pf_add = Add; p_stream->pf_del = Del; p_stream->pf_send = Send; p_stream->pace_nocontrol = true; return VLC_SUCCESS;}
开发者ID:etix,项目名称:vlc,代码行数:82,
示例11: OpenFilter/***************************************************************************** * OpenFilter: probe the filter and return score *****************************************************************************/static int OpenFilter(vlc_object_t *p_this){ filter_t *p_filter = (filter_t*) p_this; filter_sys_t *p_sys; /* Allocate the memory needed to store the decoder's structure */ if ((p_filter->p_sys = p_sys = (filter_sys_t *) malloc(sizeof (filter_sys_t))) == NULL) { return VLC_ENOMEM; } vlc_value_t val1; var_Get(p_filter->p_parent->p_parent, "video-object", &val1); analytic_input_params *parameters = (analytic_input_params*) val1.p_address; p_sys->input_parameters = parameters; p_sys->event_info.i_region_size = 0; p_sys->event_info.p_region = NULL; p_sys->i_id = 0; p_sys->counter = 0; p_filter->p_sys->x_old = 0; p_filter->p_sys->x_new = 0; p_filter->p_sys->y_old = 0; p_filter->p_sys->y_new = 0; p_filter->p_sys->mov = 0; p_filter->p_sys->click = 0; p_filter->p_sys->save_preset = 0; p_filter->p_sys->scroll_value = 0; p_filter->p_sys->Var_on_click_zoom = 0; p_filter->p_sys->angle_rotate = 0; p_filter->p_sys->start = 1; ///////////////////////////////////////////////////////text file assignment///////////////////// //////////////// creating folder "fisheye_config" //////////////////////// char idnum[20]; sprintf(idnum, "%d", p_filter->p_sys->input_parameters->cameraid); char name[] = "fisheye_config/camera_num_"; strcpy(p_filter->p_sys->camera_id, name); char txt[] = ".txt"; strcat(p_filter->p_sys->camera_id, idnum); strcat(p_filter->p_sys->camera_id, txt); //Open the input file ifstream input; input.open(p_filter->p_sys->camera_id); if (!input) { cout << "camera1.txt could not be accessed!" << endl; ofstream outf(p_filter->p_sys->camera_id); // If we couldn't open the output file stream for writing if (!outf) { // Print an error and exit cerr << "Uh oh, Sample.dat could not be opened for writing!" << endl; return 0; } // We'll write two lines into this file outf << "radius = 400.00" << endl; outf << "theta = 1.57" << endl; outf << "centre_x = 200.00" << endl; outf << "centre_y = 200.00" << endl; outf.close(); p_filter->p_sys->start = 0; input.open(p_filter->p_sys->camera_id); } else { //Variables string temp; if (!input.eof()) { getline(input, temp); //Get 1 line from the file and place into temp p_filter->p_sys->radius_video = HOME_MADE_ATOI(temp); } if (!input.eof()) { getline(input, temp); //Get 1 line from the file and place into temp p_filter->p_sys->theta = HOME_MADE_ATOI(temp); } if (!input.eof()) { getline(input, temp); //Get 1 line from the file and place into temp p_filter->p_sys->centre_x = HOME_MADE_ATOI(temp); } if (!input.eof())//.........这里部分代码省略.........
开发者ID:SheenaChhabra,项目名称:FisheyeUncurlingModule,代码行数:101,
示例12: osd_GetMutex/***************************************************************************** * OSD menu Funtions *****************************************************************************/osd_menu_t *osd_MenuCreate( vlc_object_t *p_this, const char *psz_file ){ osd_menu_t *p_osd = NULL; vlc_value_t val; vlc_mutex_t *p_lock; int i_volume = 0; int i_steps = 0; /* to be sure to avoid multiple creation */ p_lock = osd_GetMutex( p_this ); vlc_mutex_lock( p_lock ); var_Create( p_this->p_libvlc, "osd", VLC_VAR_ADDRESS ); var_Get( p_this->p_libvlc, "osd", &val ); if( val.p_address == NULL ) { static const char osdmenu_name[] = "osd menu"; p_osd = vlc_custom_create( p_this, sizeof( *p_osd ), VLC_OBJECT_GENERIC, osdmenu_name ); if( !p_osd ) return NULL; p_osd->p_parser = NULL; vlc_object_attach( p_osd, p_this->p_libvlc ); /* Parse configuration file */ if ( !osd_ParserLoad( p_osd, psz_file ) ) goto error; if( !p_osd->p_state ) goto error; /* Setup default button (first button) */ p_osd->p_state->p_visible = p_osd->p_button; p_osd->p_state->p_visible->p_current_state = osd_StateChange( p_osd->p_state->p_visible, OSD_BUTTON_SELECT ); p_osd->i_width = p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_pitch; p_osd->i_height = p_osd->p_state->p_visible->p_current_state->p_pic->p[Y_PLANE].i_visible_lines; if( p_osd->p_state->p_volume ) { /* Update the volume state images to match the current volume */ i_volume = config_GetInt( p_this, "volume" ); i_steps = osd_VolumeStep( p_this, i_volume, p_osd->p_state->p_volume->i_ranges ); p_osd->p_state->p_volume->p_current_state = osd_VolumeStateChange( p_osd->p_state->p_volume->p_states, i_steps ); } /* Initialize OSD state */ osd_UpdateState( p_osd->p_state, p_osd->i_x, p_osd->i_y, p_osd->i_width, p_osd->i_height, NULL ); /* Signal when an update of OSD menu is needed */ var_Create( p_osd, "osd-menu-update", VLC_VAR_BOOL ); var_Create( p_osd, "osd-menu-visible", VLC_VAR_BOOL ); var_SetBool( p_osd, "osd-menu-update", false ); var_SetBool( p_osd, "osd-menu-visible", false ); val.p_address = p_osd; var_Set( p_this->p_libvlc, "osd", val ); } else p_osd = val.p_address; vlc_object_hold( p_osd ); vlc_mutex_unlock( p_lock ); return p_osd;error: vlc_mutex_unlock( p_lock ); osd_MenuDelete( p_this, p_osd ); return NULL;}
开发者ID:paa,项目名称:vlc,代码行数:75,
示例13: HandleSeek/**************************************************************************** * Seek command parsing handling ****************************************************************************/void HandleSeek( intf_thread_t *p_intf, char *p_value ){ intf_sys_t *p_sys = p_intf->p_sys; vlc_value_t val; int i_stock = 0; uint64_t i_length; int i_value = 0; int i_relative = 0;#define POSITION_ABSOLUTE 12#define POSITION_REL_FOR 13#define POSITION_REL_BACK 11#define VL_TIME_ABSOLUTE 0#define VL_TIME_REL_FOR 1#define VL_TIME_REL_BACK -1 if( p_sys->p_input ) { var_Get( p_sys->p_input, "length", &val ); i_length = val.i_time; while( p_value[0] != '/0' ) { switch(p_value[0]) { case '+': { i_relative = VL_TIME_REL_FOR; p_value++; break; } case '-': { i_relative = VL_TIME_REL_BACK; p_value++; break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { i_stock = strtol( p_value , &p_value , 10 ); break; } case '%': /* for percentage ie position */ { i_relative += POSITION_ABSOLUTE; i_value = i_stock; i_stock = 0; p_value[0] = '/0'; break; } case ':': { i_value = 60 * (i_value + i_stock) ; i_stock = 0; p_value++; break; } case 'h': case 'H': /* hours */ { i_value += 3600 * i_stock; i_stock = 0; /* other characters which are not numbers are not * important */ while( ((p_value[0] < '0') || (p_value[0] > '9')) && (p_value[0] != '/0') ) { p_value++; } break; } case 'm': case 'M': case '/'': /* minutes */ { i_value += 60 * i_stock; i_stock = 0; p_value++; while( ((p_value[0] < '0') || (p_value[0] > '9')) && (p_value[0] != '/0') ) { p_value++; } break; } case 's': case 'S': case '"': /* seconds */ { i_value += i_stock; i_stock = 0; while( ((p_value[0] < '0') || (p_value[0] > '9')) && (p_value[0] != '/0') ) { p_value++; } break; } default: { p_value++; break; }//.........这里部分代码省略.........
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:101,
示例14: RunIntf/***************************************************************************** * RunIntf: main loop *****************************************************************************/static void RunIntf( intf_thread_t *p_intf ){ vout_thread_t * p_vout = NULL; if( InitThread( p_intf ) < 0 ) { msg_Err( p_intf, "can't initialize CMML interface" ); return; }#ifdef CMML_INTF_DEBUG msg_Dbg( p_intf, "CMML intf initialized" );#endif /* if video output is dying, disassociate ourselves from it */ if( p_vout && p_vout->b_die ) { var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf ); vlc_object_release( p_vout ); p_vout = NULL; } /* Main loop */ while( !p_intf->b_die ) { /* find a video output if we currently don't have one */ if( p_vout == NULL ) { p_vout = vlc_object_find( p_intf->p_sys->p_input, VLC_OBJECT_VOUT, FIND_CHILD ); if( p_vout ) {#ifdef CMML_INTF_DEBUG msg_Dbg( p_intf, "found vout thread" );#endif var_AddCallback( p_vout, "mouse-clicked", MouseEvent, p_intf ); } } vlc_mutex_lock( &p_intf->change_lock ); /* * keyboard event */ if( p_intf->p_sys->b_key_pressed ) { vlc_value_t val; int i, i_action = -1; struct hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys; /* Find action triggered by hotkey (if any) */ var_Get( p_intf->p_vlc, "key-pressed", &val ); /* Acknowledge that we've handled the b_key_pressed event */ p_intf->p_sys->b_key_pressed = VLC_FALSE;#ifdef CMML_INTF_DEBUG msg_Dbg( p_intf, "Got a keypress: %d", val.i_int );#endif for( i = 0; p_hotkeys[i].psz_action != NULL; i++ ) { if( p_hotkeys[i].i_key == val.i_int ) i_action = p_hotkeys[i].i_action; } /* What did the user do? */ if( i_action != -1 ) { switch( i_action ) { case ACTIONID_NAV_ACTIVATE: FollowAnchor( p_intf ); break; case ACTIONID_HISTORY_BACK: GoBack( p_intf ); break; case ACTIONID_HISTORY_FORWARD: GoForward( p_intf ); break; default: break; } } } vlc_mutex_unlock( &p_intf->change_lock ); (void) DisplayPendingAnchor( p_intf, p_vout ); /* Wait a bit */ msleep( INTF_IDLE_SLEEP ); } /* if we're here, the video output is dying: release the vout object */ if( p_vout )//.........这里部分代码省略.........
开发者ID:forthyen,项目名称:SDesk,代码行数:101,
示例15: DisplayPendingAnchor/***************************************************************************** * DisplayPendingAnchor: get a pending anchor description/URL from the CMML * decoder and display it on screen *****************************************************************************/static int DisplayPendingAnchor( intf_thread_t *p_intf, vout_thread_t *p_vout ){ decoder_t *p_cmml_decoder; char *psz_description = NULL; char *psz_url = NULL; intf_thread_t *p_primary_intf; vlc_value_t val; p_cmml_decoder = p_intf->p_sys->p_cmml_decoder; if( var_Get( p_cmml_decoder, "psz-current-anchor-description", &val ) != VLC_SUCCESS ) { return VLC_TRUE; } if( !val.p_address ) return VLC_TRUE; psz_description = val.p_address; if( var_Get( p_cmml_decoder, "psz-current-anchor-url", &val ) == VLC_SUCCESS ) { psz_url = val.p_address; } if( p_vout != NULL ) { /* don't display anchor if main interface can display it */ p_primary_intf = vlc_object_find( p_intf->p_vlc, VLC_OBJECT_INTF, FIND_CHILD ); if( p_primary_intf ) { if( var_Get( p_primary_intf, "intf-displays-cmml-description", &val ) == VLC_SUCCESS ) { if( val.b_bool == VLC_TRUE ) return VLC_TRUE; } } /* display anchor as subtitle on-screen */ if( DisplayAnchor( p_intf, p_vout, psz_description, psz_url ) != VLC_SUCCESS ) { /* text render unsuccessful: do nothing */ return VLC_FALSE; } /* text render successful: clear description */ val.p_address = NULL; if( var_Set( p_cmml_decoder, "psz-current-anchor-description", val ) != VLC_SUCCESS ) { msg_Dbg( p_intf, "reset of psz-current-anchor-description failed" ); } free( psz_description ); psz_url = NULL; } return VLC_TRUE;}
开发者ID:forthyen,项目名称:SDesk,代码行数:68,
示例16: switch/***************************************************************************** * InterfaceWindow::MessageReceived *****************************************************************************/void InterfaceWindow::MessageReceived( BMessage * p_message ){ switch( p_message->what ) { case B_ABOUT_REQUESTED: { BAlert * alert; alert = new BAlert( "VLC media player" VERSION, "VLC media player" VERSION " (BeOS interface)/n/n" "The VideoLAN team <[email C++ var_GetBool函数代码示例 C++ var_Destroy函数代码示例
|