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


C++ IDeckLink::GetModelName方法代码示例

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


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

示例1: 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

示例2:

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;
}
开发者ID:Mistobaan,项目名称:CasparCG,代码行数:29,代码来源:decklink.cpp

示例3: CreateDeckLinkIteratorInstance

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

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

示例5: 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

示例6: listDevice

OFX_DECKLINK_API_BEGIN_NAMESPACE

vector<Device> listDevice()
{
    vector<Device> devinfo;
    
	IDeckLinkIterator* deckLinkIterator = CreateDeckLinkIteratorInstance();
	if (deckLinkIterator == NULL)
	{
		ofLogError("ofxDeckLinkAPI::Monitor") << "This application requires the DeckLink drivers installed." << "\n" << "Please install the Blackmagic DeckLink drivers to use the features of this application.";
	}
	
	cout << "==== ofxDeckLinkAPI::listDevice() ====" << endl;
	
	IDeckLink* deckLink = NULL;
	HRESULT result;
	int num_device = 0;
	
	while (deckLinkIterator->Next(&deckLink) == S_OK)
	{
        Device dev;
		CFStringRef deviceNameCFString = NULL;
		
		result = deckLink->GetModelName(&deviceNameCFString);
		if (result == S_OK)
		{
			char deviceName[64];
			CFStringGetCString(deviceNameCFString, deviceName, sizeof(deviceName), kCFStringEncodingUTF8);
			cout << num_device << ": " << deviceName;
			CFRelease(deviceNameCFString);
            dev.model_name = (string)deviceName;
		}
        IDeckLinkAttributes* attr = NULL;
        deckLink->QueryInterface(IID_IDeckLinkAttributes, (void**)&attr);
        if (attr != NULL) {
            {
                int64_t v = 0;
                if (attr->GetInt(BMDDeckLinkPersistentID, &v) == S_OK) {
                    dev.persistent_id = v;
                    cout << ", pid:" << v;
                }
            }
            {
                int64_t v = 0;
                if (attr->GetInt(BMDDeckLinkTopologicalID, &v) == S_OK) {
                    dev.topological_id = v;
                    cout << ", tid:" << v;
                }
            }
        }
        cout << endl;
        devinfo.push_back(dev);
		
		deckLink->Release();
		
		num_device++;
	}
	
	if (num_device == 0)
		cout << "device not found" << endl;
	
	cout << "======================================" << endl << endl;
	
	if (deckLinkIterator != NULL)
	{
		deckLinkIterator->Release();
		deckLinkIterator = NULL;
	}
    
    return devinfo;
}
开发者ID:hanasaan,项目名称:ofxDeckLink,代码行数:71,代码来源:ofxDeckLink.cpp

示例7: usage

