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


C++ IDeckLinkDisplayMode::GetName方法代码示例

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


在下文中一共展示了IDeckLinkDisplayMode::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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; 
}
开发者ID:TritonSailor,项目名称:livepro,代码行数:30,代码来源:BMDOutput.cpp

示例2: while

IDeckLinkDisplayMode *Player::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) {
        BMDProbeString str;

        if (deckLinkDisplayMode->GetName(&str) == S_OK) {
            if (index == selectedIndex) {
                printf("Selected mode: %s\n\n\n", ToStr(str));
                selectedMode = deckLinkDisplayMode;
                FreeStr(str);
                goto bail;
            }
        }
        index++;
    }
bail:
    displayModeIterator->Release();
    return selectedMode;
}
开发者ID:djlancelot,项目名称:bmdtools,代码行数:27,代码来源:bmdplay.cpp

示例3: RefreshDisplayModeMenu

void CSignalGeneratorDlg::RefreshDisplayModeMenu(void)
{
	// Populate the display mode combo with a list of display modes supported by the installed DeckLink card
	IDeckLinkDisplayModeIterator*	displayModeIterator;
	IDeckLinkDisplayMode*			deckLinkDisplayMode;
	BMDPixelFormat					pixelFormat;
	
	pixelFormat = (BMDPixelFormat)m_pixelFormatCombo.GetItemData(m_pixelFormatCombo.GetCurSel());

	for (int i = 1; i < m_videoFormatCombo.GetCount(); i++)
	{
		deckLinkDisplayMode = (IDeckLinkDisplayMode*)m_videoFormatCombo.GetItemDataPtr(i-1);
		deckLinkDisplayMode->Release();
	}
	m_videoFormatCombo.ResetContent();
	
	if (m_deckLinkOutput->GetDisplayModeIterator(&displayModeIterator) != S_OK)
		return;
	
	while (displayModeIterator->Next(&deckLinkDisplayMode) == S_OK)
	{
		BSTR					modeName;
		int						newIndex;
		HRESULT					hr;
		BMDDisplayModeSupport	displayModeSupport;
		BMDVideoOutputFlags		videoOutputFlags = bmdVideoOutputDualStream3D;

		if (deckLinkDisplayMode->GetName(&modeName) != S_OK)
		{
			deckLinkDisplayMode->Release();
			continue;
		}
		
		CString modeNameCString(modeName);
		newIndex = m_videoFormatCombo.AddString(modeNameCString);
		m_videoFormatCombo.SetItemDataPtr(newIndex, deckLinkDisplayMode); 
		
		hr = m_deckLinkOutput->DoesSupportVideoMode(deckLinkDisplayMode->GetDisplayMode(), pixelFormat, videoOutputFlags, &displayModeSupport, NULL);
		if (hr != S_OK || ! displayModeSupport)
		{
			SysFreeString(modeName);
			continue;
		}

		CString modeName3DCString(modeName);
		modeName3DCString += _T(" 3D");
		newIndex = m_videoFormatCombo.AddString(modeName3DCString);
		m_videoFormatCombo.SetItemDataPtr(newIndex, deckLinkDisplayMode);
		deckLinkDisplayMode->AddRef();

		SysFreeString(modeName);
	}
	displayModeIterator->Release();

	m_videoFormatCombo.SetCurSel(0);
}
开发者ID:hhool,项目名称:Blackmagic_DeckLink_SDK,代码行数:56,代码来源:SignalGeneratorDlg.cpp

示例4: fprintf

int
usage (int status)
{
  HRESULT result;
  IDeckLinkDisplayMode *displayMode;
  int displayModeCount = 0;

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

  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,
      "    -p <pixelformat>\n"
      "         0:  8 bit YUV (4:2:2) (default)\n"
      "         1:  10 bit YUV (4:2:2)\n"
      "         2:  10 bit RGB (4:4:4)\n"
      "    -t <format>          Print timecode\n"
      "     rp188:  RP 188\n"
      "      vitc:  VITC\n"
      "    serial:  Serial Timecode\n"
      "    -f <filename>        Filename raw video will be written to\n"
      "    -a <filename>        Filename raw audio will be written to\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"
      "    -n <frames>          Number of frames to capture (default is unlimited)\n"
      "    -3                   Capture Stereoscopic 3D (Requires 3D Hardware support)\n"
      "\n"
      "Capture video and/or audio to a file. Raw video and/or audio can be viewed with mplayer eg:\n"
      "\n"
      "    Capture -m2 -n 50 -f video.raw -a audio.raw\n"
      "    mplayer video.raw -demuxer rawvideo -rawvideo pal:uyvy -audiofile audio.raw -audio-demuxer 20 -rawaudio rate=48000\n");

  exit (status);
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:53,代码来源:capture.cpp

