template<typename T>
using com_ptr = CComPtr<T>;
-// MSVC 2013 crashes when this alias template is instantiated
-/*template<typename T>
-using com_iface_ptr = CComQIPtr<T>;*/
-
template<typename T>
-class com_iface_ptr : public CComQIPtr<T>
-{
-public:
- template<typename T2>
- com_iface_ptr(const com_ptr<T2>& lp)
- : CComQIPtr<T>(lp)
- {
- }
-};
+using com_iface_ptr = CComQIPtr<T>;
template<template<typename> class P, typename T>
static P<T> wrap_raw(T* ptr, bool already_referenced = false)
{
CComPtr<IDeckLinkIterator> pDecklinkIterator;
if(FAILED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
- CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Decklink drivers not found."));
+ CASPAR_THROW_EXCEPTION(not_supported() << msg_info("Decklink drivers not found."));
return pDecklinkIterator;
}
template<typename I, typename T>
-static com_iface_ptr<I> iface_cast(const com_ptr<T>& ptr)
+static com_iface_ptr<I> iface_cast(const com_ptr<T>& ptr, bool optional = false)
{
- return com_iface_ptr<I>(ptr);
+ com_iface_ptr<I> result = ptr;
+
+ if (!optional && !result)
+ CASPAR_THROW_EXCEPTION(not_supported() << msg_info(std::string("Could not cast from ") + typeid(T).name() + " to " + typeid(I).name() + ". This is probably due to old Decklink drivers."));
+
+ return result;
}
template<typename T>
#else
#include "linux_interop/DeckLinkAPI.h"
+#include "linux_interop/DeckLinkAPIConfiguration_v10_2.h"
#include <memory>
#include <typeinfo>
IDeckLinkIterator* iterator = CreateDeckLinkIteratorInstance();
if (iterator == nullptr)
- CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Decklink drivers not found."));
+ CASPAR_THROW_EXCEPTION(not_supported() << msg_info("Decklink drivers not found."));
return wrap_raw<com_ptr>(iterator, true);
}
template<> REFIID iface_id<IDeckLinkOutput>() { return IID_IDeckLinkOutput; }
template<> REFIID iface_id<IDeckLinkAPIInformation>() { return IID_IDeckLinkAPIInformation; }
template<> REFIID iface_id<IDeckLinkConfiguration>() { return IID_IDeckLinkConfiguration; }
+template<> REFIID iface_id<IDeckLinkConfiguration_v10_2>() { return IID_IDeckLinkConfiguration_v10_2; }
template<> REFIID iface_id<IDeckLinkKeyer>() { return IID_IDeckLinkKeyer; }
template<> REFIID iface_id<IDeckLinkAttributes>() { return IID_IDeckLinkAttributes; }
template<> REFIID iface_id<IDeckLinkInput>() { return IID_IDeckLinkInput; }
template<typename I, typename T>
-static com_iface_ptr<I> iface_cast(com_ptr<T> ptr)
+static com_iface_ptr<I> iface_cast(com_ptr<T> ptr, bool optional = false)
{
I* iface;
ptr->QueryInterface(iface_id<I>(), reinterpret_cast<void**>(&iface));