本文整理汇总了C++中IDeckLink类的典型用法代码示例。如果您正苦于以下问题:C++ IDeckLink类的具体用法?C++ IDeckLink怎么用?C++ IDeckLink使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDeckLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_device_list
std::vector<std::wstring> get_device_list()
{
std::vector<std::wstring> devices;
struct co_init
{
co_init(){::CoInitialize(nullptr);}
~co_init(){::CoUninitialize();}
} init;
try
{
CComPtr<IDeckLinkIterator> pDecklinkIterator;
if(SUCCEEDED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
{
IDeckLink* decklink;
for(int n = 1; pDecklinkIterator->Next(&decklink) == S_OK; ++n)
{
BSTR model_name = L"Unknown";
decklink->GetModelName(&model_name);
decklink->Release();
devices.push_back(std::wstring(model_name) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]");
}
}
}
catch(...){}
return devices;
}
示例2: dl_list_devices
//
// Get a list of the names of the cards
//
int dl_list_devices( CaptureCardList *cards ){
IDeckLinkIterator* deckLinkIterator;
IDeckLink* deckLink;
int numDevices = 0;
HRESULT result;
// Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
deckLinkIterator = CreateDeckLinkIteratorInstance();
if (deckLinkIterator == NULL)
{
//fprintf(stderr, "A DeckLink iterator could not be created. The DeckLink drivers may not be installed.\n");
return 0;
}
while (deckLinkIterator->Next(&deckLink) == S_OK)
{
char * deviceNameString = NULL;
// *** Print the model name of the DeckLink card
result = deckLink->GetModelName((const char **) &deviceNameString);
if (result == S_OK){
if(numDevices < MAX_CAPTURE_LIST_ITEMS){
strcpy(cards->item[numDevices],deviceNameString);
}
numDevices++;
free(deviceNameString);
}
// Release the IDeckLink instance when we've finished with it to prevent leaks
deckLink->Release();
}
deckLinkIterator->Release();
cards->items = numDevices;
return numDevices;
}
示例3: krad_decklink_cpp_detect_devices
int krad_decklink_cpp_detect_devices () {
IDeckLinkIterator *deckLinkIterator;
IDeckLink *deckLink;
int device_count;
//HRESULT result;
device_count = 0;
deckLinkIterator = CreateDeckLinkIteratorInstance();
if (deckLinkIterator == NULL) {
printke ("krad_decklink_detect_devices: The DeckLink drivers may not be installed.");
return 0;
}
while (deckLinkIterator->Next(&deckLink) == S_OK) {
device_count++;
deckLink->Release();
}
deckLinkIterator->Release();
return device_count;
}
示例4: old_main
int old_main (int argc, char** argv)
{
IDeckLinkIterator* deckLinkIterator;
IDeckLink* deckLink;
int numDevices = 0;
HRESULT result;
// Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
deckLinkIterator = CreateDeckLinkIteratorInstance();
if (deckLinkIterator == NULL)
{
fprintf(stderr, "A DeckLink iterator could not be created. The DeckLink drivers may not be installed.\n");
return 1;
}
// Enumerate all cards in this system
while (deckLinkIterator->Next(&deckLink) == S_OK)
{
char * deviceNameString = NULL;
// Increment the total number of DeckLink cards found
numDevices++;
if (numDevices > 1)
printf("\n\n");
// *** Print the model name of the DeckLink card
result = deckLink->GetModelName((const char **) &deviceNameString);
if (result == S_OK)
{
printf("=============== %s ===============\n\n", deviceNameString);
free(deviceNameString);
}
print_attributes(deckLink);
// ** List the video output display modes supported by the card
print_output_modes(deckLink);
// ** List the video input display modes supported by the card
print_input_modes(deckLink);
// ** List the input and output capabilities of the card
print_capabilities(deckLink);
// Release the IDeckLink instance when we've finished with it to prevent leaks
deckLink->Release();
}
deckLinkIterator->Release();
// If no DeckLink cards were found in the system, inform the user
if (numDevices == 0)
printf("No Blackmagic Design devices were found.\n");
printf("\n");
return 0;
}
示例5: init_devices
static void
init_devices (void)
{
IDeckLinkIterator *iterator;
IDeckLink *decklink = NULL;
HRESULT ret;
int i;
static gboolean inited = FALSE;
if (inited) return;
inited = TRUE;
iterator = CreateDeckLinkIteratorInstance ();
if (iterator == NULL) {
GST_ERROR ("no driver");
return;
}
i = 0;
ret = iterator->Next (&decklink);
while (ret == S_OK) {
devices[i].decklink = decklink;
ret = decklink->QueryInterface (IID_IDeckLinkInput,
(void **) &devices[i].input);
if (ret != S_OK) {
GST_WARNING ("selected device does not have input interface");
}
ret = decklink->QueryInterface (IID_IDeckLinkOutput,
(void **) &devices[i].output);
if (ret != S_OK) {
GST_WARNING ("selected device does not have output interface");
}
ret = decklink->QueryInterface (IID_IDeckLinkConfiguration,
(void **) &devices[i].config);
if (ret != S_OK) {
GST_WARNING ("selected device does not have config interface");
}
ret = iterator->Next (&decklink);
i++;
if (i == 10) {
GST_WARNING ("this hardware has more then 10 devices");
break;
}
}
n_devices = i;
iterator->Release();
}
示例6: CreateDeckLinkIteratorInstance
vector<ofVideoDevice> ofxBlackmagicGrabber::listDevices() {
IDeckLinkIterator* deckLinkIterator;
IDeckLink* deckLink;
int numDevices = 0;
HRESULT result;
vector<ofVideoDevice> devices;
// Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
deckLinkIterator = CreateDeckLinkIteratorInstance();
if (deckLinkIterator == NULL){
ofLogError(LOG_NAME) << "A DeckLink iterator could not be created. The DeckLink drivers may not be installed.";
}
// Enumerate all cards in this system
while (deckLinkIterator->Next(&deckLink) == S_OK){
CFStringRef deviceNameString;
// Increment the total number of DeckLink cards found
numDevices++;
if (numDevices > 1)
printf("\n\n");
// *** Print the model name of the DeckLink card
result = deckLink->GetModelName(&deviceNameString);
if (result == S_OK)
{
printf("=============== %s ===============\n\n", deviceNameString);
// free(deviceNameString);
}
print_attributes(deckLink);
// ** List the video output display modes supported by the card
print_output_modes(deckLink);
// ** List the input and output capabilities of the card
print_capabilities(deckLink);
// Release the IDeckLink instance when we've finished with it to prevent leaks
deckLink->Release();
}
deckLinkIterator->Release();
// If no DeckLink cards were found in the system, inform the user
if (numDevices == 0)
ofLogError(LOG_NAME) << "No Blackmagic Design devices were found.";
return devices;
}
示例7: CreateDeckLinkIteratorInstance
void VideoReceiverInterface::cameraFunction(bool useCompositeInput){
IDeckLink *deckLink;
IDeckLinkInput *deckLinkInput;
BMDVideoInputFlags inputFlags = 0;
BMDDisplayMode displayMode;
if (useCompositeInput){
displayMode = bmdModeNTSC;
} else {
displayMode = bmdModeHD1080i5994;
}
BMDPixelFormat pixelFormat = bmdFormat8BitYUV;
IDeckLinkIterator *deckLinkIterator = CreateDeckLinkIteratorInstance();
DEBUG("Creating decklink iterator...");
if (deckLinkIterator == 0 ){
cerr << "\n\tUnable to create DeckLink Iterator. Video analysis will be disabled.\n\n";
return;
}
DEBUG("Creating decklink object...");
if ( deckLinkIterator->Next(&deckLink) != S_OK ) {
Log::error("\n\tCould not create decklink object. Video analysis will be disabled\n");
return;
}
DEBUG("Querying decklink interface...");
if ( deckLink->QueryInterface(IID_IDeckLinkInput, (void**)&deckLinkInput) != S_OK ) {
Log::error("\n\tCould not find a decklink interface. Video analysis will be disabled\n");
return;
}
DEBUG("Registering decklink input callback...");
if ( deckLinkInput->SetCallback(new VideoCallback(this)) != S_OK ) {
Log::error("\n\tCould not set the decklink callback. Video analysis will be disabled\n");
return;
}
DEBUG("Enabling video input...");
if ( deckLinkInput->EnableVideoInput(displayMode,pixelFormat,inputFlags) != S_OK ) {
Log::error("\n\tCould not enable video input. Video analysis will be disabled\n");
return;
}
DEBUG("Starting streams...");
if ( deckLinkInput->StartStreams() != S_OK ) {
Log::error("\n\tCould not start streams. Video analysis will be disabled\n");
return;
}
}
示例8: open_input
void open_input(unsigned int norm) {
IDeckLinkDisplayModeIterator *it;
assert(deckLink != NULL);
assert(norm < sizeof(norms) / sizeof(struct decklink_norm));
if (deckLink->QueryInterface(IID_IDeckLinkInput,
(void **) &deckLinkInput) != S_OK) {
throw std::runtime_error(
"DeckLink input: failed to get IDeckLinkInput"
);
}
if (deckLinkInput->GetDisplayModeIterator(&it) != S_OK) {
throw std::runtime_error(
"DeckLink input: failed to get display mode iterator"
);
}
dominance = find_dominance(norms[norm].mode, it);
it->Release( );
if (deckLinkInput->EnableVideoInput(norms[norm].mode,
bpf, 0) != S_OK) {
throw std::runtime_error(
"DeckLink input: failed to enable video input"
);
}
fprintf(stderr, "DeckLink: opening input using norm %s\n",
norms[norm].name);
}
示例9: main
int main (int argc, char * const argv[])
{
IDeckLink *deckLink = getFirstDeckLinkCard();
if (deckLink)
{
CaptureHelper helper(deckLink);
if (helper.init())
{
helper.doCapture();
}
deckLink->Release();
}
return 0;
}
示例10: select_input_connection
void select_input_connection(unsigned int input) {
IDeckLinkConfiguration *config;
assert(deckLink != NULL);
assert(input < sizeof(connections)
/ sizeof(struct decklink_connection));
if (deckLink->QueryInterface(IID_IDeckLinkConfiguration,
(void**) &config) != S_OK) {
throw std::runtime_error(
"DeckLink input: get IDeckLinkConfiguration failed"
);
}
if (config->SetInt(bmdDeckLinkConfigVideoInputConnection,
connections[input].connection) != S_OK) {
throw std::runtime_error(
"DeckLink input: set input connection failed"
);
}
fprintf(stderr, "DeckLink: input connection set to %s\n",
connections[input].name);
config->Release( );
}
示例11: on_property_changed
// Listen for the list_devices property to be set
static void on_property_changed( void*, mlt_properties properties, const char *name )
{
IDeckLinkIterator* decklinkIterator = NULL;
IDeckLink* decklink = NULL;
IDeckLinkInput* decklinkInput = NULL;
int i = 0;
if ( name && !strcmp( name, "list_devices" ) )
mlt_event_block( (mlt_event) mlt_properties_get_data( properties, "list-devices-event", NULL ) );
else
return;
#ifdef WIN32
if ( FAILED( CoInitialize( NULL ) ) )
return;
if ( FAILED( CoCreateInstance( CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**) &decklinkIterator ) ) )
return;
#else
if ( !( decklinkIterator = CreateDeckLinkIteratorInstance() ) )
return;
#endif
for ( ; decklinkIterator->Next( &decklink ) == S_OK; i++ )
{
if ( decklink->QueryInterface( IID_IDeckLinkInput, (void**) &decklinkInput ) == S_OK )
{
DLString name = NULL;
if ( decklink->GetModelName( &name ) == S_OK )
{
char *name_cstr = getCString( name );
const char *format = "device.%d";
char *key = (char*) calloc( 1, strlen( format ) + 1 );
sprintf( key, format, i );
mlt_properties_set( properties, key, name_cstr );
free( key );
freeDLString( name );
freeCString( name_cstr );
}
SAFE_RELEASE( decklinkInput );
}
SAFE_RELEASE( decklink );
}
SAFE_RELEASE( decklinkIterator );
mlt_properties_set_int( properties, "devices", i );
}
示例12: open
bool open( unsigned card = 0 )
{
IDeckLinkIterator* decklinkIterator = NULL;
try
{
#ifdef WIN32
HRESULT result = CoInitialize( NULL );
if ( FAILED( result ) )
throw "COM initialization failed";
result = CoCreateInstance( CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**) &decklinkIterator );
if ( FAILED( result ) )
throw "The DeckLink drivers are not installed.";
#else
decklinkIterator = CreateDeckLinkIteratorInstance();
if ( !decklinkIterator )
throw "The DeckLink drivers are not installed.";
#endif
// Connect to the Nth DeckLink instance
for ( unsigned i = 0; decklinkIterator->Next( &m_decklink ) == S_OK ; i++)
{
if ( i == card )
break;
else
SAFE_RELEASE( m_decklink );
}
SAFE_RELEASE( decklinkIterator );
if ( !m_decklink )
throw "DeckLink card not found.";
// Get the input interface
if ( m_decklink->QueryInterface( IID_IDeckLinkInput, (void**) &m_decklinkInput ) != S_OK )
throw "No DeckLink cards support input.";
// Provide this class as a delegate to the input callback
m_decklinkInput->SetCallback( this );
// Initialize other members
pthread_mutex_init( &m_mutex, NULL );
pthread_cond_init( &m_condition, NULL );
m_queue = mlt_deque_init();
m_started = false;
m_dropped = 0;
m_isBuffering = true;
m_cache = mlt_cache_init();
// 3 covers YADIF and increasing framerate use cases
mlt_cache_set_size( m_cache, 3 );
}
catch ( const char *error )
{
SAFE_RELEASE( m_decklinkInput );
SAFE_RELEASE( m_decklink );
mlt_log_error( getProducer(), "%s\n", error );
return false;
}
return true;
}
示例13: main
int main (int argc, char * const argv[])
{
IDeckLink *deckLink = getFirstDeckLinkCard();
if (deckLink)
{
ETTHelper* helper = new ETTHelper(deckLink);
if (helper->init())
{
helper->doExport();
}
deckLink->Release();
helper->Release();
}
return 0;
}
示例14: CreateDeckLinkIteratorInstance
QStringList BMDOutputDelegate::enumDeviceNames(bool forceReload)
{
if(!s_knownDevices.isEmpty())
{
if(!forceReload)
return s_knownDevices;
else
s_knownDevices.clear();
}
IDeckLinkIterator *deckLinkIterator = CreateDeckLinkIteratorInstance();
if (deckLinkIterator == NULL)
{
fprintf(stderr, "BMDCaptureDelegate::enumDeviceNames: A DeckLink iterator could not be created. The DeckLink drivers may not be installed.\n");
return QStringList();
}
IDeckLink *deckLink;
IDeckLinkInput *deckLinkOutput;
int index = 0;
// Enumerate all cards in this system
while (deckLinkIterator->Next(&deckLink) == S_OK)
{
if (deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&deckLinkOutput) == S_OK)
{
s_knownDevices << QString("bmd:%1").arg(index);
deckLinkOutput->Release();
deckLinkOutput = NULL;
}
index ++;
// Release the IDeckLink instance when we've finished with it to prevent leaks
deckLink->Release();
}
deckLinkIterator->Release();
return s_knownDevices;
}
示例15: ff_decklink_list_devices
int ff_decklink_list_devices(AVFormatContext *avctx)
{
IDeckLink *dl = NULL;
IDeckLinkIterator *iter = CreateDeckLinkIteratorInstance();
if (!iter) {
av_log(avctx, AV_LOG_ERROR, "Could not create DeckLink iterator\n");
return AVERROR(EIO);
}
av_log(avctx, AV_LOG_INFO, "Blackmagic DeckLink devices:\n");
while (iter->Next(&dl) == S_OK) {
const char *displayName;
ff_decklink_get_display_name(dl, &displayName);
av_log(avctx, AV_LOG_INFO, "\t'%s'\n", displayName);
av_free((void *) displayName);
dl->Release();
}
iter->Release();
return 0;
}