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


C++ IDeckLinkIterator类代码示例

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


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

示例1: gst_decklink_get_nth_device

IDeckLink *
gst_decklink_get_nth_device (int n)
{
  IDeckLinkIterator *iterator;
  IDeckLink *decklink = NULL;
  HRESULT ret;
  int i;

  iterator = CreateDeckLinkIteratorInstance ();
  if (iterator == NULL) {
    GST_ERROR ("no driver");
    return NULL;
  }

  ret = iterator->Next (&decklink);
  if (ret != S_OK) {
    GST_ERROR ("no card");
    return NULL;
  }
  for (i = 0; i < n; i++) {
    ret = iterator->Next (&decklink);
    if (ret != S_OK) {
      GST_ERROR ("no card");
      return NULL;
    }
  }

  return decklink;
}
开发者ID:drothlis,项目名称:gst-plugins-bad,代码行数:29,代码来源:gstdecklink.cpp

示例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;
}
开发者ID:G4GUO,项目名称:datvexpress_gui,代码行数:38,代码来源:dldiscover.cpp

示例3: init

bool DeckLinkController::init()  {
	IDeckLinkIterator* deckLinkIterator = NULL;
	IDeckLink* deckLink = NULL;
	bool result = false;
	
	// Create an iterator
	deckLinkIterator = CreateDeckLinkIteratorInstance();
	if (deckLinkIterator == NULL) {
		ofLogError("DeckLinkController") << "Please install the Blackmagic Desktop Video drivers to use the features of this application.";
		goto bail;
	}
	
	// List all DeckLink devices
	while (deckLinkIterator->Next(&deckLink) == S_OK) {
		// Add device to the device list
		deviceList.push_back(deckLink);
	}
	
	if (deviceList.size() == 0) {
		ofLogError("DeckLinkController") << "You will not be able to use the features of this application until a Blackmagic device is installed.";
		goto bail;
	}
	
	result = true;
	
bail:
	if (deckLinkIterator != NULL) {
		deckLinkIterator->Release();
		deckLinkIterator = NULL;
	}
	
	return result;
}
开发者ID:imclab,项目名称:ofxBlackmagic,代码行数:33,代码来源:DeckLinkController.cpp

示例4: 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;

}
开发者ID:bawNg,项目名称:krad_radio,代码行数:28,代码来源:krad_decklink_capture.cpp

示例5: 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;
}
开发者ID:G4GUO,项目名称:datvexpress_gui,代码行数:57,代码来源:dldiscover.cpp

示例6: 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;
    }
开发者ID:gmarco,项目名称:mlt-orig,代码行数:57,代码来源:producer_decklink.cpp

示例7: gst_decklink_sink_start

static gboolean
gst_decklink_sink_start (GstDecklinkSink * decklinksink)
{
  IDeckLinkIterator *iterator;
  HRESULT ret;
  const GstDecklinkMode *mode;
  BMDAudioSampleType sample_depth;

  iterator = CreateDeckLinkIteratorInstance ();
  if (iterator == NULL) {
    GST_ERROR ("no driver");
    return FALSE;
  }

  ret = iterator->Next (&decklinksink->decklink);
  if (ret != S_OK) {
    GST_ERROR ("no card");
    return FALSE;
  }

  ret = decklinksink->decklink->QueryInterface (IID_IDeckLinkOutput,
      (void **) &decklinksink->output);
  if (ret != S_OK) {
    GST_ERROR ("no output");
    return FALSE;
  }

  decklinksink->output->SetAudioCallback (decklinksink->callback);

  mode = gst_decklink_get_mode (decklinksink->mode);

  ret = decklinksink->output->EnableVideoOutput (mode->mode,
      bmdVideoOutputFlagDefault);
  if (ret != S_OK) {
    GST_ERROR ("failed to enable video output");
    return FALSE;
  }
  //decklinksink->video_enabled = TRUE;

  decklinksink->output->
      SetScheduledFrameCompletionCallback (decklinksink->callback);

  sample_depth = bmdAudioSampleType16bitInteger;
  ret = decklinksink->output->EnableAudioOutput (bmdAudioSampleRate48kHz,
      sample_depth, 2, bmdAudioOutputStreamContinuous);
  if (ret != S_OK) {
    GST_ERROR ("failed to enable audio output");
    return FALSE;
  }
  decklinksink->audio_buffer = gst_buffer_new ();

  decklinksink->num_frames = 0;

  return TRUE;
}
开发者ID:thiagoss,项目名称:gst-plugins-bad,代码行数:55,代码来源:gstdecklinksink.cpp

