}
}
+static std::wstring get_mode_name(const com_ptr<IDeckLinkDisplayMode>& mode)
+{
+ String mode_name;
+ mode->GetName(&mode_name);
+ return u16(mode_name);
+}
+
template<typename T, typename F>
-BMDDisplayMode get_display_mode(const T& device, BMDDisplayMode format, BMDPixelFormat pix_fmt, F flag)
+BMDDisplayMode get_display_mode(const T& device, BMDDisplayMode format, BMDPixelFormat pix_fmt, F flag, bool& will_attempt_dma)
{
IDeckLinkDisplayMode* m = nullptr;
IDeckLinkDisplayModeIterator* iter;
com_ptr<IDeckLinkDisplayMode> mode = wrap_raw<com_ptr>(m, true);
BMDDisplayModeSupport displayModeSupport;
- if(FAILED(device->DoesSupportVideoMode(mode->GetDisplayMode(), pix_fmt, flag, &displayModeSupport, nullptr)) || displayModeSupport == bmdDisplayModeNotSupported)
- CASPAR_LOG(warning) << L"Device does not support video-format: " << mode->GetDisplayMode();
- //CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Device does not support requested video-format.")
- // << arg_value_info(boost::lexical_cast<std::string>(format))
- // << arg_name_info("format"));
- else if(displayModeSupport == bmdDisplayModeSupportedWithConversion)
- CASPAR_LOG(warning) << L"Device supports video-format with conversion: " << mode->GetDisplayMode();
+ will_attempt_dma = false;
+
+ if (FAILED(device->DoesSupportVideoMode(mode->GetDisplayMode(), pix_fmt, flag, &displayModeSupport, nullptr)))
+ CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info(L"Could not determine whether device supports requested video format: " + get_mode_name(mode)));
+ else if (displayModeSupport == bmdDisplayModeNotSupported)
+ CASPAR_LOG(warning) << L"Device does not support video-format: " << get_mode_name(mode);
+ else if (displayModeSupport == bmdDisplayModeSupportedWithConversion)
+ CASPAR_LOG(warning) << L"Device supports video-format with conversion: " << get_mode_name(mode);
+ else
+ will_attempt_dma = true;
return mode->GetDisplayMode();
}
template<typename T, typename F>
-static BMDDisplayMode get_display_mode(const T& device, core::video_format fmt, BMDPixelFormat pix_fmt, F flag)
+static BMDDisplayMode get_display_mode(const T& device, core::video_format fmt, BMDPixelFormat pix_fmt, F flag, bool& will_attempt_dma)
{
- return get_display_mode(device, get_decklink_video_format(fmt), pix_fmt, flag);
+ return get_display_mode(device, get_decklink_video_format(fmt), pix_fmt, flag, will_attempt_dma);
}
template<typename T>