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


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

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


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

示例1: try_finish_current_audio_packet

        /* 
         * Try sending some audio data to the Decklink.
         * Call only with current_audio_pkt != NULL.
         * Will set current_audio_pkt to NULL and delete the packet
         * if it is fully consumed.
         * Return number of samples consumed.
         */
        int try_finish_current_audio_packet( ) {
            uint32_t n_consumed;
            uint32_t n_left;
            
            uint32_t buffer;
            deckLinkOutput->GetBufferedAudioSampleFrameCount(&buffer);
            fprintf(stderr, "audio buffer = %u ", buffer);

            assert(current_audio_pkt != NULL);

            n_left = current_audio_pkt->n_frames( ) 
                    - samples_written_from_current_audio_pkt;

            if (n_left == 0) {
                fprintf(stderr, "Audio warning: This should not happen!\n");
                return 1;
            }

            if (deckLinkOutput->ScheduleAudioSamples(
                    current_audio_pkt->sample(
                        samples_written_from_current_audio_pkt
                    ), n_left, 0, 0, &n_consumed) != S_OK) {
                throw std::runtime_error(
                    "Failed to schedule audio samples"
                );
            }

            if (n_consumed == n_left) {
                delete current_audio_pkt;
                current_audio_pkt = NULL;
            } else if (n_consumed < n_left) {
                samples_written_from_current_audio_pkt += n_consumed;
            } else {
                throw std::runtime_error("This should not happen");
            }

            deckLinkOutput->GetBufferedAudioSampleFrameCount(&buffer);
            fprintf(stderr, "-> %u\n", buffer);

            return n_consumed;
        }
开发者ID:mikaelpfi,项目名称:exacore,代码行数:48,代码来源:decklink.cpp

示例2: RenderAudioSamples

	virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples( bool preroll )
	{
		// Provide more audio samples to the DeckLink API
		HRESULT result = S_OK;

		uint32_t count = m_fifo->used / m_channels;
		uint32_t buffered = count;

		if ( count
			// Stay under preferred buffer level
			&& ( S_OK == m_deckLinkOutput->GetBufferedAudioSampleFrameCount( &buffered ) )
			&& buffered < m_maxAudioBuffer )
		{
			uint32_t written = 0;
			
			buffered = m_maxAudioBuffer - buffered;
			count = buffered > count ? count : buffered;
			result = m_deckLinkOutput->ScheduleAudioSamples( m_fifo->buffer, count, 0, 0, &written );
			if ( written )
				sample_fifo_remove( m_fifo, written * m_channels );
		}

		return result;
	}
开发者ID:zaenalarifin,项目名称:mlt,代码行数:24,代码来源:consumer_decklink.cpp


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