示例8: InitDeckLink

bool BMDOpenGLOutput::InitDeckLink()
{
    bool bSuccess = FALSE;
    IDeckLinkIterator* pDLIterator = NULL;

    pDLIterator = CreateDeckLinkIteratorInstance();
    if (pDLIterator == NULL)
    {
        QMessageBox::critical(NULL,"This application requires the DeckLink drivers installed.", "Please install the Blackmagic DeckLink drivers to use the features of this application.");
        goto error;
    }

    if (pDLIterator->Next(&pDL) != S_OK)
    {
        QMessageBox::critical(NULL,"This application requires a DeckLink device.", "You will not be able to use the features of this application until a DeckLink device is installed.");
        goto error;
    }

    if (pDL->QueryInterface(IID_IDeckLinkOutput, (void**)&pDLOutput) != S_OK)
        goto error;

    pRenderDelegate = new RenderDelegate(this);
    if (pRenderDelegate == NULL)
        goto error;

    if (pDLOutput->SetScheduledFrameCompletionCallback(pRenderDelegate) != S_OK)
        goto error;

    bSuccess = TRUE;

error:

    if (!bSuccess)
    {
        if (pDLOutput != NULL)
        {
            pDLOutput->Release();
            pDLOutput = NULL;
        }
        if (pDL != NULL)
        {
            pDL->Release();
            pDL = NULL;
        }
    }

    if (pDLIterator != NULL)
    {
        pDLIterator->Release();
        pDLIterator = NULL;
    }

    return bSuccess;
}
开发者ID:ccorn90,项目名称:skysphere,代码行数:54,代码来源:BMDOpenGLOutput.cpp

示例9: 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();
}
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:54,代码来源:gstdecklink.cpp

示例10: 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;
}
开发者ID:kylemcdonald,项目名称:ofxBlackmagicGrabber,代码行数:51,代码来源:ofxBlackmagicGrabber.cpp

示例11: 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;
  }
}
开发者ID:imclab,项目名称:plane-tracker,代码行数:48,代码来源:VideoReceiverInterface.cpp

示例12: gst_decklinksrc_class_probe_devices

static void
gst_decklinksrc_class_probe_devices (GstElementClass * klass)
{
  IDeckLinkIterator *iterator;
  IDeckLink *decklink;

  n_devices = 0;
  iterator = CreateDeckLinkIteratorInstance ();
  if (iterator) {
    while (iterator->Next (&decklink) == S_OK) {
      n_devices++;
    }
  }

  probed = TRUE;
}
开发者ID:drothlis,项目名称:gst-plugins-bad,代码行数:16,代码来源:gstdecklinksrc.cpp

示例13: 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 );
    }
开发者ID:gmarco,项目名称:mlt-orig,代码行数:46,代码来源:producer_decklink.cpp

示例14: gst_decklinksrc_list_devices

/* former device probe code, redux */
static void
gst_decklinksrc_list_devices (void)
{
  IDeckLinkIterator *iterator;
  IDeckLink *decklink;
  int n_devices;

  n_devices = 0;
  iterator = CreateDeckLinkIteratorInstance ();
  if (iterator) {
    while (iterator->Next (&decklink) == S_OK) {
      n_devices++;
    }
  }
  iterator->Release();

  g_print ("%d devices\n", n_devices);
}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:19,代码来源:gstdecklinksrc.cpp

示例15: 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;
}
开发者ID:TritonSailor,项目名称:livepro,代码行数:44,代码来源:BMDOutput.cpp


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