示例5: 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();
}
开发者ID:djlancelot,项目名称:bmdtools,代码行数:64,代码来源:bmdplay.cpp

示例6: krad_decklink_capture_info

void krad_decklink_capture_info () {

	IDeckLink *deckLink;
	IDeckLinkInput *deckLinkInput;
	IDeckLinkIterator *deckLinkIterator;
	IDeckLinkDisplayModeIterator *displayModeIterator;
	IDeckLinkDisplayMode *displayMode;
	
	HRESULT result;
	int displayModeCount;
	char *displayModeString;

	displayModeString = NULL;
	displayModeCount = 0;
	
	deckLinkIterator = CreateDeckLinkIteratorInstance();
	
	if (!deckLinkIterator) {
		printke ("Krad Decklink: This application requires the DeckLink drivers installed.\n");
	}
	
	/* Connect to the first DeckLink instance */
	result = deckLinkIterator->Next(&deckLink);
	if (result != S_OK) {
		printke ("Krad Decklink: No DeckLink PCI cards found.\n");
	}
    
	result = deckLink->QueryInterface(IID_IDeckLinkInput, (void**)&deckLinkInput);
	if (result != S_OK) {
		printke ("Krad Decklink: Fail QueryInterface\n");
	}
	
	result = deckLinkInput->GetDisplayModeIterator(&displayModeIterator);
	if (result != S_OK) {
		printke ("Krad Decklink: Could not obtain the video output display mode iterator - result = %08x\n", result);
	}


    while (displayModeIterator->Next(&displayMode) == S_OK) {

        result = displayMode->GetName((const char **) &displayModeString);
        
        if (result == S_OK) {
			
			BMDTimeValue frameRateDuration, frameRateScale;
			displayMode->GetFrameRate(&frameRateDuration, &frameRateScale);

			printkd ("%2d:  %-20s \t %li x %li \t %g FPS\n", 
				displayModeCount, displayModeString, displayMode->GetWidth(), displayMode->GetHeight(), 
				(double)frameRateScale / (double)frameRateDuration);
			
            free (displayModeString);
			displayModeCount++;
		}
		
		displayMode->Release();
	}
	
	if (displayModeIterator != NULL) {
		displayModeIterator->Release();
		displayModeIterator = NULL;
	}

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

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

	if (deckLinkIterator != NULL) {
		deckLinkIterator->Release();
	}
}
开发者ID:bawNg,项目名称:krad_radio,代码行数:77,代码来源:krad_decklink_capture.cpp

示例7: setup

void SignalGenerator::setup()
{
	IDeckLinkIterator*			deckLinkIterator = NULL;
	bool						success = false;
	
	// **** Find a DeckLink instance and obtain video output interface
	deckLinkIterator = CreateDeckLinkIteratorInstance();
	if (deckLinkIterator == NULL)
	{
		QMessageBox::critical(this, "This application requires the DeckLink drivers installed.", "Please install the Blackmagic DeckLink drivers to use the features of this application.");
		goto bail;
	}
	
	// Connect to the first DeckLink instance
	if (deckLinkIterator->Next(&deckLink) != S_OK)
	{
		QMessageBox::critical(this, "This application requires a DeckLink PCI card.", "You will not be able to use the features of this application until a DeckLink PCI card is installed.");
		goto bail;
	}
	
	// Obtain the audio/video output interface (IDeckLinkOutput)
	if (deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&deckLinkOutput) != S_OK)
		goto bail;
	
	// Create a delegate class to allow the DeckLink API to call into our code
	playerDelegate = new PlaybackDelegate(this, deckLinkOutput);
	if (playerDelegate == NULL)
		goto bail;
	// Provide the delegate to the audio and video output interfaces
	deckLinkOutput->SetScheduledFrameCompletionCallback(playerDelegate);
	deckLinkOutput->SetAudioCallback(playerDelegate);
	
	
	// Populate the display mode menu with a list of display modes supported by the installed DeckLink card
	IDeckLinkDisplayModeIterator*		displayModeIterator;
	IDeckLinkDisplayMode*				deckLinkDisplayMode;
	
	ui->videoFormatPopup->clear();
	if (deckLinkOutput->GetDisplayModeIterator(&displayModeIterator) != S_OK)
		goto bail;
	while (displayModeIterator->Next(&deckLinkDisplayMode) == S_OK)
	{
		const char *		modeName;
		
		if (deckLinkDisplayMode->GetName(&modeName) == S_OK)
		{
			ui->videoFormatPopup->addItem(modeName, QVariant::fromValue((void *)deckLinkDisplayMode));
		}
	}
	displayModeIterator->Release();
	enableInterface(true);	
	deckLinkOutput->SetScreenPreviewCallback(previewView);
	
	success = true;
	
