#if defined(_MSC_VER)
-#include "interop/DeckLinkAPI_h.h"
+#include "interop/DeckLinkAPI.h"
#pragma warning(push)
#pragma warning(disable : 4996)
namespace caspar { namespace decklink {
typedef BSTR String;
-typedef unsigned long UINT32;
+typedef unsigned int UINT32;
static void com_initialize()
{
if (already_referenced)
{
P<T> p;
- &p = ptr;
+ p.Attach(ptr);
return p;
}
else
return P<T>(ptr);
}
-static com_ptr<IDecklinkIterator> create_iterator()
+static com_ptr<IDeckLinkIterator> create_iterator()
{
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(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));