}
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)
{
com_iface_ptr<I> result = ptr;
- if (!result)
+ 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<> 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));