本文整理汇总了C++中IDeckLinkOutput::GetDisplayModeIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ IDeckLinkOutput::GetDisplayModeIterator方法的具体用法?C++ IDeckLinkOutput::GetDisplayModeIterator怎么用?C++ IDeckLinkOutput::GetDisplayModeIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDeckLinkOutput
的用法示例。
在下文中一共展示了IDeckLinkOutput::GetDisplayModeIterator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
IDeckLinkDisplayMode *BMDOutputDelegate::GetDisplayModeByIndex(int selectedIndex)
{
// Populate the display mode combo with a list of display modes supported by the installed DeckLink card
IDeckLinkDisplayModeIterator* displayModeIterator;
IDeckLinkDisplayMode* deckLinkDisplayMode;
IDeckLinkDisplayMode* selectedMode = NULL;
int index = 0;
if (m_deckLinkOutput->GetDisplayModeIterator(&displayModeIterator) != S_OK)
goto bail;
while (displayModeIterator->Next(&deckLinkDisplayMode) == S_OK)
{
const char *modeName;
if (deckLinkDisplayMode->GetName(&modeName) == S_OK)
{
if (index == selectedIndex)
{
printf("Selected mode: %s\n", modeName);
selectedMode = deckLinkDisplayMode;
goto bail;
}
}
index++;
}
bail:
displayModeIterator->Release();
return selectedMode;
}
示例2: getDisplayMode
IDeckLinkDisplayMode* getDisplayMode()
{
mlt_profile profile = mlt_service_profile( MLT_CONSUMER_SERVICE( &m_consumer ) );
IDeckLinkDisplayModeIterator* iter;
IDeckLinkDisplayMode* mode;
IDeckLinkDisplayMode* result = 0;
if ( m_deckLinkOutput->GetDisplayModeIterator( &iter ) == S_OK )
{
while ( !result && iter->Next( &mode ) == S_OK )
{
m_width = mode->GetWidth();
m_height = mode->GetHeight();
mode->GetFrameRate( &m_duration, &m_timescale );
m_fps = (double) m_timescale / m_duration;
int p = mode->GetFieldDominance() == bmdProgressiveFrame;
mlt_log_verbose( &m_consumer, "BMD mode %dx%d %.3f fps prog %d\n", m_width, m_height, m_fps, p );
if ( m_width == profile->width && m_height == profile->height && p == profile->progressive
&& m_fps == mlt_profile_fps( profile ) )
result = mode;
}
}
return result;
}
示例3: 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"
);
}
}
示例4: print_output_modes
void print_output_modes(IDeckLink *deckLink)
{
IDeckLinkOutput *deckLinkOutput = NULL;
IDeckLinkDisplayModeIterator *displayModeIterator = NULL;
IDeckLinkDisplayMode *displayMode = NULL;
HRESULT result;
int displayModeCount = 0;
// Query the DeckLink for its configuration interface
result = deckLink->QueryInterface(IID_IDeckLinkOutput,
(void **)&deckLinkOutput);
if (result != S_OK) {
fprintf(
stderr,
"Could not obtain the IDeckLinkOutput interface - result = %08x\n",
result);
goto bail;
}
// Obtain an IDeckLinkDisplayModeIterator to enumerate the display modes supported on output
result = deckLinkOutput->GetDisplayModeIterator(&displayModeIterator);
if (result != S_OK) {
fprintf(
stderr,
"Could not obtain the video output display mode iterator - result = %08x\n",
result);
goto bail;
}
// List all supported output display modes
printf("Supported video output display modes and pixel formats:\n");
while (displayModeIterator->Next(&displayMode) == S_OK) {
BMDProbeString str;
result = displayMode->GetName(&str);
if (result == S_OK) {
char modeName[64];
int modeWidth;
int modeHeight;
BMDTimeValue frameRateDuration;
BMDTimeScale frameRateScale;
int pixelFormatIndex = 0; // index into the gKnownPixelFormats / gKnownFormatNames arrays
BMDDisplayModeSupport displayModeSupport;
// Obtain the display mode's properties
modeWidth = displayMode->GetWidth();
modeHeight = displayMode->GetHeight();
displayMode->GetFrameRate(&frameRateDuration, &frameRateScale);
printf(" %2d: %-20s \t %d x %d \t %7g FPS\n",
displayModeCount++, ToStr(str), modeWidth, modeHeight,
(double)frameRateScale / (double)frameRateDuration);
FreeStr(str);
}
// Release the IDeckLinkDisplayMode object to prevent a leak
displayMode->Release();
}
// printf("\n");
bail:
// Ensure that the interfaces we obtained are released to prevent a memory leak
if (displayModeIterator != NULL)
displayModeIterator->Release();
if (deckLinkOutput != NULL)
deckLinkOutput->Release();
}
示例5:
static void print_output_modes (IDeckLink* deckLink)
{
IDeckLinkOutput* deckLinkOutput = NULL;
IDeckLinkDisplayModeIterator* displayModeIterator = NULL;
IDeckLinkDisplayMode* displayMode = NULL;
HRESULT result;
// Query the DeckLink for its configuration interface
result = deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&deckLinkOutput);
if (result != S_OK)
{
fprintf(stderr, "Could not obtain the IDeckLinkOutput interface - result = %08x\n", result);
goto bail;
}
// Obtain an IDeckLinkDisplayModeIterator to enumerate the display modes supported on output
result = deckLinkOutput->GetDisplayModeIterator(&displayModeIterator);
if (result != S_OK)
{
fprintf(stderr, "Could not obtain the video output display mode iterator - result = %08x\n", result);
goto bail;
}
// List all supported output display modes
printf("Supported video output display modes and pixel formats:\n");
while (displayModeIterator->Next(&displayMode) == S_OK)
{
CFStringRef displayModeString;
result = displayMode->GetName(&displayModeString);
if (result == S_OK)
{
char modeName[64];
int modeWidth;
int modeHeight;
BMDTimeValue frameRateDuration;
BMDTimeScale frameRateScale;
int pixelFormatIndex = 0; // index into the gKnownPixelFormats / gKnownFormatNames arrays
BMDDisplayModeSupport displayModeSupport;
// Obtain the display mode's properties
modeWidth = displayMode->GetWidth();
modeHeight = displayMode->GetHeight();
displayMode->GetFrameRate(&frameRateDuration, &frameRateScale);
printf(" %-20s \t %d x %d \t %7g FPS\t", displayModeString, modeWidth, modeHeight, (double)frameRateScale / (double)frameRateDuration);
// Print the supported pixel formats for this display mode
while ((gKnownPixelFormats[pixelFormatIndex] != 0) && (gKnownPixelFormatNames[pixelFormatIndex] != NULL))
{
if ((deckLinkOutput->DoesSupportVideoMode(displayMode->GetDisplayMode(), gKnownPixelFormats[pixelFormatIndex], bmdVideoOutputFlagDefault, &displayModeSupport, NULL) == S_OK)
&& (displayModeSupport != bmdDisplayModeNotSupported))
{
printf("%s\t", gKnownPixelFormatNames[pixelFormatIndex]);
}
pixelFormatIndex++;
}
printf("\n");
// free(displayModeString);
}
// Release the IDeckLinkDisplayMode object to prevent a leak
displayMode->Release();
}
printf("\n");
bail:
// Ensure that the interfaces we obtained are released to prevent a memory leak
if (displayModeIterator != NULL)
displayModeIterator->Release();
if (deckLinkOutput != NULL)
deckLinkOutput->Release();
}