]> git.sesse.net Git - mlt/commitdiff
Fix decklink consumer on devices without keyer.
authorDan Dennedy <dan@dennedy.org>
Tue, 12 Apr 2011 23:26:00 +0000 (16:26 -0700)
committerDan Dennedy <dan@dennedy.org>
Tue, 12 Apr 2011 23:26:00 +0000 (16:26 -0700)
src/modules/decklink/consumer_decklink.cpp

index ecc12474766bd3db80b0f869233204e3142f08c9..cf31fe94397f0ace539ea598fae58fb5b47c06e5 100644 (file)
@@ -185,14 +185,24 @@ public:
                }
                
                // Get the keyer interface
-               if ( m_deckLink->QueryInterface( IID_IDeckLinkKeyer, (void**) &m_deckLinkKeyer ) != S_OK )
+               IDeckLinkAttributes *deckLinkAttributes = 0;
+               m_deckLinkKeyer = 0;
+               if ( m_deckLink->QueryInterface( IID_IDeckLinkAttributes, (void**) &deckLinkAttributes ) == S_OK )
                {
-                       mlt_log_error( getConsumer(), "Failed to get keyer\n" );
-                       m_deckLinkOutput->Release();
-                       m_deckLinkOutput = 0;
-                       m_deckLink->Release();
-                       m_deckLink = 0;
-                       return false;
+                       bool flag = false;
+                       if ( deckLinkAttributes->GetFlag( BMDDeckLinkSupportsInternalKeying, &flag ) == S_OK && flag )
+                       {
+                               if ( m_deckLink->QueryInterface( IID_IDeckLinkKeyer, (void**) &m_deckLinkKeyer ) != S_OK )
+                               {
+                                       mlt_log_error( getConsumer(), "Failed to get keyer\n" );
+                                       m_deckLinkOutput->Release();
+                                       m_deckLinkOutput = 0;
+                                       m_deckLink->Release();
+                                       m_deckLink = 0;
+                                       return false;
+                               }
+                       }
+                       deckLinkAttributes->Release();
                }
 
                // Provide this class as a delegate to the audio and video output interfaces
@@ -229,7 +239,7 @@ public:
                }
                
                // Set the keyer
-               if ( ( m_isKeyer = mlt_properties_get_int( properties, "keyer" ) ) )
+               if ( m_deckLinkKeyer && ( m_isKeyer = mlt_properties_get_int( properties, "keyer" ) ) )
                {
                        bool external = false;
                        double level = mlt_properties_get_double( properties, "keyer_level" );
@@ -240,7 +250,7 @@ public:
                        m_preroll = 0;
                        m_isAudio = false;
                }
-               else
+               else if ( m_deckLinkKeyer )
                {
                        m_deckLinkKeyer->Disable();
                }