]> git.sesse.net Git - vlc/commitdiff
Include the DeckLink API and try to open the card on Open().
authorSteinar Gunderson <sgunderson@bigfoot.com>
Thu, 23 Sep 2010 22:49:43 +0000 (00:49 +0200)
committerSteinar Gunderson <sgunderson@bigfoot.com>
Thu, 23 Sep 2010 22:49:43 +0000 (00:49 +0200)
modules/access/sdi.cpp

index 3f5c114333c12209622312fdbbab8e64f960b8ec..3bdb3c37daa1e552e5a0d81f58a308a290f6213e 100644 (file)
@@ -17,6 +17,9 @@
 #include <vlc_charset.h>
 #include <vlc_fs.h>
 
+#include "DeckLinkAPI.h"
+#include "DeckLinkAPIDispatch.cpp"
+
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
@@ -44,6 +47,8 @@ static int Control( demux_t *, int, va_list );
 
 struct demux_sys_t
 {
+    IDeckLink *p_card;
+    IDeckLinkInput *p_input;
     es_out_id_t  *p_es;
 };
 
@@ -68,7 +73,27 @@ static int Open( vlc_object_t *p_this )
 
     msg_Dbg( p_demux, "hello world" );
 
-    /* Declare elementary streams */
+    IDeckLinkIterator *decklink_iterator = CreateDeckLinkIteratorInstance();
+    if ( !decklink_iterator ) {
+        msg_Err( p_demux, "DeckLink drivers not found." );
+        // FIXME: Leak here and several other error paths.
+        return VLC_EGENERIC;
+    }
+
+    HRESULT result;
+    result = decklink_iterator->Next( &p_sys->p_card );
+
+    if ( result != S_OK ) {
+        msg_Err( p_demux, "No DeckLink PCI cards found." );
+        return VLC_EGENERIC;
+    }
+
+    if ( p_sys->p_card->QueryInterface(IID_IDeckLinkInput, (void**)&p_sys->p_input) != S_OK ) {
+        msg_Err( p_demux, "Card has no inputs" );
+        return VLC_EGENERIC;
+    }
+
+    /*eDeclare elementary streams */
     es_format_t fmt;
     es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_YUYV );
     fmt.video.i_width = 720;