这篇教程C++ var_GetBool函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中var_GetBool函数的典型用法代码示例。如果您正苦于以下问题:C++ var_GetBool函数的具体用法?C++ var_GetBool怎么用?C++ var_GetBool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了var_GetBool函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: OpenEncoderstatic int OpenEncoder( vlc_object_t *p_this ){ encoder_t *p_enc = (encoder_t *)p_this; encoder_sys_t *p_sys; int i_frequency; if( p_enc->fmt_out.i_codec != VLC_CODEC_MP2 && p_enc->fmt_out.i_codec != VLC_CODEC_MPGA && p_enc->fmt_out.i_codec != VLC_FOURCC( 'm', 'p', '2', 'a' ) && !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; } for ( i_frequency = 0; i_frequency < 6; i_frequency++ ) { if ( p_enc->fmt_out.audio.i_rate == mpa_freq_tab[i_frequency] ) break; } if ( i_frequency == 6 ) { msg_Err( p_enc, "MPEG audio doesn't support frequency=%d", p_enc->fmt_out.audio.i_rate ); 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 ) return VLC_ENOMEM; p_enc->p_sys = p_sys; p_enc->fmt_in.i_codec = VLC_CODEC_S16N; p_enc->fmt_out.i_cat = AUDIO_ES; p_enc->fmt_out.i_codec = VLC_CODEC_MPGA; config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); p_sys->p_twolame = twolame_init(); /* Set options */ twolame_set_in_samplerate( p_sys->p_twolame, p_enc->fmt_out.audio.i_rate ); twolame_set_out_samplerate( p_sys->p_twolame, p_enc->fmt_out.audio.i_rate ); if( var_GetBool( p_enc, ENC_CFG_PREFIX "vbr" ) ) { float f_quality = var_GetFloat( p_enc, ENC_CFG_PREFIX "quality" ); if ( f_quality > 50.f ) f_quality = 50.f; if ( f_quality < 0.f ) f_quality = 0.f; twolame_set_VBR( p_sys->p_twolame, 1 ); twolame_set_VBR_q( p_sys->p_twolame, f_quality ); } else { int i; for ( i = 1; i < 14; i++ ) { if ( p_enc->fmt_out.i_bitrate / 1000 <= mpa_bitrate_tab[i_frequency / 3][i] ) break; } if ( p_enc->fmt_out.i_bitrate / 1000 != mpa_bitrate_tab[i_frequency / 3][i] ) { msg_Warn( p_enc, "MPEG audio doesn't support bitrate=%d, using %d", p_enc->fmt_out.i_bitrate, mpa_bitrate_tab[i_frequency / 3][i] * 1000 ); p_enc->fmt_out.i_bitrate = mpa_bitrate_tab[i_frequency / 3][i] * 1000; } twolame_set_bitrate( p_sys->p_twolame, p_enc->fmt_out.i_bitrate / 1000 ); } if ( p_enc->fmt_in.audio.i_channels == 1 ) { twolame_set_num_channels( p_sys->p_twolame, 1 ); twolame_set_mode( p_sys->p_twolame, TWOLAME_MONO ); } else { twolame_set_num_channels( p_sys->p_twolame, 2 ); switch( var_GetInteger( p_enc, ENC_CFG_PREFIX "mode" ) ) { case 1: twolame_set_mode( p_sys->p_twolame, TWOLAME_DUAL_CHANNEL ); break; case 2: twolame_set_mode( p_sys->p_twolame, TWOLAME_JOINT_STEREO ); break; case 0: default: twolame_set_mode( p_sys->p_twolame, TWOLAME_STEREO );//.........这里部分代码省略.........
开发者ID:qdk0901,项目名称:vlc,代码行数:101,
示例2: Open/***************************************************************************** * Open: open the file *****************************************************************************/static int Open( vlc_object_t *p_this ){ sout_access_out_t *p_access = (sout_access_out_t*)p_this; int fd; config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg ); if( !p_access->psz_path ) { msg_Err( p_access, "no file name specified" ); return VLC_EGENERIC; } bool overwrite = var_GetBool (p_access, SOUT_CFG_PREFIX"overwrite"); bool append = var_GetBool( p_access, SOUT_CFG_PREFIX "append" ); if (!strcmp (p_access->psz_access, "fd")) { char *end; fd = strtol (p_access->psz_path, &end, 0); if (!*p_access->psz_path || *end) { msg_Err (p_access, "invalid file descriptor: %s", p_access->psz_path); return VLC_EGENERIC; } fd = vlc_dup (fd); if (fd == -1) { msg_Err (p_access, "cannot use file descriptor: %s", vlc_strerror_c(errno)); return VLC_EGENERIC; } } else if( !strcmp( p_access->psz_path, "-" ) ) {#if defined( _WIN32 ) || defined( __OS2__ ) setmode (STDOUT_FILENO, O_BINARY);#endif fd = vlc_dup (STDOUT_FILENO); if (fd == -1) { msg_Err (p_access, "cannot use standard output: %s", vlc_strerror_c(errno)); return VLC_EGENERIC; } msg_Dbg( p_access, "using stdout" ); } else { const char *path = p_access->psz_path; char *buf = NULL; if (var_InheritBool (p_access, SOUT_CFG_PREFIX"format")) { buf = str_format_time (path); path_sanitize (buf); path = buf; } int flags = O_RDWR | O_CREAT | O_LARGEFILE; if (!overwrite) flags |= O_EXCL; if (!append) flags |= O_TRUNC;#ifdef O_SYNC if (var_GetBool (p_access, SOUT_CFG_PREFIX"sync")) flags |= O_SYNC;#endif do { fd = vlc_open (path, flags, 0666); if (fd != -1) break; if (fd == -1) msg_Err (p_access, "cannot create %s: %s", path, vlc_strerror_c(errno)); if (overwrite || errno != EEXIST) break; flags &= ~O_EXCL; } while (vlc_dialog_wait_question (p_access, VLC_DIALOG_QUESTION_NORMAL, _("Keep existing file"), _("Overwrite"), NULL, path, _("The output file already exists. " "If recording continues, the file will be " "overridden and its content will be lost.")) == 1); free (buf); if (fd == -1) return VLC_EGENERIC; } struct stat st; if (fstat (fd, &st))//.........这里部分代码省略.........
开发者ID:42TheAnswerToLife,项目名称:vlc,代码行数:101,
示例3: vlc_savecancel/***************************************************************************** * EventThread: Create video window & handle its messages ***************************************************************************** * This function creates a video window and then enters an infinite loop * that handles the messages sent to that window. * The main goal of this thread is to isolate the Win32 PeekMessage function * because this one can block for a long time. *****************************************************************************/static void *EventThread( void *p_this ){ event_thread_t *p_event = (event_thread_t *)p_this; vout_display_t *vd = p_event->vd; MSG msg; POINT old_mouse_pos = {0,0}, mouse_pos; int canc = vlc_savecancel (); bool b_mouse_support = var_InheritBool( p_event->vd, "mouse-events" ); bool b_key_support = var_InheritBool( p_event->vd, "keyboard-events" ); vlc_mutex_lock( &p_event->lock ); /* Create a window for the video */ /* Creating a window under Windows also initializes the thread's event * message queue */ if( Win32VoutCreateWindow( p_event ) ) p_event->b_error = true; p_event->b_ready = true; vlc_cond_signal( &p_event->wait ); const bool b_error = p_event->b_error; vlc_mutex_unlock( &p_event->lock ); if( b_error ) { vlc_restorecancel( canc ); return NULL; } /* Prevent monitor from powering off */ if (var_GetBool(vd, "disable-screensaver")) SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); /* Main loop */ /* GetMessage will sleep if there's no message in the queue */ for( ;; ) { vout_display_place_t place; video_format_t source; if( !GetMessage( &msg, 0, 0, 0 ) ) { vlc_mutex_lock( &p_event->lock ); p_event->b_done = true; vlc_mutex_unlock( &p_event->lock ); break; } /* Check if we are asked to exit */ vlc_mutex_lock( &p_event->lock ); const bool b_done = p_event->b_done; vlc_mutex_unlock( &p_event->lock ); if( b_done ) break; if( !b_mouse_support && isMouseEvent( msg.message ) ) continue; if( !b_key_support && isKeyEvent( msg.message ) ) continue; /* Handle mouse state */ if( msg.message == WM_MOUSEMOVE || msg.message == WM_NCMOUSEMOVE ) { GetCursorPos( &mouse_pos ); /* FIXME, why this >2 limits ? */ if( (abs(mouse_pos.x - old_mouse_pos.x) > 2 || (abs(mouse_pos.y - old_mouse_pos.y)) > 2 ) ) { old_mouse_pos = mouse_pos; UpdateCursor( p_event, true ); } } else if( isMouseEvent( msg.message ) ) { UpdateCursor( p_event, true ); } else if( msg.message == WM_VLC_HIDE_MOUSE ) { UpdateCursor( p_event, false ); } /* */ switch( msg.message ) { case WM_MOUSEMOVE: vlc_mutex_lock( &p_event->lock ); place = p_event->place; source = p_event->source; vlc_mutex_unlock( &p_event->lock );//.........这里部分代码省略.........
开发者ID:839687571,项目名称:vlc-2.2.1.32-2013,代码行数:101,
示例4: 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 ); // update global variables pertaining to this input update_current_input(); // ensure the playtree is also updated // (highlights the new item to be played back) getPlaytreeVar().onUpdateCurrent( true ); } 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_CHAPTER: { vlc_value_t chapters_count; var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT, &chapters_count, NULL ); SET_BOOL( m_cVarDvdActive, chapters_count.i_int > 0 ); break; } case INPUT_EVENT_RECORD: SET_BOOL( m_cVarRecording, var_GetBool( pInput, "record" ) );//.........这里部分代码省略.........
开发者ID:jomanmuk,项目名称:vlc-2.2,代码行数:101,
示例5: switch//.........这里部分代码省略......... widget = advControls; } break; case REVERSE_BUTTON:{ QToolButton *reverseButton = new QToolButton; setupButton( reverseButton ); CONNECT_MAP_SET( reverseButton, REVERSE_ACTION ); BUTTON_SET_BAR( reverseButton ); reverseButton->setCheckable( true ); /* You should, of COURSE change this to the correct event, when/if we have one, that tells us if trickplay is possible . */ CONNECT( this, inputIsTrickPlayable( bool ), reverseButton, setVisible( bool ) ); reverseButton->setVisible( false ); widget = reverseButton; } break; case SKIP_BACK_BUTTON: { NORMAL_BUTTON( SKIP_BACK ); ENABLE_ON_INPUT( SKIP_BACKButton ); } break; case SKIP_FW_BUTTON: { NORMAL_BUTTON( SKIP_FW ); ENABLE_ON_INPUT( SKIP_FWButton ); } break; case QUIT_BUTTON: { NORMAL_BUTTON( QUIT ); } break; case RANDOM_BUTTON: { NORMAL_BUTTON( RANDOM ); RANDOMButton->setCheckable( true ); RANDOMButton->setChecked( var_GetBool( THEPL, "random" ) ); CONNECT( THEMIM, randomChanged( bool ), RANDOMButton, setChecked( bool ) ); } break; case LOOP_BUTTON:{ LoopButton *loopButton = new LoopButton; setupButton( loopButton ); loopButton->setToolTip( qtr( "Click to toggle between loop all, loop one and no loop") ); loopButton->setCheckable( true ); { int i_state = NORMAL; if( var_GetBool( THEPL, "loop" ) ) i_state = REPEAT_ALL; if( var_GetBool( THEPL, "repeat" ) ) i_state = REPEAT_ONE; loopButton->updateButtonIcons( i_state ); } CONNECT( THEMIM, repeatLoopChanged( int ), loopButton, updateButtonIcons( int ) ); CONNECT( loopButton, clicked(), THEMIM, loopRepeatLoopStatus() ); widget = loopButton; } break; case INFO_BUTTON: { NORMAL_BUTTON( INFO ); } break; case PLAYBACK_BUTTONS:{ widget = new QWidget; DeckButtonsLayout *layout = new DeckButtonsLayout( widget ); BrowseButton *prev = new BrowseButton( widget, BrowseButton::Backward ); BrowseButton *next = new BrowseButton( widget ); RoundButton *play = new RoundButton( widget ); layout->setBackwardButton( prev );
开发者ID:r1k,项目名称:vlc,代码行数:67,
示例6: libvlc_get_fullscreenint libvlc_get_fullscreen( libvlc_media_player_t *p_mi ){ return var_GetBool (p_mi, "fullscreen");}
开发者ID:FLYKingdom,项目名称:vlc-1,代码行数:4,
示例7: var_GetBoolvoid InputManager::UpdateProgramEvent(){ bool b_scrambled = var_GetBool( p_input, "program-scrambled" ); emit encryptionChanged( b_scrambled );}
开发者ID:DaemonSnake,项目名称:vlc,代码行数:5,
示例8: Open/***************************************************************************** * Open: open the file *****************************************************************************/static int Open( vlc_object_t *p_this ){ sout_access_out_t *p_access = (sout_access_out_t*)p_this; sout_access_out_sys_t *p_sys; char *psz_idx; config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg ); if( !p_access->psz_path ) { msg_Err( p_access, "no file name specified" ); return VLC_EGENERIC; } if( unlikely( !( p_sys = calloc ( 1, sizeof( *p_sys ) ) ) ) ) return VLC_ENOMEM; p_sys->i_seglen = var_GetInteger( p_access, SOUT_CFG_PREFIX "seglen" ); /* Try to get within asked segment length */ p_sys->i_seglenm = CLOCK_FREQ * p_sys->i_seglen; p_sys->block_buffer = NULL; p_sys->i_numsegs = var_GetInteger( p_access, SOUT_CFG_PREFIX "numsegs" ); p_sys->i_initial_segment = var_GetInteger( p_access, SOUT_CFG_PREFIX "initial-segment-number" ); p_sys->b_splitanywhere = var_GetBool( p_access, SOUT_CFG_PREFIX "splitanywhere" ); p_sys->b_delsegs = var_GetBool( p_access, SOUT_CFG_PREFIX "delsegs" ); p_sys->b_ratecontrol = var_GetBool( p_access, SOUT_CFG_PREFIX "ratecontrol") ; p_sys->b_caching = var_GetBool( p_access, SOUT_CFG_PREFIX "caching") ; p_sys->b_generate_iv = var_GetBool( p_access, SOUT_CFG_PREFIX "generate-iv") ; p_sys->segments_t = vlc_array_new(); p_sys->stuffing_size = 0; p_sys->i_opendts = VLC_TS_INVALID; p_sys->psz_indexPath = NULL; psz_idx = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index" ); if ( psz_idx ) { char *psz_tmp; psz_tmp = str_format_time( psz_idx ); free( psz_idx ); if ( !psz_tmp ) { free( p_sys ); return VLC_ENOMEM; } path_sanitize( psz_tmp ); p_sys->psz_indexPath = psz_tmp; vlc_unlink( p_sys->psz_indexPath ); } p_sys->psz_indexUrl = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index-url" ); p_sys->psz_keyfile = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "key-loadfile" ); p_sys->key_uri = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "key-uri" ); p_access->p_sys = p_sys; if( p_sys->psz_keyfile && ( LoadCryptFile( p_access ) < 0 ) ) { free( p_sys->psz_indexUrl ); free( p_sys->psz_indexPath ); free( p_sys ); msg_Err( p_access, "Encryption init failed" ); return VLC_EGENERIC; } else if( !p_sys->psz_keyfile && ( CryptSetup( p_access, NULL ) < 0 ) ) { free( p_sys->psz_indexUrl ); free( p_sys->psz_indexPath ); free( p_sys ); msg_Err( p_access, "Encryption init failed" ); return VLC_EGENERIC; } p_sys->i_handle = -1; p_sys->i_segment = p_sys->i_initial_segment > 0 ? p_sys->i_initial_segment -1 : 0; p_sys->psz_cursegPath = NULL; p_access->pf_write = Write; p_access->pf_seek = Seek; p_access->pf_control = Control; return VLC_SUCCESS;}
开发者ID:sun-friderick,项目名称:vlc-1,代码行数:88,
示例9: OpenFilter/***************************************************************************** * OpenFilter *****************************************************************************/static int OpenFilter( vlc_object_t *p_this ){ filter_t * p_filter = (filter_t *)p_this; filter_sys_t *p_sys = NULL; if( aout_FormatNbChannels( &(p_filter->fmt_in.audio) ) == 1 ) { /*msg_Dbg( p_filter, "filter discarded (incompatible format)" );*/ return VLC_EGENERIC; } if( (p_filter->fmt_in.i_codec != VLC_CODEC_S16N) || (p_filter->fmt_out.i_codec != VLC_CODEC_S16N) ) { /*msg_Err( p_this, "filter discarded (invalid format)" );*/ return VLC_EGENERIC; } if( (p_filter->fmt_in.audio.i_format != p_filter->fmt_out.audio.i_format) && (p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate) && (p_filter->fmt_in.audio.i_format != VLC_CODEC_S16N) && (p_filter->fmt_out.audio.i_format != VLC_CODEC_S16N) && (p_filter->fmt_in.audio.i_bitspersample != p_filter->fmt_out.audio.i_bitspersample)) { /*msg_Err( p_this, "couldn't load mono filter" );*/ return VLC_EGENERIC; } /* Allocate the memory needed to store the module's structure */ p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); if( p_sys == NULL ) return VLC_EGENERIC; var_Create( p_this, MONO_CFG "downmix", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); p_sys->b_downmix = var_GetBool( p_this, MONO_CFG "downmix" ); var_Create( p_this, MONO_CFG "channel", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); p_sys->i_channel_selected = (unsigned int) var_GetInteger( p_this, MONO_CFG "channel" ); if( p_sys->b_downmix ) { msg_Dbg( p_this, "using stereo to mono downmix" ); p_filter->fmt_out.audio.i_physical_channels = AOUT_CHAN_CENTER; p_filter->fmt_out.audio.i_channels = 1; } else { msg_Dbg( p_this, "using pseudo mono" ); p_filter->fmt_out.audio.i_physical_channels = (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT); p_filter->fmt_out.audio.i_channels = 2; } p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate; p_filter->fmt_out.audio.i_format = p_filter->fmt_out.i_codec; p_sys->i_nb_channels = aout_FormatNbChannels( &(p_filter->fmt_in.audio) ); p_sys->i_bitspersample = p_filter->fmt_out.audio.i_bitspersample; p_sys->i_overflow_buffer_size = 0; p_sys->p_overflow_buffer = NULL; p_sys->i_nb_atomic_operations = 0; p_sys->p_atomic_operations = NULL; if( Init( VLC_OBJECT(p_filter), p_filter->p_sys, aout_FormatNbChannels( &p_filter->fmt_in.audio ), p_filter->fmt_in.audio.i_physical_channels, p_filter->fmt_in.audio.i_rate ) < 0 ) { var_Destroy( p_this, MONO_CFG "channel" ); var_Destroy( p_this, MONO_CFG "downmix" ); free( p_sys ); return VLC_EGENERIC; } p_filter->pf_audio_filter = Convert; msg_Dbg( p_this, "%4.4s->%4.4s, channels %d->%d, bits per sample: %i->%i", (char *)&p_filter->fmt_in.i_codec, (char *)&p_filter->fmt_out.i_codec, p_filter->fmt_in.audio.i_physical_channels, p_filter->fmt_out.audio.i_physical_channels, p_filter->fmt_in.audio.i_bitspersample, p_filter->fmt_out.audio.i_bitspersample ); return VLC_SUCCESS;}
开发者ID:Kafay,项目名称:vlc,代码行数:94,
示例10: VoutWriteSnapshot/** * This function will save a video snapshot to a file */static int VoutWriteSnapshot( vout_thread_t *p_vout, char **ppsz_filename, const block_t *p_image, const char *psz_path, const char *psz_format, const char *psz_prefix_fmt ){ /* */ char *psz_filename; DIR *p_path = utf8_opendir( psz_path ); if( p_path != NULL ) { /* The use specified a directory path */ closedir( p_path ); /* */ char *psz_prefix = NULL; if( psz_prefix_fmt ) psz_prefix = str_format( p_vout, psz_prefix_fmt ); if( !psz_prefix ) { psz_prefix = strdup( "vlcsnap-" ); if( !psz_prefix ) goto error; } if( var_GetBool( p_vout, "snapshot-sequential" ) ) { int i_num = var_GetInteger( p_vout, "snapshot-num" ); for( ; ; i_num++ ) { struct stat st; if( asprintf( &psz_filename, "%s" DIR_SEP "%s%05d.%s", psz_path, psz_prefix, i_num++, psz_format ) < 0 ) { free( psz_prefix ); goto error; } if( utf8_stat( psz_filename, &st ) ) break; free( psz_filename ); } var_SetInteger( p_vout, "snapshot-num", i_num ); } else { struct tm curtime; time_t lcurtime = time( NULL ) ; if( !localtime_r( &lcurtime, &curtime ) ) { const unsigned int i_id = (p_image->i_pts / 100000) & 0xFFFFFF; msg_Warn( p_vout, "failed to get current time. Falling back to legacy snapshot naming" ); if( asprintf( &psz_filename, "%s" DIR_SEP "%s%u.%s", psz_path, psz_prefix, i_id, psz_format ) < 0 ) psz_filename = NULL; } else { /* suffix with the last decimal digit in 10s of seconds resolution * FIXME gni ? */ const int i_id = (p_image->i_pts / (100*1000)) & 0xFF; char psz_curtime[128]; if( !strftime( psz_curtime, sizeof(psz_curtime), "%Y-%m-%d-%Hh%Mm%Ss", &curtime ) ) strcpy( psz_curtime, "error" ); if( asprintf( &psz_filename, "%s" DIR_SEP "%s%s%1u.%s", psz_path, psz_prefix, psz_curtime, i_id, psz_format ) < 0 ) psz_filename = NULL; } } free( psz_prefix ); } else { /* The user specified a full path name (including file name) */ psz_filename = str_format( p_vout, psz_path ); path_sanitize( psz_filename ); } if( !psz_filename ) goto error; /* Save the snapshot */ FILE *p_file = utf8_fopen( psz_filename, "wb" ); if( !p_file ) { msg_Err( p_vout, "Failed to open '%s'", psz_filename ); free( psz_filename ); goto error; } if( fwrite( p_image->p_buffer, p_image->i_buffer, 1, p_file ) != 1 ) {//.........这里部分代码省略.........
开发者ID:MisTelochka,项目名称:vlc,代码行数:101,
示例11: 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; int i_quality, i_min_bitrate, i_max_bitrate; ogg_packet header[3]; if( p_enc->fmt_out.i_codec != VLC_CODEC_VORBIS && !p_enc->b_force ) { 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 ) return VLC_ENOMEM; p_enc->p_sys = p_sys; p_enc->pf_encode_audio = Encode; p_enc->fmt_in.i_codec = VLC_CODEC_FL32; p_enc->fmt_out.i_codec = VLC_CODEC_VORBIS; config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); i_quality = var_GetInteger( p_enc, ENC_CFG_PREFIX "quality" ); if( i_quality > 10 ) i_quality = 10; if( i_quality < 0 ) i_quality = 0; if( var_GetBool( p_enc, ENC_CFG_PREFIX "cbr" ) ) i_quality = 0; i_max_bitrate = var_GetInteger( p_enc, ENC_CFG_PREFIX "max-bitrate" ); i_min_bitrate = var_GetInteger( p_enc, ENC_CFG_PREFIX "min-bitrate" ); /* Initialize vorbis encoder */ vorbis_info_init( &p_sys->vi ); if( i_quality > 0 ) { /* VBR mode */ if( vorbis_encode_setup_vbr( &p_sys->vi, p_enc->fmt_in.audio.i_channels, p_enc->fmt_in.audio.i_rate, i_quality * 0.1 ) ) { vorbis_info_clear( &p_sys->vi ); free( p_enc->p_sys ); msg_Err( p_enc, "VBR mode initialisation failed" ); return VLC_EGENERIC; } /* Do we have optional hard quality restrictions? */ if( i_max_bitrate > 0 || i_min_bitrate > 0 ) { struct ovectl_ratemanage_arg ai; vorbis_encode_ctl( &p_sys->vi, OV_ECTL_RATEMANAGE_GET, &ai ); ai.bitrate_hard_min = i_min_bitrate; ai.bitrate_hard_max = i_max_bitrate; ai.management_active = 1; vorbis_encode_ctl( &p_sys->vi, OV_ECTL_RATEMANAGE_SET, &ai ); } else { /* Turn off management entirely */ vorbis_encode_ctl( &p_sys->vi, OV_ECTL_RATEMANAGE_SET, NULL ); } } else { if( vorbis_encode_setup_managed( &p_sys->vi, p_enc->fmt_in.audio.i_channels, p_enc->fmt_in.audio.i_rate, i_min_bitrate > 0 ? i_min_bitrate * 1000: -1, p_enc->fmt_out.i_bitrate, i_max_bitrate > 0 ? i_max_bitrate * 1000: -1 ) ) { vorbis_info_clear( &p_sys->vi ); msg_Err( p_enc, "CBR mode initialisation failed" ); free( p_enc->p_sys ); return VLC_EGENERIC; } } vorbis_encode_setup_init( &p_sys->vi ); /* Add a comment */ vorbis_comment_init( &p_sys->vc); vorbis_comment_add_tag( &p_sys->vc, "ENCODER", "VLC media player"); /* Set up the analysis state and auxiliary encoding storage */ vorbis_analysis_init( &p_sys->vd, &p_sys->vi ); vorbis_block_init( &p_sys->vd, &p_sys->vb ); /* Create and store headers */ vorbis_analysis_headerout( &p_sys->vd, &p_sys->vc, &header[0], &header[1], &header[2]); for( int i = 0; i < 3; i++ ) {//.........这里部分代码省略.........
开发者ID:371816210,项目名称:vlc_vlc,代码行数:101,
示例12: vout_IntfInit//.........这里部分代码省略......... vlc_ureduce( &i_aspect_num, &i_aspect_den, i_aspect *VOUT_ASPECT_FACTOR, VOUT_ASPECT_FACTOR, 0 ); } if( !i_aspect_num || !i_aspect_den ) i_aspect_num = i_aspect_den = 1; p_vout->p->i_par_num = i_aspect_num; p_vout->p->i_par_den = i_aspect_den; vlc_ureduce( &p_vout->p->i_par_num, &p_vout->p->i_par_den, p_vout->p->i_par_num, p_vout->p->i_par_den, 0 ); msg_Dbg( p_vout, "overriding monitor pixel aspect-ratio: %i:%i", p_vout->p->i_par_num, p_vout->p->i_par_den ); b_force_par = true; } free( val.psz_string ); /* Aspect-ratio object var */ var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_ISCOMMAND | VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT ); text.psz_string = _("Aspect-ratio"); var_Change( p_vout, "aspect-ratio", VLC_VAR_SETTEXT, &text, NULL ); val.psz_string = (char*)""; var_Change( p_vout, "aspect-ratio", VLC_VAR_DELCHOICE, &val, 0 ); for( i = 0; p_aspect_ratio_values[i].psz_value; i++ ) { val.psz_string = (char*)p_aspect_ratio_values[i].psz_value; text.psz_string = _( p_aspect_ratio_values[i].psz_label ); var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text ); } /* Add custom aspect ratios */ psz_buf = config_GetPsz( p_vout, "custom-aspect-ratios" ); AddCustomRatios( p_vout, "aspect-ratio", psz_buf ); free( psz_buf ); var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL ); var_Get( p_vout, "aspect-ratio", &old_val ); if( (old_val.psz_string && *old_val.psz_string) || b_force_par ) var_TriggerCallback( p_vout, "aspect-ratio" ); free( old_val.psz_string ); /* Add variables to manage scaling video */ var_Create( p_vout, "autoscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); text.psz_string = _("Autoscale video"); var_Change( p_vout, "autoscale", VLC_VAR_SETTEXT, &text, NULL ); var_AddCallback( p_vout, "autoscale", ScalingCallback, NULL ); p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" ); var_Create( p_vout, "scale", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); text.psz_string = _("Scale factor"); var_Change( p_vout, "scale", VLC_VAR_SETTEXT, &text, NULL ); var_AddCallback( p_vout, "scale", ScalingCallback, NULL ); p_vout->i_zoom = (int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) ); /* Initialize the dimensions of the video window */ InitWindowSize( p_vout, &p_vout->i_window_width, &p_vout->i_window_height ); /* Add a variable to indicate if the window should be on top of others */ var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); text.psz_string = _("Always on top"); var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL ); var_AddCallback( p_vout, "video-on-top", OnTopCallback, NULL ); /* Add a variable to indicate whether we want window decoration or not */ var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); /* Add a fullscreen variable */ if( var_CreateGetBoolCommand( p_vout, "fullscreen" ) ) { /* user requested fullscreen */ p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; } text.psz_string = _("Fullscreen"); var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, &text, NULL ); var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL ); /* Add a snapshot variable */ var_Create( p_vout, "video-snapshot", VLC_VAR_VOID | VLC_VAR_ISCOMMAND ); text.psz_string = _("Snapshot"); var_Change( p_vout, "video-snapshot", VLC_VAR_SETTEXT, &text, NULL ); var_AddCallback( p_vout, "video-snapshot", SnapshotCallback, NULL ); /* Mouse coordinates */ var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER ); var_Create( p_vout, "mouse-y", VLC_VAR_INTEGER ); var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER ); var_Create( p_vout, "mouse-moved", VLC_VAR_BOOL ); var_Create( p_vout, "mouse-clicked", VLC_VAR_BOOL ); var_Create( p_vout, "intf-change", VLC_VAR_BOOL ); var_SetBool( p_vout, "intf-change", true );}
开发者ID:MisTelochka,项目名称:vlc,代码行数:101,
示例13: Open//.........这里部分代码省略......... p_sys->psz_af = NULL; free( psz_string ); /* Video transcoding parameters */ psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "venc" ); p_sys->psz_venc = NULL; p_sys->p_video_cfg = NULL; if( psz_string && *psz_string ) { char *psz_next; psz_next = config_ChainCreate( &p_sys->psz_venc, &p_sys->p_video_cfg, psz_string ); free( psz_next ); } free( psz_string ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vcodec" ); p_sys->i_vcodec = 0; if( psz_string && *psz_string ) { char fcc[/*4*/] = " "; // sunqueen modify memcpy( fcc, psz_string, __MIN( strlen( psz_string ), 4 ) ); p_sys->i_vcodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] ); } free( psz_string ); p_sys->i_vbitrate = var_GetInteger( p_stream, SOUT_CFG_PREFIX "vb" ); if( p_sys->i_vbitrate < 16000 ) p_sys->i_vbitrate *= 1000; p_sys->f_scale = var_GetFloat( p_stream, SOUT_CFG_PREFIX "scale" ); p_sys->f_fps = var_GetFloat( p_stream, SOUT_CFG_PREFIX "fps" ); p_sys->b_hurry_up = var_GetBool( p_stream, SOUT_CFG_PREFIX "hurry-up" ); p_sys->i_width = var_GetInteger( p_stream, SOUT_CFG_PREFIX "width" ); p_sys->i_height = var_GetInteger( p_stream, SOUT_CFG_PREFIX "height" ); p_sys->i_maxwidth = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxwidth" ); p_sys->i_maxheight = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxheight" ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vfilter" ); if( psz_string && *psz_string ) p_sys->psz_vf2 = strdup(psz_string ); else p_sys->psz_vf2 = NULL; free( psz_string ); p_sys->b_deinterlace = var_GetBool( p_stream, SOUT_CFG_PREFIX "deinterlace" ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "deinterlace-module" ); p_sys->psz_deinterlace = NULL; p_sys->p_deinterlace_cfg = NULL; if( psz_string && *psz_string ) { char *psz_next; psz_next = config_ChainCreate( &p_sys->psz_deinterlace, &p_sys->p_deinterlace_cfg, psz_string ); free( psz_next ); } free( psz_string ); p_sys->i_threads = var_GetInteger( p_stream, SOUT_CFG_PREFIX "threads" );
开发者ID:WutongEdward,项目名称:vlc-2.1.4.32.subproject-2013,代码行数:67,
示例14: 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; char *psz_mux, *psz_access, *psz_url; sout_access_out_t *p_access; int ret = VLC_EGENERIC; config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); psz_mux = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "mux" ); psz_access = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "access" ); if( !psz_access ) psz_access = strdup(p_stream->psz_name); psz_url = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "dst" ); if (!psz_url) { char *psz_bind = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "bind" ); if( psz_bind ) { char *psz_path = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "path" ); if( psz_path ) { if( asprintf( &psz_url, "%s/%s", psz_bind, psz_path ) == -1 ) psz_url = NULL; free(psz_bind); free( psz_path ); } else psz_url = psz_bind; } } p_sys = p_stream->p_sys = malloc( sizeof( sout_stream_sys_t) ); if( !p_sys ) { ret = VLC_ENOMEM; goto end; } p_sys->p_session = NULL; if( fixAccessMux( p_stream, &psz_mux, &psz_access, psz_url ) ) goto end; checkAccessMux( p_stream, psz_access, psz_mux ); p_access = sout_AccessOutNew( p_stream, psz_access, psz_url ); if( p_access == NULL ) { msg_Err( p_stream, "no suitable sout access module for `%s/%s://%s'", psz_access, psz_mux, psz_url ); goto end; } p_sys->p_mux = sout_MuxNew( p_stream->p_sout, psz_mux, p_access ); if( !p_sys->p_mux ) { const char *psz_mux_guess = getMuxFromAlias( psz_mux ); if( psz_mux_guess && strcmp( psz_mux_guess, psz_mux ) ) { msg_Dbg( p_stream, "Couldn't open mux `%s', trying `%s' instead", psz_mux, psz_mux_guess ); p_sys->p_mux = sout_MuxNew( p_stream->p_sout, psz_mux_guess, p_access ); } if( !p_sys->p_mux ) { msg_Err( p_stream, "no suitable sout mux module for `%s/%s://%s'", psz_access, psz_mux, psz_url ); sout_AccessOutDelete( p_access ); goto end; } } if( var_GetBool( p_stream, SOUT_CFG_PREFIX"sap" ) ) create_SDP( p_stream, p_access ); p_stream->pf_add = Add; p_stream->pf_del = Del; p_stream->pf_send = Send; p_stream->pf_flush = Flush; if( !sout_AccessOutCanControlPace( p_access ) ) p_stream->pace_nocontrol = true; ret = VLC_SUCCESS; msg_Dbg( p_this, "using `%s/%s://%s'", psz_access, psz_mux, psz_url );end: if( ret != VLC_SUCCESS ) free( p_sys ); free( psz_access ); free( psz_mux );//.........这里部分代码省略.........
开发者ID:0xheart0,项目名称:vlc,代码行数:101,
示例15: HandleCadMessagestatic LRESULT HandleCadMessage(intf_thread_t* p_intf, HWND hwnd, WPARAM wParam, LPARAM lParam){ intf_sys_t* const p_sys = p_intf->p_sys; switch (lParam) { case IPC_PLAY: { playlist_Play(pl_Get(p_intf->p_libvlc)); return 1; } case IPC_PLAYPAUSE: { playlist_t* p_playlist = pl_Get(p_intf->p_libvlc); const bool playing = playlist_Status(p_playlist) == PLAYLIST_RUNNING; playlist_Control(p_playlist, playing ? PLAYLIST_PAUSE : PLAYLIST_PLAY, pl_Unlocked); return 1; } case IPC_PAUSE: { playlist_Pause(pl_Get(p_intf->p_libvlc)); return 1; } case IPC_STOP: { playlist_Stop(pl_Get(p_intf->p_libvlc)); return 1; } case IPC_NEXT: { playlist_Next(pl_Get(p_intf->p_libvlc)); return 1; } case IPC_PREVIOUS: { playlist_Prev(pl_Get(p_intf->p_libvlc)); return 1; } case IPC_SET_VOLUME: { playlist_VolumeSet(pl_Get(p_intf->p_libvlc), (int)wParam / 100.0f); return 1; } case IPC_GET_VOLUME: { // VLC can return a volume larger than 100% so we need to cap it to 100 here. const float volume = playlist_VolumeGet(pl_Get(p_intf->p_libvlc)) * 100.0f; return (LRESULT)min(volume, 100.0f); } case IPC_GET_DURATION: { unsigned int duration = 0; if (p_sys->p_input) { input_item_t* const p_item = input_GetItem(p_sys->p_input); duration = (unsigned int)(input_item_GetDuration(p_item) / 1000000); } return duration; } case IPC_GET_POSITION: { int pos = 0; if (p_sys->p_input) { pos = (int)(var_GetTime(p_sys->p_input, "time") / CLOCK_FREQ); } return pos; } case IPC_SET_POSITION: { if (p_sys->p_input) { var_SetTime(p_sys->p_input, "time", (int64_t)wParam * CLOCK_FREQ); } return 0; } case IPC_GET_SHUFFLE: { return (int)var_GetBool(pl_Get(p_intf->p_libvlc), "random"); } case IPC_SET_SHUFFLE: { return (int)var_SetBool(pl_Get(p_intf->p_libvlc), "random", (bool)wParam); } case IPC_GET_REPEAT: { return (int)var_GetBool(pl_Get(p_intf->p_libvlc), "repeat");//.........这里部分代码省略.........
开发者ID:poiru,项目名称:vlc-libcad,代码行数:101,
示例16: assert//.........这里部分代码省略......... 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: { aout_instance_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 ) { var_DelCallback( m_pAout, "equalizer-bands", onEqBandsChange, this ); var_DelCallback( m_pAout, "equalizer-preamp", onEqPreampChange, this ); } vlc_object_release( m_pAout ); m_pAout = NULL; m_bEqualizer_started = false; } // New Aout (addCallbacks) var_AddCallback( pAout, "audio-filter", onGenericCallback, this ); char *pFilters = var_GetNonEmptyString( pAout, "audio-filter" ); bool b_equalizer = pFilters && strstr( pFilters, "equalizer" ); free( pFilters ); SET_BOOL( m_cVarEqualizer, b_equalizer ); if( b_equalizer ) { var_AddCallback( pAout, "equalizer-bands", onEqBandsChange, this ); var_AddCallback( pAout, "equalizer-preamp", onEqPreampChange, this ); m_bEqualizer_started = true; } m_pAout = pAout; break; } case INPUT_EVENT_CHAPTER: { vlc_value_t chapters_count; var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT, &chapters_count, NULL ); SET_BOOL( m_cVarDvdActive, chapters_count.i_int > 0 ); break; } case INPUT_EVENT_RECORD: SET_BOOL( m_cVarRecording, var_GetBool( pInput, "record" ) ); break; case INPUT_EVENT_DEAD: msg_Dbg( getIntf(), "end of input detected for %p", pInput ); var_DelCallback( pInput, "intf-event", onGenericCallback2, this ); var_DelCallback( pInput, "bit-rate", onGenericCallback, this ); var_DelCallback( pInput, "sample-rate", onGenericCallback, this ); var_DelCallback( pInput, "can-record" , onGenericCallback, this ); vlc_object_release( pInput ); getIntf()->p_sys->p_input = NULL; reset_input(); break; default: break; }}
开发者ID:iamnpc,项目名称:myfaplayer,代码行数:101,
示例17: recordingStateChangedvoid InputManager::UpdateRecord(){ emit recordingStateChanged( var_GetBool( p_input, "record" ) );}
开发者ID:DaemonSnake,项目名称:vlc,代码行数:4,
示例18: SET_BOOLvoid VlcProc::on_loop_changed( vlc_object_t* p_obj, vlc_value_t newVal ){ playlist_t* pPlaylist = (playlist_t*) p_obj; SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );}
开发者ID:iamnpc,项目名称:myfaplayer,代码行数:6,
示例19: input_item_add_subitem_treestatic void input_item_add_subitem_tree ( const vlc_event_t * p_event, void * user_data ){ input_item_t *p_input = p_event->p_obj; playlist_t *p_playlist = (( playlist_item_t* ) user_data)->p_playlist; input_item_node_t *p_new_root = p_event->u.input_item_subitem_tree_added.p_root; PL_LOCK; playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input ); assert( p_item != NULL ); bool b_current = get_current_status_item( p_playlist ) == p_item; bool b_autostart = var_GetBool( p_playlist, "playlist-autostart" ); bool b_stop = p_item->i_flags & PLAYLIST_SUBITEM_STOP_FLAG; bool b_flat = false; p_item->i_flags &= ~PLAYLIST_SUBITEM_STOP_FLAG; /* We will have to flatten the tree out if we are in "the playlist" node and the user setting demands flat playlist */ if( !pl_priv(p_playlist)->b_tree ) { playlist_item_t *p_up = p_item; while( p_up->p_parent ) { if( p_up->p_parent == p_playlist->p_playing ) { b_flat = true; break; } p_up = p_up->p_parent; } } int pos = 0; /* If we have to flatten out, then take the item's position in the parent as insertion point and delete the item */ if( b_flat ) { playlist_item_t *p_parent = p_item->p_parent; assert( p_parent != NULL ); int i; for( i = 0; i < p_parent->i_children; i++ ) { if( p_parent->pp_children[i] == p_item ) { pos = i; break; } } assert( i < p_parent->i_children ); playlist_DeleteItem( p_playlist, p_item, true ); p_item = p_parent; } else { pos = p_item->i_children >= 0 ? p_item->i_children : 0; } /* At this point: "p_item" is the node where sub-items should be inserted, "pos" is the insertion position in that node */ int last_pos = playlist_InsertInputItemTree( p_playlist, p_item, p_new_root, pos, b_flat ); if( !b_flat ) var_SetInteger( p_playlist, "leaf-to-parent", p_item->i_id ); //control playback only if it was the current playing item that got subitems if( b_current ) { if( last_pos == pos || ( b_stop && !b_flat ) || !b_autostart ) { /* We stop, either because no sub-item was actually created, or some flags/settings want us to do so at this point */ PL_UNLOCK; playlist_Stop( p_playlist ); return; } else { /* Continue to play, either random or the first new item */ playlist_item_t *p_play_item; if( var_GetBool( p_playlist, "random" ) ) { unsigned rand_pos = ((unsigned)vlc_mrand48()) % (last_pos - pos); rand_pos += pos;//.........这里部分代码省略.........
开发者ID:Annovae,项目名称:vlc,代码行数:101,
示例20: Open//.........这里部分代码省略......... psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vcodec" ); p_sys->i_vcodec = 0; if( psz_string && *psz_string ) { char fcc[5] = " /0"; memcpy( fcc, psz_string, __MIN( strlen( psz_string ), 4 ) ); p_sys->i_vcodec = vlc_fourcc_GetCodecFromString( VIDEO_ES, fcc ); msg_Dbg( p_stream, "Checking video codec mapping for %s got %4.4s ", fcc, (char*)&p_sys->i_vcodec); } free( psz_string ); p_sys->i_vbitrate = var_GetInteger( p_stream, SOUT_CFG_PREFIX "vb" ); if( p_sys->i_vbitrate < 16000 ) p_sys->i_vbitrate *= 1000; p_sys->f_scale = var_GetFloat( p_stream, SOUT_CFG_PREFIX "scale" ); p_sys->b_master_sync = var_InheritURational( p_stream, &p_sys->fps_num, &p_sys->fps_den, SOUT_CFG_PREFIX "fps" ) == VLC_SUCCESS; p_sys->i_width = var_GetInteger( p_stream, SOUT_CFG_PREFIX "width" ); p_sys->i_height = var_GetInteger( p_stream, SOUT_CFG_PREFIX "height" ); p_sys->i_maxwidth = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxwidth" ); p_sys->i_maxheight = var_GetInteger( p_stream, SOUT_CFG_PREFIX "maxheight" ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "vfilter" ); if( psz_string && *psz_string ) p_sys->psz_vf2 = strdup(psz_string ); else p_sys->psz_vf2 = NULL; free( psz_string ); p_sys->b_deinterlace = var_GetBool( p_stream, SOUT_CFG_PREFIX "deinterlace" ); psz_string = var_GetString( p_stream, SOUT_CFG_PREFIX "deinterlace-module" ); p_sys->psz_deinterlace = NULL; p_sys->p_deinterlace_cfg = NULL; if( psz_string && *psz_string ) { char *psz_next; psz_next = config_ChainCreate( &p_sys->psz_deinterlace, &p_sys->p_deinterlace_cfg, psz_string ); free( psz_next ); } free( psz_string ); p_sys->i_threads = var_GetInteger( p_stream, SOUT_CFG_PREFIX "threads" ); p_sys->b_high_priority = var_GetBool( p_stream, SOUT_CFG_PREFIX "high-priority" ); if( p_sys->i_vcodec ) { msg_Dbg( p_stream, "codec video=%4.4s %dx%d scaling: %f %dkb/s", (char *)&p_sys->i_vcodec, p_sys->i_width, p_sys->i_height, p_sys->f_scale, p_sys->i_vbitrate / 1000 ); } /* Disable hardware decoding by default (unlike normal playback) */ psz_string = var_CreateGetString( p_stream, "avcodec-hw" ); if( !strcasecmp( "any", psz_string ) ) var_SetString( p_stream, "avcodec-hw", "none" ); free( psz_string ); /* Subpictures transcoding parameters */ p_sys->p_spu = NULL;
开发者ID:maniacs-m,项目名称:vlc,代码行数:67,
示例21: osd_isVisiblestatic inline bool osd_isVisible( osd_menu_t *p_osd ){ return var_GetBool( p_osd, "osd-menu-visible" );}
开发者ID:LDiracDelta,项目名称:vlc_censor_plugin,代码行数:4,
示例22: Open/***************************************************************************** * Open: open the file *****************************************************************************/static int Open( vlc_object_t *p_this ){ sout_access_out_t *p_access = (sout_access_out_t*)p_this; int fd; config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg ); if( !p_access->psz_path ) { msg_Err( p_access, "no file name specified" ); return VLC_EGENERIC; } bool append = var_GetBool( p_access, SOUT_CFG_PREFIX "append" ); if (!strcmp (p_access->psz_access, "fd")) { char *end; fd = strtol (p_access->psz_path, &end, 0); if (!*p_access->psz_path || *end) { msg_Err (p_access, "invalid file descriptor: %s", p_access->psz_path); return VLC_EGENERIC; } fd = vlc_dup (fd); if (fd == -1) { msg_Err (p_access, "cannot use file descriptor: %m"); return VLC_EGENERIC; } }#ifndef UNDER_CE else if( !strcmp( p_access->psz_path, "-" ) ) {#ifdef WIN32 setmode (fileno (stdout), O_BINARY);#endif fd = vlc_dup (fileno (stdout)); if (fd == -1) { msg_Err (p_access, "cannot use standard output: %m"); return VLC_EGENERIC; } msg_Dbg( p_access, "using stdout" ); }#endif else { char *psz_tmp = str_format( p_access, p_access->psz_path ); path_sanitize( psz_tmp ); fd = vlc_open( psz_tmp, O_RDWR | O_CREAT | O_LARGEFILE |#ifdef O_SYNC (var_GetBool( p_access, SOUT_CFG_PREFIX "sync" ) ? O_SYNC : 0) |#endif (append ? 0 : O_TRUNC), 0666 ); free( psz_tmp ); if (fd == -1) { msg_Err (p_access, "cannot create %s: %m", p_access->psz_path); return VLC_EGENERIC; } } p_access->pf_write = Write; p_access->pf_read = Read; p_access->pf_seek = Seek; p_access->pf_control = Control; p_access->p_sys = (void *)(intptr_t)fd; msg_Dbg( p_access, "file access output opened (%s)", p_access->psz_path ); if (append) lseek (fd, 0, SEEK_END); return VLC_SUCCESS;}
开发者ID:banketree,项目名称:faplayer,代码行数:82,
示例23: pl_priv/** * Compute the next playlist item depending on * the playlist course mode (forward, backward, random, view,...). * * /param p_playlist the playlist object * /return nothing */static playlist_item_t *NextItem( playlist_t *p_playlist ){ playlist_private_t *p_sys = pl_priv(p_playlist); playlist_item_t *p_new = NULL; /* Handle quickly a few special cases */ /* No items to play */ if( p_playlist->items.i_size == 0 ) { msg_Info( p_playlist, "playlist is empty" ); return NULL; } /* Start the real work */ if( p_sys->request.b_request ) { p_new = p_sys->request.p_item; int i_skip = p_sys->request.i_skip; PL_DEBUG( "processing request item: %s, node: %s, skip: %i", PLI_NAME( p_sys->request.p_item ), PLI_NAME( p_sys->request.p_node ), i_skip ); if( p_sys->request.p_node && p_sys->request.p_node != get_current_status_node( p_playlist ) ) { set_current_status_node( p_playlist, p_sys->request.p_node ); p_sys->request.p_node = NULL; p_sys->b_reset_currently_playing = true; } /* If we are asked for a node, go to it's first child */ if( i_skip == 0 && ( p_new == NULL || p_new->i_children != -1 ) ) { i_skip++; if( p_new != NULL ) { p_new = playlist_GetNextLeaf( p_playlist, p_new, NULL, true, false ); for( int i = 0; i < p_playlist->current.i_size; i++ ) { if( p_new == ARRAY_VAL( p_playlist->current, i ) ) { p_playlist->i_current_index = i; i_skip = 0; } } } } if( p_sys->b_reset_currently_playing ) /* A bit too bad to reset twice ... */ ResetCurrentlyPlaying( p_playlist, p_new ); else if( p_new ) ResyncCurrentIndex( p_playlist, p_new ); else p_playlist->i_current_index = -1; if( p_playlist->current.i_size && (i_skip > 0) ) { if( p_playlist->i_current_index < -1 ) p_playlist->i_current_index = -1; for( int i = i_skip; i > 0 ; i-- ) { p_playlist->i_current_index++; if( p_playlist->i_current_index >= p_playlist->current.i_size ) { PL_DEBUG( "looping - restarting at beginning of node" ); /* reshuffle playlist when end is reached */ if( var_GetBool( p_playlist, "random" ) ) { PL_DEBUG( "reshuffle playlist" ); ResetCurrentlyPlaying( p_playlist, get_current_status_item( p_playlist ) ); } p_playlist->i_current_index = 0; } } p_new = ARRAY_VAL( p_playlist->current, p_playlist->i_current_index ); } else if( p_playlist->current.i_size && (i_skip < 0) ) { for( int i = i_skip; i < 0 ; i++ ) { p_playlist->i_current_index--; if( p_playlist->i_current_index <= -1 ) { PL_DEBUG( "looping - restarting at end of node" ); /* reshuffle playlist when beginning is reached */ if( var_GetBool( p_playlist, "random" ) ) { PL_DEBUG( "reshuffle playlist" ); ResetCurrentlyPlaying( p_playlist, get_current_status_item( p_playlist ) ); }//.........这里部分代码省略.........
开发者ID:2011fuzhou,项目名称:vlc-2.1.2.32-2010,代码行数:101,
示例24: FrontendOpen/***************************************************************************** * FrontendOpen : Determine frontend device information and capabilities *****************************************************************************/int FrontendOpen( access_t *p_access ){ access_sys_t *p_sys = p_access->p_sys; frontend_t * p_frontend; unsigned int i_adapter, i_device; bool b_probe; char frontend[128]; i_adapter = var_GetInteger( p_access, "dvb-adapter" ); i_device = var_GetInteger( p_access, "dvb-device" ); b_probe = var_GetBool( p_access, "dvb-probe" ); if( snprintf( frontend, sizeof(frontend), FRONTEND, i_adapter, i_device ) >= (int)sizeof(frontend) ) { msg_Err( p_access, "snprintf() truncated string for FRONTEND" ); frontend[sizeof(frontend) - 1] = '/0'; } p_sys->p_frontend = p_frontend = malloc( sizeof(frontend_t) ); if( !p_frontend ) return VLC_ENOMEM; msg_Dbg( p_access, "Opening device %s", frontend ); if( (p_sys->i_frontend_handle = vlc_open(frontend, O_RDWR | O_NONBLOCK)) < 0 ) { msg_Err( p_access, "FrontEndOpen: opening device failed (%m)" ); free( p_frontend ); return VLC_EGENERIC; } if( b_probe ) { const char * psz_expected = NULL; const char * psz_real; if( FrontendInfo( p_access ) < 0 ) { close( p_sys->i_frontend_handle ); free( p_frontend ); return VLC_EGENERIC; } switch( p_frontend->info.type ) { case FE_OFDM: psz_real = "DVB-T"; break; case FE_QAM: psz_real = "DVB-C"; break; case FE_QPSK: psz_real = "DVB-S"; break; case FE_ATSC: psz_real = "ATSC"; break; default: psz_real = "unknown"; } /* Sanity checks */ if( (!strncmp( p_access->psz_access, "qpsk", 4 ) || !strncmp( p_access->psz_access, "dvb-s", 5 ) || !strncmp( p_access->psz_access, "satellite", 9 ) ) && (p_frontend->info.type != FE_QPSK) ) { psz_expected = "DVB-S"; } if( (!strncmp( p_access->psz_access, "cable", 5 ) || !strncmp( p_access->psz_access, "dvb-c", 5 ) ) && (p_frontend->info.type != FE_QAM) ) { psz_expected = "DVB-C"; } if( (!strncmp( p_access->psz_access, "terrestrial", 11 ) || !strncmp( p_access->psz_access, "dvb-t", 5 ) ) && (p_frontend->info.type != FE_OFDM) ) { psz_expected = "DVB-T"; } if( (!strncmp( p_access->psz_access, "usdigital", 9 ) || !strncmp( p_access->psz_access, "atsc", 4 ) ) && (p_frontend->info.type != FE_ATSC) ) { psz_expected = "ATSC"; } if( psz_expected != NULL ) { msg_Err( p_access, "requested type %s not supported by %s tuner", psz_expected, psz_real ); close( p_sys->i_frontend_handle ); free( p_frontend ); return VLC_EGENERIC; } }//.........这里部分代码省略.........
开发者ID:CSRedRat,项目名称:vlc,代码行数:101,
示例25: Win32VoutCreateWindow/***************************************************************************** * Win32VoutCreateWindow: create a window for the video. ***************************************************************************** * Before creating a direct draw surface, we need to create a window in which * the video will be displayed. This window will also allow us to capture the * events. *****************************************************************************/static int Win32VoutCreateWindow( event_thread_t *p_event ){ vout_display_t *vd = p_event->vd; HINSTANCE hInstance; HMENU hMenu; RECT rect_window; WNDCLASS wc; /* window class components */ TCHAR vlc_path[MAX_PATH+1]; int i_style, i_stylex; msg_Dbg( vd, "Win32VoutCreateWindow" ); /* Get this module's instance */ hInstance = GetModuleHandle(NULL); #ifdef MODULE_NAME_IS_direct3d if( !p_event->use_desktop ) #endif { /* If an external window was specified, we'll draw in it. */ p_event->parent_window = vout_display_NewWindow(vd, &p_event->wnd_cfg ); if( p_event->parent_window ) p_event->hparent = p_event->parent_window->handle.hwnd; else p_event->hparent = NULL; } #ifdef MODULE_NAME_IS_direct3d else { vout_display_DeleteWindow(vd, NULL); p_event->parent_window = NULL; p_event->hparent = GetDesktopHandle(vd); } #endif p_event->cursor_arrow = LoadCursor(NULL, IDC_ARROW); p_event->cursor_empty = EmptyCursor(hInstance); /* Get the Icon from the main app */ p_event->vlc_icon = NULL; if( GetModuleFileName( NULL, vlc_path, MAX_PATH ) ) { p_event->vlc_icon = ExtractIcon( hInstance, vlc_path, 0 ); } /* Fill in the window class structure */ wc.style = CS_OWNDC|CS_DBLCLKS; /* style: dbl click */ wc.lpfnWndProc = (WNDPROC)WinVoutEventProc; /* event handler */ wc.cbClsExtra = 0; /* no extra class data */ wc.cbWndExtra = 0; /* no extra window data */ wc.hInstance = hInstance; /* instance */ wc.hIcon = p_event->vlc_icon; /* load the vlc big icon */ wc.hCursor = p_event->is_cursor_hidden ? p_event->cursor_empty : p_event->cursor_arrow; wc.hbrBackground = GetStockObject(BLACK_BRUSH); /* background color */ wc.lpszMenuName = NULL; /* no menu */ wc.lpszClassName = p_event->class_main; /* use a special class */ /* Register the window class */ if( !RegisterClass(&wc) ) { if( p_event->vlc_icon ) DestroyIcon( p_event->vlc_icon ); msg_Err( vd, "Win32VoutCreateWindow RegisterClass FAILED (err=%lu)", GetLastError() ); return VLC_EGENERIC; } /* Register the video sub-window class */ wc.lpszClassName = p_event->class_video; wc.hIcon = 0; wc.hbrBackground = NULL; /* no background color */ if( !RegisterClass(&wc) ) { msg_Err( vd, "Win32VoutCreateWindow RegisterClass FAILED (err=%lu)", GetLastError() ); return VLC_EGENERIC; } /* When you create a window you give the dimensions you wish it to * have. Unfortunatly these dimensions will include the borders and * titlebar. We use the following function to find out the size of * the window corresponding to the useable surface we want */ rect_window.left = 10; rect_window.top = 10; rect_window.right = rect_window.left + p_event->wnd_cfg.width; rect_window.bottom = rect_window.top + p_event->wnd_cfg.height; if( var_GetBool( vd, "video-deco" ) ) { /* Open with window decoration */ AdjustWindowRect( &rect_window, WS_OVERLAPPEDWINDOW|WS_SIZEBOX, 0 ); i_style = WS_OVERLAPPEDWINDOW|WS_SIZEBOX|WS_VISIBLE|WS_CLIPCHILDREN; i_stylex = 0; }//.........这里部分代码省略.........
开发者ID:839687571,项目名称:vlc-2.2.1.32-2013,代码行数:101,
示例26: CommonManagevoid CommonManage( vout_thread_t *p_vout ){ /* If we do not control our window, we check for geometry changes * ourselves because the parent might not send us its events. */ vlc_mutex_lock( &p_vout->p_sys->lock ); if( p_vout->p_sys->hparent && !p_vout->b_fullscreen ) { RECT rect_parent; POINT point; vlc_mutex_unlock( &p_vout->p_sys->lock ); GetClientRect( p_vout->p_sys->hparent, &rect_parent ); point.x = point.y = 0; ClientToScreen( p_vout->p_sys->hparent, &point ); OffsetRect( &rect_parent, point.x, point.y ); if( !EqualRect( &rect_parent, &p_vout->p_sys->rect_parent ) ) { p_vout->p_sys->rect_parent = rect_parent; /* FIXME I find such #ifdef quite weirds. Are they really needed ? */#if defined(MODULE_NAME_IS_direct3d) SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0, rect_parent.right - rect_parent.left, rect_parent.bottom - rect_parent.top, SWP_NOZORDER ); UpdateRects( p_vout, true );#else /* This one is to force the update even if only * the position has changed */ SetWindowPos( p_vout->p_sys->hwnd, 0, 1, 1, rect_parent.right - rect_parent.left, rect_parent.bottom - rect_parent.top, 0 ); SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0, rect_parent.right - rect_parent.left, rect_parent.bottom - rect_parent.top, 0 );#if defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi) unsigned int i_x, i_y, i_width, i_height; vout_PlacePicture( p_vout, rect_parent.right - rect_parent.left, rect_parent.bottom - rect_parent.top, &i_x, &i_y, &i_width, &i_height ); SetWindowPos( p_vout->p_sys->hvideownd, HWND_TOP, i_x, i_y, i_width, i_height, 0 );#endif#endif } } else { vlc_mutex_unlock( &p_vout->p_sys->lock ); } /* autoscale toggle */ if( p_vout->i_changes & VOUT_SCALE_CHANGE ) { p_vout->i_changes &= ~VOUT_SCALE_CHANGE; p_vout->b_autoscale = var_GetBool( p_vout, "autoscale" ); p_vout->i_zoom = (int) ZOOM_FP_FACTOR; UpdateRects( p_vout, true ); } /* scaling factor */ if( p_vout->i_changes & VOUT_ZOOM_CHANGE ) { p_vout->i_changes &= ~VOUT_ZOOM_CHANGE; p_vout->b_autoscale = false; p_vout->i_zoom = (int)( ZOOM_FP_FACTOR * var_GetFloat( p_vout, "scale" ) ); UpdateRects( p_vout, true ); } /* Check for cropping / aspect changes */ if( p_vout->i_changes & VOUT_CROP_CHANGE || p_vout->i_changes & VOUT_ASPECT_CHANGE ) { p_vout->i_changes &= ~VOUT_CROP_CHANGE; p_vout->i_changes &= ~VOUT_ASPECT_CHANGE; p_vout->fmt_out.i_x_offset = p_vout->fmt_in.i_x_offset; p_vout->fmt_out.i_y_offset = p_vout->fmt_in.i_y_offset; p_vout->fmt_out.i_visible_width = p_vout->fmt_in.i_visible_width; p_vout->fmt_out.i_visible_height = p_vout->fmt_in.i_visible_height; p_vout->fmt_out.i_aspect = p_vout->fmt_in.i_aspect; p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num; p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den; p_vout->output.i_aspect = p_vout->fmt_in.i_aspect; UpdateRects( p_vout, true ); } /* We used to call the Win32 PeekMessage function here to read the window * messages. But since window can stay blocked into this function for a * long time (for example when you move your window on the screen), I//.........这里部分代码省略.........
开发者ID:FLYKingdom,项目名称:vlc,代码行数:101,
注:本文中的var_GetBool函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ var_GetFloat函数代码示例 C++ var_Get函数代码示例 |