int usage(int status)
{
    HRESULT result;
    IDeckLinkIterator *deckLinkIterator;
    IDeckLink *deckLink;
    int numDevices = 0;

    fprintf(stderr,
            "Usage: bmdplay -m <mode id> [OPTIONS]\n"
            "\n"
            "    -m <mode id>:\n"
            );

    // 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) {
        BMDProbeString str;

        // 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(&str);
        if (result == S_OK) {
            printf("-> %s (-C %d )\n\n",
                   ToStr(str),
                   numDevices - 1);
            FreeStr(str);
        }

        print_output_modes(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");

    fprintf(
        stderr,
        "    -f <filename>        Filename raw video will be written to\n"
        "    -C <num>             Card number to be used\n"
        "    -b <num>             Milliseconds of pre-buffering before playback (default = 2000 ms)\n"
        "    -p <pixel>           PixelFormat Depth (8 or 10 - default is 8)\n"
        "    -O <output>          Output connection:\n"
        "                         1: Composite video + analog audio\n"
        "                         2: Components video + analog audio\n"
        "                         3: HDMI video + audio\n"
        "                         4: SDI video + audio\n\n");

    return status;
}
开发者ID:djlancelot,项目名称:bmdtools,代码行数:65,代码来源:bmdplay.cpp

示例8: krad_decklink_cpp_get_device_name

void krad_decklink_cpp_get_device_name (int device_num, char *device_name) {

	IDeckLinkIterator *deckLinkIterator;
	IDeckLink *deckLink;
	int device_count;
	HRESULT result;
#ifdef IS_LINUX
	char *device_name_temp;
#endif
#ifdef IS_MACOSX
  CFStringRef device_name_temp;
#endif
	device_name_temp = NULL;
	device_count = 0;
	
	deckLinkIterator = CreateDeckLinkIteratorInstance();
	
	if (deckLinkIterator == NULL) {
		printke ("krad_decklink_detect_devices: The DeckLink drivers may not be installed.");
		return;
	}
	
	while (deckLinkIterator->Next(&deckLink) == S_OK) {

		if (device_count == device_num) {
#ifdef IS_LINUX
			result = deckLink->GetModelName((const char **) &device_name_temp);
			if (result == S_OK) {
				strcpy(device_name, device_name_temp);
				free(device_name_temp);
#endif
#ifdef IS_MACOSX
			result = deckLink->GetModelName(&device_name_temp);
			if (result == S_OK) {
        CFStringGetCString(device_name_temp, device_name, 64, kCFStringEncodingMacRoman);
				CFRelease(device_name_temp);
#endif

			} else {
				strcpy(device_name, "Unknown Error in GetModelName");
			}
			deckLink->Release();
			deckLinkIterator->Release();
			return;
		}

		device_count++;
		deckLink->Release();
	}
	
	deckLinkIterator->Release();
	
	sprintf(device_name, "Could not get a device name for device %d", device_num);
	
	return;

}




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

示例9: usage

int usage(int status)
{
    HRESULT result;
    IDeckLinkIterator *deckLinkIterator;
    IDeckLink *deckLink;
    int numDevices = 0;
//  int                displayModeCount = 0;

    fprintf(stderr,
            "Usage: bmdcapture -m <mode id> [OPTIONS]\n"
            "\n"
            "    -m <mode id>:\n"
            );

    // 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) {
        BMDProbeString str;
        // 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(&str);
        if (result == S_OK) {
            printf("-> %s (-C %d )\n\n",
                   ToStr(str),
                   numDevices - 1);
            FreeStr(str);
        }

        print_output_modes(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");

/*
 *  if (displayModeIterator)
 *  {
 *      // we try to print out some useful information about the chosen
 *      // card, but this only works if a card has been selected successfully
 *
 *      while (displayModeIterator->Next(&displayMode) == S_OK)
 *      {
 *          char *          displayModeString = NULL;
 *
 *          result = displayMode->GetName((const char **) &displayModeString);
 *          if (result == S_OK)
 *          {
 *              BMDTimeValue frameRateDuration, frameRateScale;
 *              displayMode->GetFrameRate(&frameRateDuration, &frameRateScale);
 *              fprintf(stderr, "        %2d:  %-20s \t %li x %li \t %g FPS\n",
 *                  displayModeCount, displayModeString, displayMode->GetWidth(), displayMode->GetHeight(), (double)frameRateScale / (double)frameRateDuration);
 *              free(displayModeString);
 *              displayModeCount++;
 *          }
 *
 *          // Release the IDeckLinkDisplayMode object to prevent a leak
 *          displayMode->Release();
 *      }
 *  }
 */
    fprintf(
        stderr,
        "    -v                   Be verbose (report each 25 frames)\n"
        "    -f <filename>        Filename raw video will be written to\n"
        "    -F <format>          Define the file format to be used\n"
        "    -c <channels>        Audio Channels (2, 8 or 16 - default is 2)\n"
        "    -s <depth>           Audio Sample Depth (16 or 32 - default is 16)\n"
        "    -p <pixel>           PixelFormat Depth (8 or 10 - default is 8)\n"
        "    -n <frames>          Number of frames to capture (default is unlimited)\n"
        "    -M <memlimit>        Maximum queue size in GB (default is 1 GB)\n"
        "    -C <num>             number of card to be used\n"
        "    -S <serial_device>   data input serial\n"
        "    -A <audio-in>        Audio input:\n"
        "                         1: Analog (RCA or XLR)\n"
        "                         2: Embedded Audio (HDMI/SDI)\n"
        "                         3: Digital Audio (AES/EBU)\n"
        "    -V <video-in>        Video input:\n"
        "                         1: Composite\n"
        "                         2: Component\n"
        "                         3: HDMI\n"
        "                         4: SDI\n"
//.........这里部分代码省略.........
开发者ID:grzechuj,项目名称:bmdtools,代码行数:101,代码来源:bmdcapture.cpp

示例10: ParseArguments


//.........这里部分代码省略.........
				m_lcmChannelName = optarg;
				break;

			case 'a':
				m_audioOutputFile = optarg;
				break;

			case 'n':
				m_maxFrames = atoi(optarg);
				break;

			case 'q':
				m_compressionQuality = atoi(optarg);
				break;

			case '3':
				m_inputFlags |= bmdVideoInputDualStream3D;
				break;

			case 'p':
				switch(atoi(optarg))
				{
					case 0: m_pixelFormat = bmdFormat8BitYUV; break;
					case 1: m_pixelFormat = bmdFormat10BitYUV; break;
					case 2: m_pixelFormat = bmdFormat10BitRGB; break;
					default:
						fprintf(stderr, "Invalid argument: Pixel format %d is not valid", atoi(optarg));
						return false;
				}
				break;

			case 't':
				if (!strcmp(optarg, "rp188"))
					m_timecodeFormat = bmdTimecodeRP188Any;
				else if (!strcmp(optarg, "vitc"))
					m_timecodeFormat = bmdTimecodeVITC;
				else if (!strcmp(optarg, "serial"))
					m_timecodeFormat = bmdTimecodeSerial;
				else
				{
					fprintf(stderr, "Invalid argument: Timecode format \"%s\" is invalid\n", optarg);
					return false;
				}
				break;

			case '?':
			case 'h':
				displayHelp = true;
		}
	}
        

	if (m_deckLinkIndex < 0)
	{
		fprintf(stderr, "You must select a device\n");
		DisplayUsage(1);
	}

	if (m_displayModeIndex < -1)
	{
		fprintf(stderr, "You must select a display mode\n");
		DisplayUsage(1);
	}

	if (displayHelp)
		DisplayUsage(0);

	// Get device and display mode names
	IDeckLink* deckLink = GetDeckLink(m_deckLinkIndex);

	if (deckLink != NULL)
	{
		if (m_displayModeIndex != -1)
		{
			IDeckLinkDisplayMode* displayMode = GetDeckLinkDisplayMode(deckLink, m_displayModeIndex);
			if (displayMode != NULL)
			{
				displayMode->GetName((const char**)&m_displayModeName);
				displayMode->Release();
			}
			else
			{
				m_displayModeName = strdup("Invalid");
			}
		}
		else
		{
			m_displayModeName = strdup("Format Detection");
		}

		deckLink->GetModelName((const char**)&m_deckLinkName);
		deckLink->Release();
	}
	else
	{
		m_deckLinkName = strdup("Invalid");
	}

	return true;
}
开发者ID:Gastd,项目名称:oh-distro,代码行数:101,代码来源:Config.cpp

示例11: DisplayUsage

void BMDConfig::DisplayUsage(int status)
{
	HRESULT							result = E_FAIL;
	IDeckLinkIterator*				deckLinkIterator = CreateDeckLinkIteratorInstance();
	IDeckLinkDisplayModeIterator*	displayModeIterator = NULL;

	IDeckLink*						deckLink = NULL;
	IDeckLink*						deckLinkSelected = NULL;
	int								deckLinkCount = 0;
	char*							deckLinkName = NULL;

	IDeckLinkAttributes*			deckLinkAttributes = NULL;
	bool							formatDetectionSupported;

	IDeckLinkInput*					deckLinkInput = NULL;
	IDeckLinkDisplayMode*			displayModeUsage;
	int								displayModeCount = 0;
	char*							displayModeName;

	fprintf(stderr,
		"Usage: Capture -d <device id> -m <mode id> [OPTIONS]\n"
		"\n"
		"    -d <device id>:\n"
	);

	// Loop through all available devices
	while (deckLinkIterator->Next(&deckLink) == S_OK)
	{
		result = deckLink->GetModelName((const char**)&deckLinkName);
		if (result == S_OK)
		{
			fprintf(stderr,
				"        %2d: %s%s\n",
				deckLinkCount,
				deckLinkName,
				deckLinkCount == m_deckLinkIndex ? " (selected)" : ""
			);

			free(deckLinkName);
		}

		if (deckLinkCount == m_deckLinkIndex)
			deckLinkSelected = deckLink;
		else
			deckLink->Release();

		++deckLinkCount;
	}

	if (deckLinkCount == 0)
		fprintf(stderr, "        No DeckLink devices found. Is the driver loaded?\n");

	deckLinkName = NULL;

	if (deckLinkSelected != NULL)
		deckLinkSelected->GetModelName((const char**)&deckLinkName);

	fprintf(stderr,
		"    -m <mode id>: (%s)\n",
		deckLinkName ? deckLinkName : ""
	);

	if (deckLinkName != NULL)
		free(deckLinkName);

	// Loop through all available display modes on the delected DeckLink device
	if (deckLinkSelected == NULL)
	{
		fprintf(stderr, "        No DeckLink device selected\n");
		goto bail;
	}

	result = deckLinkSelected->QueryInterface(IID_IDeckLinkAttributes, (void**)&deckLinkAttributes);
	if (result == S_OK)
	{
		result = deckLinkAttributes->GetFlag(BMDDeckLinkSupportsInputFormatDetection, &formatDetectionSupported);
		if (result == S_OK && formatDetectionSupported)
			fprintf(stderr, "        -1:  auto detect format\n");
	}

	result = deckLinkSelected->QueryInterface(IID_IDeckLinkInput, (void**)&deckLinkInput);
	if (result != S_OK)
		goto bail;

	result = deckLinkInput->GetDisplayModeIterator(&displayModeIterator);
	if (result != S_OK)
		goto bail;

	while (displayModeIterator->Next(&displayModeUsage) == S_OK)
	{
		result = displayModeUsage->GetName((const char **)&displayModeName);
		if (result == S_OK)
		{
			BMDTimeValue frameRateDuration;
			BMDTimeValue frameRateScale;

			displayModeUsage->GetFrameRate(&frameRateDuration, &frameRateScale);

			fprintf(stderr,
				"        %2d:  %-20s \t %li x %li \t %g FPS\n",
//.........这里部分代码省略.........
开发者ID:Gastd,项目名称:oh-distro,代码行数:101,代码来源:Config.cpp

示例12: main

int main (int argc, char* argv[]) {

	printf("DeckControl Test Application\n\n");

	IDeckLinkIterator*		deckLinkIterator;
	IDeckLink*				deckLink;
	int						numDevices = 0;
	HRESULT					result;

	fdSerial = -1;
	
	// 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)
	{
		CFStringRef		deviceNameCFString = 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(&deviceNameCFString);
		if (result == S_OK)
		{
			IDeckLinkAttributes*	deckLinkAttributes;
		
			char			deviceName[64];
			
			HRESULT			attributeResult;
			CFStringRef		serialName;
			bool			serialSupported;
			
			CFStringGetCString(deviceNameCFString, deviceName, sizeof(deviceName), kCFStringEncodingMacRoman);
			printf("Found Blackmagic device: %s\n", deviceName);
			
			attributeResult = deckLink->QueryInterface(IID_IDeckLinkAttributes, (void**)&deckLinkAttributes);
			if (attributeResult != S_OK)
			{
				fprintf(stderr, "Could not obtain the IDeckLinkAttributes interface");
			}
			else
			{
				attributeResult = deckLinkAttributes->GetFlag(BMDDeckLinkHasSerialPort, &serialSupported);	// are serial ports supported on device?
				if (attributeResult == S_OK && serialSupported)			
				{							
					attributeResult = deckLinkAttributes->GetString(BMDDeckLinkSerialPortDeviceName, &serialName);	// get serial port name
					if (attributeResult == S_OK)
					{
						char portName[64];
						CFStringGetCString(serialName, portName, sizeof(portName), kCFStringEncodingMacRoman);
						printf("Serial port name: %s\n",portName);
				
						if (openSerialDevice((char*)&portName)== true)		// open serial port
						{
							printf("Device opened\n");
							playCommand();									// Play deck, 
							printf("Delay 3 seconds\n");
							sleep(3);
							timeCodeCommand();								// DisplayTC
							printf("Delay 3 seconds\n");
							sleep(3);
							stopCommand();									// Stop deck
							closeSerialDevice();							// close serial port
						}					
						else printf("Device open fail\n");									
						CFRelease(serialName);					
					}
					else printf("Unable to get serial port device name\n");
				}
				else printf("Serial port not supported\n");
			}
			CFRelease(deviceNameCFString);		// Release the IDeckLink instance when we've finished with it to prevent leaks
		}		
		deckLink->Release();
	}
	if (deckLinkIterator) 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:DishBird,项目名称:VideoSuiteUtilities,代码行数:92,代码来源:main.cpp


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