bail:
	if (success == false)
	{
		// Release any resources that were partially allocated
		if (deckLinkOutput != NULL)
		{
			deckLinkOutput->Release();
			deckLinkOutput = NULL;
		}
		//
		if (deckLink != NULL)
		{
			deckLink->Release();
			deckLink = NULL;
		}

		// Disable the user interface if we could not succsssfully connect to a DeckLink device
		ui->startButton->setEnabled(false);
		enableInterface(false);
	}
	
	if (deckLinkIterator != NULL)
		deckLinkIterator->Release();
}
开发者ID:wolfg1969,项目名称:Blackmagic-Decklink-SDK-Archive,代码行数:79,代码来源:SignalGenerator.cpp

示例8:

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

示例9: processArguments


//.........这里部分代码省略.........
     }
     fprintf(stderr, "\n");


     //glWidget->initShaderProgram();
     delegate = new DeckLinkCaptureDelegate(glWidget);
     connect(delegate, SIGNAL(updateGLSignal()), glWidget, SLOT(updateGLSlot()));
     deckLinkInput->SetCallback(delegate);
   
     // Obtain an IDeckLinkDisplayModeIterator to enumerate the display modes supported on output
     result = deckLinkInput->GetDisplayModeIterator(&displayModeIterator);
     if (result != S_OK)
     {
          fprintf(stderr, "Could not obtain the video output display mode iterator - result = %08x\n", result);
          return -1;
     }


     if (g_videoModeIndex < 0)
     {
          fprintf(stderr, "No video mode specified\n");
          usage();
          return -1;
     }

     while (displayModeIterator->Next(&displayMode) == S_OK)
     {
          if (g_videoModeIndex == displayModeCount)
          {
               BMDDisplayModeSupport result;
               const char *displayModeName;
               
               foundDisplayMode = true;
               displayMode->GetName(&displayModeName);
               selectedDisplayMode = displayMode->GetDisplayMode();
               
               deckLinkInput->DoesSupportVideoMode(selectedDisplayMode, pixelFormat, bmdVideoInputFlagDefault, &result, NULL);

               if (result == bmdDisplayModeNotSupported)
               {
                    fprintf(stderr, "The display mode %s is not supported with the selected pixel format\n", displayModeName);
                    return -1;
               }

               if (inputFlags & bmdVideoInputDualStream3D)
               {
                    if (!(displayMode->GetFlags() & bmdDisplayModeSupports3D))
                    {
                         fprintf(stderr, "The display mode %s is not supported with 3D\n", displayModeName);
                         return -1;
                    }
               }
               fprintf(stderr, "Selecting mode: %s\n", displayModeName);
               
               break;
          }
          displayModeCount++;
          displayMode->Release();
     }

     if (!foundDisplayMode)
     {
          fprintf(stderr, "Invalid mode %d specified\n", g_videoModeIndex);
          return -1;
     }
开发者ID:hoangnguyen177,项目名称:NativeDecklinkCapture,代码行数:66,代码来源:window.cpp

示例10: main


//.........这里部分代码省略.........
        fprintf(stderr, "Format detection is not supported on this device\n");
        goto bail;
      }
    }

    g_config.m_inputFlags |= bmdVideoInputEnableFormatDetection;

    // Format detection still needs a valid mode to start with
    idx = 0;
  } else {
    idx = g_config.m_displayModeIndex;
  }

  result = g_deckLinkInput->GetDisplayModeIterator(&displayModeIterator);
  if (result != S_OK) {
    goto bail;
  }

  while ((result = displayModeIterator->Next(&displayMode)) == S_OK) {
    if (idx == 0) {
      break;
    }
    --idx;

    displayMode->Release();
  }

  if (result != S_OK || displayMode == NULL) {
    fprintf(stderr, "Unable to get display mode %d\n", g_config.m_displayModeIndex);
    goto bail;
  }

  // Get display mode name
  result = displayMode->GetName((const char**)&displayModeName);
  if (result != S_OK) {
    displayModeName = (char *)malloc(32);
    snprintf(displayModeName, 32, "[index %d]", g_config.m_displayModeIndex);
  }

  // Check display mode is supported with given options
  result = g_deckLinkInput->DoesSupportVideoMode(displayMode->GetDisplayMode(), g_config.m_pixelFormat, bmdVideoInputFlagDefault, &displayModeSupported, NULL);
  if (result != S_OK)
    goto bail;

  if (displayModeSupported == bmdDisplayModeNotSupported)
  {
    fprintf(stderr, "The display mode %s is not supported with the selected pixel format\n", displayModeName);
    goto bail;
  }

  if (g_config.m_inputFlags & bmdVideoInputDualStream3D)
  {
    if (!(displayMode->GetFlags() & bmdDisplayModeSupports3D))
    {
      fprintf(stderr, "The display mode %s is not supported with 3D\n", displayModeName);
      goto bail;
    }
  }

  // Print the selected configuration
  g_config.DisplayConfiguration();

  // Configure the capture callback
  delegate = new DeckLinkCaptureDelegate();
  g_deckLinkInput->SetCallback(delegate);
