From 481104c6b41e5929e203ce3d95314bb68ea925aa Mon Sep 17 00:00:00 2001 From: Steinar Gunderson Date: Fri, 24 Sep 2010 00:49:43 +0200 Subject: [PATCH] Include the DeckLink API and try to open the card on Open(). --- modules/access/sdi.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/modules/access/sdi.cpp b/modules/access/sdi.cpp index 3f5c114333..3bdb3c37da 100644 --- a/modules/access/sdi.cpp +++ b/modules/access/sdi.cpp @@ -17,6 +17,9 @@ #include #include +#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; -- 2.39.2