当前位置: 首页>>代码示例>>C++>>正文


C++ scoped_ptr::getAudioInfo方法代码示例

本文整理汇总了C++中boost::scoped_ptr::getAudioInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ scoped_ptr::getAudioInfo方法的具体用法?C++ scoped_ptr::getAudioInfo怎么用?C++ scoped_ptr::getAudioInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::scoped_ptr的用法示例。


在下文中一共展示了scoped_ptr::getAudioInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

sound::InputStream*
Sound_as::attachAuxStreamerIfNeeded()
{
    media::AudioInfo* audioInfo =  _mediaParser->getAudioInfo();
    if (!audioInfo) return 0;

    // the following may throw an exception
    _audioDecoder.reset(_mediaHandler->createAudioDecoder(*audioInfo).release());

    // start playing ASAP, a call to ::start will just change _startTime
#ifdef GNASH_DEBUG_SOUND_AS
    log_debug("Attaching the aux streamer");
#endif
    return _soundHandler->attach_aux_streamer(getAudioWrapper, (void*) this);
}
开发者ID:ascendancy721,项目名称:gnash,代码行数:15,代码来源:Sound_as.cpp

示例2: assert

void
Sound_as::probeAudio()
{
#ifdef USE_SOUND
    if ( ! externalSound ) {
        // Only probe for sound complete
        assert(_soundHandler);
        assert(!_soundCompleted);
        if (!_soundHandler->isSoundPlaying(soundId)) {
            stopProbeTimer();
            // dispatch onSoundComplete 
            callMethod(&owner(), NSV::PROP_ON_SOUND_COMPLETE);
        }
        return;
    }

    if (!_mediaParser) return; // nothing to do here w/out a media parser

    if ( ! _soundLoaded ) {
#ifdef GNASH_DEBUG_SOUND_AS
        log_debug("Probing audio for load");
#endif
        if (_mediaParser->parsingCompleted()) {

            _soundLoaded = true;

            if (!isStreaming) {
                stopProbeTimer(); // will be re-started on Sound.start()
            }
            bool success = _mediaParser->getAudioInfo() != 0;
            callMethod(&owner(), NSV::PROP_ON_LOAD, success);

            // TODO: check if this should be called anyway.
            if (success) handleId3Data(_mediaParser->getId3Info(), owner());
        }

        // If this is an event sound, we are done. Otherwise, if there is
        // any data available, we should start playback.
        if (!isStreaming || _mediaParser->isBufferEmpty()) {
            return; 
        }
    }

    if (isAttached()) {
#ifdef GNASH_DEBUG_SOUND_AS
        log_debug("Probing audio for end");
#endif

        boost::mutex::scoped_lock lock(_soundCompletedMutex);
        if (_soundCompleted) {
            // when _soundCompleted is true we're NOT attached !
            // MediaParser may be still needed,
            // if this is a non-streaming sound
            if ( isStreaming ) {
                _mediaParser.reset(); // no use for this anymore...
            }
            _inputStream = 0;
            _soundCompleted = false;
            stopProbeTimer();

            // dispatch onSoundComplete 
            callMethod(&owner(), NSV::PROP_ON_SOUND_COMPLETE);
        }
    }
    else {
#ifdef GNASH_DEBUG_SOUND_AS
        log_debug("Probing audio for start");
#endif

        bool parsingCompleted = _mediaParser->parsingCompleted();
        try {
            log_debug("Attaching aux streamer");
            _inputStream = attachAuxStreamerIfNeeded();
        } 
        catch (const MediaException& e) {
            assert(!_inputStream);
            assert(!_audioDecoder.get());
            log_error(_("Could not create audio decoder: %s"), e.what());
            _mediaParser.reset(); // no use for this anymore...
            stopProbeTimer();
            return;
        }

        if ( ! _inputStream ) {
            if ( parsingCompleted ) {
                log_error(_("No audio in Sound input."));
                stopProbeTimer();
                _mediaParser.reset(); // no use for this anymore...
            } else {
                // keep probing
            }
        } else {
            // An audio decoder was constructed, good!
            assert(_audioDecoder.get());
        }
    }
#endif  // USE_SOUND
}
开发者ID:ascendancy721,项目名称:gnash,代码行数:98,代码来源:Sound_as.cpp


注:本文中的boost::scoped_ptr::getAudioInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。