开发者ID:sfc-arch,项目名称:bmd-4k-streaming,代码行数:66,代码来源:StreamTcpMultiThread.cpp

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

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

示例13: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	int						numDevices = 0; 
	HRESULT					result;
	IDeckLinkAttributes		*deckLinkAttributes = NULL;
	HRESULT					attributeResult;
	BOOL					keyingSupported;
	BOOL					HDkeyingSupported;
	int						selectedMode = 0;

	printf("GDI Keyer Sample Application\n\n"); 
	// Initialize COM on this thread
	result = CoInitialize(NULL);

	if (FAILED(result))
	{
		fprintf(stderr, "Initialization of COM failed - result = %08x.\n", result);
		return 1;
	}
	
	// Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
	result = CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**)&deckLinkIterator);
	if (FAILED(result))
	{
		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) 
	{ 
		BSTR	deviceNameBSTR = 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(&deviceNameBSTR); 
		if (result == S_OK) 
		{	
			_bstr_t deviceName(deviceNameBSTR);		

			printf("Found Blackmagic device: %s\n", (char*)deviceName);
			attributeResult = deckLink->QueryInterface(IID_IDeckLinkAttributes, (void**)&deckLinkAttributes);
			if (attributeResult != S_OK)
			{
				fprintf(stderr, "Could not obtain the IDeckLinkAttributes interface");
				return 1;
			}
			else
			{
				attributeResult = deckLinkAttributes->GetFlag(BMDDeckLinkSupportsInternalKeying, &keyingSupported);	// is keying supported on this device?
				if (attributeResult == S_OK && keyingSupported)			
				{
					IDeckLinkDisplayModeIterator* displayModeIterator = NULL;
					IDeckLinkDisplayMode* deckLinkDisplayMode = NULL;

					attributeResult = deckLinkAttributes->GetFlag(BMDDeckLinkSupportsHDKeying, &HDkeyingSupported);
					if (attributeResult == S_OK && HDkeyingSupported)
						printf("HD Mode keying supported.\n");
					else
						printf("SD Mode Keying supported.\n");
					// check if automode detection support - if so, use it for autodetection				
					if (CheckFormatDetect(deckLinkAttributes) == 0)
					{
						fprintf(stderr, "Input mode detection not supported\n");

						if (deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&deckLinkOutput) != S_OK)
						{
							fprintf(stderr, "Could not obtain the IDeckLinkOutput interface\n");
						}
						else
						{
							int		index = 0;
							if (deckLinkOutput->GetDisplayModeIterator(&displayModeIterator) != S_OK)
							{
								fprintf(stderr, "Could not obtain the display mode iterator\n");
							}
							else
							{
								printf("\n");
								while (displayModeIterator->Next(&deckLinkDisplayMode) == S_OK)
								{
									BSTR			displayModeBSTR = NULL;
									int				modeWidth;
									int				modeHeight;
									BMDTimeValue	frameRateDuration;
									BMDTimeScale	frameRateScale;

									// Obtain the display mode's properties
									modeWidth = deckLinkDisplayMode->GetWidth();
									modeHeight = deckLinkDisplayMode->GetHeight();
									deckLinkDisplayMode->GetFrameRate(&frameRateDuration, &frameRateScale);
									if ((deckLinkDisplayMode->GetWidth() > 720) && !HDkeyingSupported)
										continue;

									if (deckLinkDisplayMode->GetName(&displayModeBSTR) == S_OK)
									{
//.........这里部分代码省略.........
开发者ID:DishBird,项目名称:VideoSuiteUtilities,代码行数:101,代码来源:GdiKeyer.cpp

示例14: if


//.........这里部分代码省略.........
    }
  }

  if (g_videoModeIndex < 0) {
    fprintf (stderr, "No video mode specified\n");
    usage (0);
  }

  if (g_videoOutputFile != NULL) {
    videoOutputFile =
        open (g_videoOutputFile, O_WRONLY | O_CREAT | O_TRUNC, 0664);
    if (videoOutputFile < 0) {
      fprintf (stderr, "Could not open video output file \"%s\"\n",
          g_videoOutputFile);
      goto bail;
    }
  }
  if (g_audioOutputFile != NULL) {
    audioOutputFile =
        open (g_audioOutputFile, O_WRONLY | O_CREAT | O_TRUNC, 0664);
    if (audioOutputFile < 0) {
      fprintf (stderr, "Could not open audio output file \"%s\"\n",
          g_audioOutputFile);
      goto bail;
    }
  }

  while (displayModeIterator->Next (&displayMode) == S_OK) {
    if (g_videoModeIndex == displayModeCount) {
      BMDDisplayModeSupport result;
      const char *displayModeName;

      foundDisplayMode = true;
      displayMode->GetName (&displayModeName);
      selectedDisplayMode = displayMode->GetDisplayMode ();

      deckLinkInput->DoesSupportVideoMode (selectedDisplayMode, pixelFormat,
          bmdVideoInputFlagDefault, &result, NULL);

      if (result == bmdDisplayModeNotSupported) {
        fprintf (stderr,
            "The display mode %s is not supported with the selected pixel format\n",
            displayModeName);
        goto bail;
      }

      if (inputFlags & bmdVideoInputDualStream3D) {
        if (!(displayMode->GetFlags () & bmdDisplayModeSupports3D)) {
          fprintf (stderr, "The display mode %s is not supported with 3D\n",
              displayModeName);
          goto bail;
        }
      }

      break;
    }
    displayModeCount++;
    displayMode->Release ();
  }

  if (!foundDisplayMode) {
    fprintf (stderr, "Invalid mode %d specified\n", g_videoModeIndex);
    goto bail;
  }

  result =
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:67,代码来源:capture.cpp

示例15: Open


//.........这里部分代码省略.........

    if (sys->autodetect) {
        msg_Dbg(demux, "Card supports input format detection");
        flags |= bmdVideoInputEnableFormatDetection;
        /* Enable a random format, we will reconfigure on format detection */
        u.id = htonl(bmdModeHD1080p2997);
    } else {
        if (!mode || strlen(mode) < 3 || strlen(mode) > 4) {
            msg_Err(demux, "Invalid mode: \'%s\'", mode ? mode : "");
            free(mode);
            goto finish;
        }

        msg_Dbg(demux, "Looking for mode \'%s\'", mode);
        memcpy(u.str, mode, 4);
        if (u.str[3] == '\0')
            u.str[3] = ' '; /* 'pal'\0 -> 'pal ' */
        free(mode);
    }

    es_format_t video_fmt;
    video_fmt.video.i_width = 0;

    for (IDeckLinkDisplayMode *m;; m->Release()) {
        if ((mode_it->Next(&m) != S_OK) || !m)
            break;

        const char *mode_name;
        BMDTimeValue frame_duration, time_scale;
        uint32_t field_flags;
        const char *field = GetFieldDominance(m->GetFieldDominance(), &field_flags);
        BMDDisplayMode id = ntohl(m->GetDisplayMode());

        if (m->GetName(&mode_name) != S_OK)
            mode_name = "unknown";
        if (m->GetFrameRate(&frame_duration, &time_scale) != S_OK) {
            time_scale = 0;
            frame_duration = 1;
        }

        msg_Dbg(demux, "Found mode '%4.4s': %s (%dx%d, %.3f fps%s)",
                 (char*)&id, mode_name,
                 (int)m->GetWidth(), (int)m->GetHeight(),
                 double(time_scale) / frame_duration, field);

        if (u.id == id) {
            video_fmt = GetModeSettings(demux, m);
            msg_Dbg(demux, "Using that mode");
        }
    }

    mode_it->Release();

    if (video_fmt.video.i_width == 0) {
        msg_Err(demux, "Unknown video mode `%4.4s\' specified.", (char*)&u.id);
        goto finish;
    }

    if (sys->input->EnableVideoInput(htonl(u.id), fmt, flags) != S_OK) {
        msg_Err(demux, "Failed to enable video input");
        goto finish;
    }

    /* Set up audio. */
    sys->channels = var_InheritInteger(demux, "decklink-audio-channels");
    switch (sys->channels) {
开发者ID:chouquette,项目名称:vlc,代码行数:67,代码来源:decklink.cpp


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