]> git.sesse.net Git - casparcg/blobdiff - modules/decklink/decklink_api.h
#430 Fixed bug where it was assumed that all Decklink devices implements the IDeckLin...
[casparcg] / modules / decklink / decklink_api.h
index 8c48e76b4a2b3139f641e07923dd191ea63db0c0..10561e3e2901e19a2d7c1b7edf00399ae3caa7c9 100644 (file)
@@ -86,11 +86,11 @@ static com_ptr<IDeckLinkIterator> create_iterator()
 }
 
 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;
@@ -177,7 +177,7 @@ template<>              REFIID iface_id<IDeckLinkAttributes>() { return IID_IDec
 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));