]> git.sesse.net Git - vlc/blobdiff - modules/access/sdi.cpp
Include the BlackMagic SDK stuff with <>.
[vlc] / modules / access / sdi.cpp
index 9e9acc92496c2100850f3ac0cabc99d1e1e47fbe..9d42eae79aec9faac93f216cb0ac5ab270d55ac2 100644 (file)
@@ -19,8 +19,8 @@
 
 #include <arpa/inet.h>
 
-#include "DeckLinkAPI.h"
-#include "DeckLinkAPIDispatch.cpp"
+#include <DeckLinkAPI.h>
+#include <DeckLinkAPIDispatch.cpp>
 
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
@@ -270,7 +270,7 @@ static int Open( vlc_object_t *p_this )
 
     vlc_mutex_init( &p_sys->frame_lock );
     vlc_cond_init( &p_sys->has_frame );
-    p_sys->p_video_frame = NULL;
+    p_sys->b_first_frame = true;
 
     IDeckLinkIterator *decklink_iterator = CreateDeckLinkIteratorInstance();
     if( !decklink_iterator )
@@ -286,6 +286,8 @@ static int Open( vlc_object_t *p_this )
     int i_card_index = var_CreateGetInteger( p_demux, "sdi-card-index" );
     for( int i = 0; i <= i_card_index; ++i )
     {
+        if( p_sys->p_card )
+            p_sys->p_card->Release();
         result = decklink_iterator->Next( &p_sys->p_card );
         if( result != S_OK )
             break;
@@ -595,8 +597,6 @@ static int Open( vlc_object_t *p_this )
              (char*)&audio_fmt.i_codec, audio_fmt.audio.i_rate, audio_fmt.audio.i_bitspersample, audio_fmt.audio.i_channels);
     p_sys->p_audio_es = es_out_Add( p_demux->out, &audio_fmt );
 
-    p_sys->b_first_frame = true;
-
     /* Update default_pts to a suitable value for access */
     var_Create( p_demux, "sdi-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
 
@@ -619,6 +619,12 @@ static void Close( vlc_object_t *p_this )
 
     if( p_sys->p_delegate )
         p_sys->p_delegate->Release();
+            
+    if( p_sys->p_video_frame )
+        block_Release( p_sys->p_video_frame );
+    
+    if( p_sys->p_audio_frame )
+        block_Release( p_sys->p_audio_frame );
 
     free( p_sys );
 }