]> git.sesse.net Git - vlc/commitdiff
Support multiple SDI cards.
authorSteinar Gunderson <sgunderson@bigfoot.com>
Sat, 25 Sep 2010 17:00:43 +0000 (19:00 +0200)
committerSteinar Gunderson <sgunderson@bigfoot.com>
Sat, 25 Sep 2010 17:00:43 +0000 (19:00 +0200)
modules/access/sdi.cpp

index 12e71926faa1ed2e796e7eb3a85c8ad538cf2386..8ac5f97bd9e755d130099bd49edaf513c047de0b 100644 (file)
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
+#define CARD_INDEX_TEXT N_("Input card to use")
+#define CARD_INDEX_LONGTEXT N_( \
+    "SDI capture card to use, if multiple exist. " \
+    "The cards are numbered from 0." )
+
 #define MODE_TEXT N_("Desired input video mode")
 #define MODE_LONGTEXT N_( \
     "Desired input video mode for SDI captures. " \
@@ -69,6 +74,8 @@ vlc_module_begin ()
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_ACCESS )
     
+    add_integer( "sdi-card-index", 0, NULL,
+                 CARD_INDEX_TEXT, CARD_INDEX_LONGTEXT, true )
     add_string( "sdi-mode", "pal ", NULL,
                  MODE_TEXT, MODE_LONGTEXT, true )
     add_integer( "sdi-caching", DEFAULT_PTS_DELAY / 1000, NULL,
@@ -250,14 +257,32 @@ static int Open( vlc_object_t *p_this )
     }
 
     HRESULT result;
-    result = decklink_iterator->Next( &p_sys->p_card );
+
+    int i_card_index = var_CreateGetInteger( p_demux, "sdi-card-index" );
+    for( int i = 0; i <= i_card_index; ++i )
+    {
+        result = decklink_iterator->Next( &p_sys->p_card );
+        if( result != S_OK )
+            break;
+    }
 
     if( result != S_OK )
     {
-        msg_Err( p_demux, "No DeckLink PCI cards found" );
+        msg_Err( p_demux, "DeckLink PCI card %d not found", i_card_index );
         return VLC_EGENERIC;
     }
 
+    const char *psz_model_name;
+    result = p_sys->p_card->GetModelName( &psz_model_name );
+    
+    if( result != S_OK )
+    {
+        msg_Err( p_demux, "Could not get model name" );
+        return VLC_EGENERIC;
+    }
+
+    msg_Dbg( p_demux, "Opened DeckLink PCI card %d (%s)", i_card_index, psz_model_name );
+
     if( p_sys->p_card->QueryInterface( IID_IDeckLinkInput, (void**)&p_sys->p_input) != S_OK )
     {
         msg_Err( p_demux, "Card has no inputs" );