]> git.sesse.net Git - casparcg/commitdiff
#430 Fixed bug where it was assumed that all Decklink devices implements the IDeckLin...
authorHelge Norberg <helge.norberg@svt.se>
Mon, 25 Apr 2016 15:18:14 +0000 (17:18 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Mon, 25 Apr 2016 15:18:14 +0000 (17:18 +0200)
modules/decklink/consumer/decklink_consumer.cpp
modules/decklink/decklink_api.h

index 8766eca6506b0ef974b02d96d5ab9173069d4e65..c16e6ee2f924a0d9b859380f3bc98ef43ba70755 100644 (file)
@@ -289,7 +289,7 @@ struct key_video_context : public IDeckLinkVideoOutputCallback, boost::noncopyab
        const configuration                                     config_;
        com_ptr<IDeckLink>                                      decklink_                                       = get_device(config_.key_device_index());
        com_iface_ptr<IDeckLinkOutput>          output_                                         = iface_cast<IDeckLinkOutput>(decklink_);
-       com_iface_ptr<IDeckLinkKeyer>           keyer_                                          = iface_cast<IDeckLinkKeyer>(decklink_);
+       com_iface_ptr<IDeckLinkKeyer>           keyer_                                          = iface_cast<IDeckLinkKeyer>(decklink_, true);
        com_iface_ptr<IDeckLinkAttributes>      attributes_                                     = iface_cast<IDeckLinkAttributes>(decklink_);
        com_iface_ptr<Configuration>            configuration_                          = iface_cast<Configuration>(decklink_);
        tbb::atomic<int64_t>                            current_presentation_delay_;
@@ -363,7 +363,7 @@ struct decklink_consumer : public IDeckLinkVideoOutputCallback, public IDeckLink
        com_ptr<IDeckLink>                                                                      decklink_                               = get_device(config_.device_index);
        com_iface_ptr<IDeckLinkOutput>                                          output_                                 = iface_cast<IDeckLinkOutput>(decklink_);
        com_iface_ptr<Configuration>                                            configuration_                  = iface_cast<Configuration>(decklink_);
-       com_iface_ptr<IDeckLinkKeyer>                                           keyer_                                  = iface_cast<IDeckLinkKeyer>(decklink_);
+       com_iface_ptr<IDeckLinkKeyer>                                           keyer_                                  = iface_cast<IDeckLinkKeyer>(decklink_, true);
        com_iface_ptr<IDeckLinkAttributes>                                      attributes_                             = iface_cast<IDeckLinkAttributes>(decklink_);
 
        tbb::spin_mutex                                                                         exception_mutex_;
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));