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


C++ IDeckLinkOutput::SetAudioCallback方法代码示例

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


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

示例1: setup_audio

        void setup_audio( ) {
            /* FIXME hard coded default */
            n_channels = 2; 

            audio_in_pipe = new Pipe<AudioPacket *>(OUT_PIPE_SIZE);

            /* FIXME magic 29.97 related number */
            /* Set up empty audio packet for prerolling */
            current_audio_pkt = new AudioPacket(48000, n_channels, 2, 25626);
            samples_written_from_current_audio_pkt = 0;

            assert(deckLinkOutput != NULL);

            if (deckLinkOutput->SetAudioCallback(this) != S_OK) {
                throw std::runtime_error(
                    "Failed to set DeckLink audio callback"
                );
            }

            if (deckLinkOutput->EnableAudioOutput( 
                    bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, 
                    n_channels, bmdAudioOutputStreamContinuous) != S_OK) {
                throw std::runtime_error(
                    "Failed to enable DeckLink audio output"
                );
            }

            audio_preroll_done = 0;

            if (deckLinkOutput->BeginAudioPreroll( ) != S_OK) {
                throw std::runtime_error(
                    "Failed to begin DeckLink audio preroll"
                );
            }

            while (audio_preroll_done == 0) { 
                /* FIXME: busy wait */
            }

            if (deckLinkOutput->EndAudioPreroll( ) != S_OK) {
                throw std::runtime_error(
                    "Failed to end DeckLink audio preroll"
                );
            }
        }
开发者ID:mikaelpfi,项目名称:exacore,代码行数:45,代码来源:decklink.cpp

示例2: setup_audio

        void setup_audio( ) {
            IOAudioPacket preroll_audio(8008, n_channels);
            preroll_audio.zero( );

            audio_in_pipe = new Pipe<IOAudioPacket *>(OUT_PIPE_SIZE);
            audio_fifo = new AudioFIFO<int16_t>(n_channels);
            audio_fifo->add_packet(&preroll_audio);

            assert(deckLinkOutput != NULL);

            if (deckLinkOutput->SetAudioCallback(this) != S_OK) {
                throw std::runtime_error(
                    "Failed to set DeckLink audio callback"
                );
            }

            if (deckLinkOutput->EnableAudioOutput( 
                    bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, 
                    n_channels, bmdAudioOutputStreamContinuous) != S_OK) {
                throw std::runtime_error(
                    "Failed to enable DeckLink audio output"
                );
            }

            audio_preroll_done = 0;

            if (deckLinkOutput->BeginAudioPreroll( ) != S_OK) {
                throw std::runtime_error(
                    "Failed to begin DeckLink audio preroll"
                );
            }

            while (audio_preroll_done == 0) { 
                /* FIXME: busy wait */
            }

            if (deckLinkOutput->EndAudioPreroll( ) != S_OK) {
                throw std::runtime_error(
                    "Failed to end DeckLink audio preroll"
                );
            }
        }
开发者ID:DigiDaz,项目名称:exacore,代码行数:42,代码来源:decklink.cpp

示例3: open

	bool open( unsigned card = 0 )
	{
		IDeckLinkIterator* deckLinkIterator = CreateDeckLinkIteratorInstance();
		unsigned i = 0;
		
		if ( !deckLinkIterator )
		{
			mlt_log_verbose( NULL, "The DeckLink drivers not installed.\n" );
			return false;
		}
		
		// Connect to the Nth DeckLink instance
		do {
			if ( deckLinkIterator->Next( &m_deckLink ) != S_OK )
			{
				mlt_log_verbose( NULL, "DeckLink card not found\n" );
				deckLinkIterator->Release();
				return false;
			}
		} while ( ++i <= card );
		
		// Obtain the audio/video output interface (IDeckLinkOutput)
		if ( m_deckLink->QueryInterface( IID_IDeckLinkOutput, (void**)&m_deckLinkOutput ) != S_OK )
		{
			mlt_log_verbose( NULL, "No DeckLink cards support output\n" );
			m_deckLink->Release();
			m_deckLink = 0;
			deckLinkIterator->Release();
			return false;
		}
		
		// Provide this class as a delegate to the audio and video output interfaces
		m_deckLinkOutput->SetScheduledFrameCompletionCallback( this );
		m_deckLinkOutput->SetAudioCallback( this );
		
		pthread_mutex_init( &m_mutex, NULL );
		pthread_cond_init( &m_condition, NULL );
		m_maxAudioBuffer = bmdAudioSampleRate48kHz;
		m_videoFrameQ = mlt_deque_init();
		
		return true;
	}
开发者ID:zaenalarifin,项目名称:mlt,代码行数:42,代码来源:consumer_decklink.cpp


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