本文整理汇总了C++中IDeckLinkOutput::EnableVideoOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ IDeckLinkOutput::EnableVideoOutput方法的具体用法?C++ IDeckLinkOutput::EnableVideoOutput怎么用?C++ IDeckLinkOutput::EnableVideoOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDeckLinkOutput
的用法示例。
在下文中一共展示了IDeckLinkOutput::EnableVideoOutput方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open_card
void open_card( ) {
IDeckLinkDisplayModeIterator *it;
/* get the DeckLinkOutput interface */
if (deckLink->QueryInterface(IID_IDeckLinkOutput,
(void **)&deckLinkOutput) != S_OK) {
throw std::runtime_error(
"Failed to get DeckLink output interface handle"
);
}
if (deckLinkOutput->SetScheduledFrameCompletionCallback(this)
!= S_OK) {
throw std::runtime_error(
"Failed to set DeckLink frame completion callback"
);
}
/* attempt to determine field dominance */
if (deckLinkOutput->GetDisplayModeIterator(&it) != S_OK) {
throw std::runtime_error(
"DeckLink output: failed to get display mode iterator"
);
}
dominance = find_dominance(norms[norm].mode, it);
it->Release( );
/* and we're off to the races */
if (deckLinkOutput->EnableVideoOutput(norms[norm].mode,
bmdVideoOutputFlagDefault) != S_OK) {
throw std::runtime_error(
"Failed to enable DeckLink video output"
);
}
}
示例2: start
bool start( unsigned preroll )
{
m_displayMode = getDisplayMode();
if ( !m_displayMode )
{
mlt_log_error( &m_consumer, "Profile is not compatible with decklink.\n" );
return false;
}
// Set the video output mode
if ( S_OK != m_deckLinkOutput->EnableVideoOutput( m_displayMode->GetDisplayMode(), bmdVideoOutputFlagDefault) )
{
mlt_log_error( &m_consumer, "Failed to enable video output\n" );
return false;
}
// Set the audio output mode
m_channels = 2;
if ( S_OK != m_deckLinkOutput->EnableAudioOutput( bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger,
m_channels, bmdAudioOutputStreamContinuous ) )
{
mlt_log_error( &m_consumer, "Failed to enable audio output\n" );
stop();
return false;
}
m_fifo = sample_fifo_init();
// Preroll
m_isPrerolling = true;
m_prerollCounter = 0;
m_preroll = preroll < PREROLL_MINIMUM ? PREROLL_MINIMUM : preroll;
m_count = 0;
m_deckLinkOutput->BeginAudioPreroll();
return true;
}
示例3: StartRunning
void BMDOutputDelegate::StartRunning ()
{
IDeckLinkDisplayMode* videoDisplayMode = NULL;
// Get the display mode for 1080i 59.95 - mode 6
// Changed to NTSC 23.98 - JB 20110215
videoDisplayMode = GetDisplayModeByIndex(1);
if (!videoDisplayMode)
return;
m_frameWidth = videoDisplayMode->GetWidth();
m_frameHeight = videoDisplayMode->GetHeight();
videoDisplayMode->GetFrameRate(&m_frameDuration, &m_frameTimescale);
// Calculate the number of frames per second, rounded up to the nearest integer. For example, for NTSC (29.97 FPS), framesPerSecond == 30.
m_framesPerSecond = (unsigned long)((m_frameTimescale + (m_frameDuration-1)) / m_frameDuration);
QImage image(m_frameWidth,m_frameHeight, QImage::Format_ARGB32);
image.fill(Qt::green);
//m_frame = VideoFramePtr(new VideoFrame(image, 1000/30));
HRESULT res;
// Set the video output mode
if (m_deckLinkOutput->EnableVideoOutput(videoDisplayMode->GetDisplayMode(), bmdVideoOutputFlagDefault) != S_OK)
{
//fprintf(stderr, "Failed to enable video output\n");
qDebug() << "BMDOutputDelegate::StartRunning(): Failed to EnableVideoOutput()";
goto bail;
}
res = m_deckLinkOutput->CreateVideoFrame(
m_frameWidth,
m_frameHeight,
m_frameWidth * 4,
bmdFormat8BitBGRA,
bmdFrameFlagDefault,
&m_rgbFrame);
if(res != S_OK)
{
qDebug() << "BMDOutputDelegate::StartRunning: Error creating RGB frame, res:"<<res;
goto bail;
}
res = m_deckLinkOutput->CreateVideoFrame(
m_frameWidth,
m_frameHeight,
m_frameWidth * 2,
bmdFormat8BitYUV,
bmdFrameFlagDefault,
&m_yuvFrame);
if(res != S_OK)
{
qDebug() << "BMDOutputDelegate::StartRunning: Error creating YUV frame, res:"<<res;
goto bail;
}
// // Generate a frame of black
// if (m_deckLinkOutput->CreateVideoFrame(m_frameWidth, m_frameHeight, m_frameWidth*2, bmdFormat8BitYUV, bmdFrameFlagDefault, &m_videoFrameBlack) != S_OK)
// {
// fprintf(stderr, "Failed to create video frame\n");
// goto bail;
// }
// FillBlack(m_videoFrameBlack);
//
// // Generate a frame of colour bars
// if (m_deckLinkOutput->CreateVideoFrame(m_frameWidth, m_frameHeight, m_frameWidth*2, bmdFormat8BitYUV, bmdFrameFlagDefault, &m_videoFrameBars) != S_OK)
// {
// fprintf(stderr, "Failed to create video frame\n");
// goto bail;
// }
// FillColourBars(m_videoFrameBars);
// Begin video preroll by scheduling a second of frames in hardware
m_totalFramesScheduled = 0;
for (unsigned i = 0; i < m_framesPerSecond; i++)
{
PrepareFrame();
ScheduleNextFrame(true);
}
// Args: startTime, timeScale, playback speed (1.0 = normal)
m_deckLinkOutput->StartScheduledPlayback(0, 100, 1.0);
m_running = true;
return;
bail:
// *** Error-handling code. Cleanup any resources that were allocated. *** //
StopRunning();
}