X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fdecklink%2Fproducer_decklink.cpp;h=3ae216c290a6b8b3fac0c087d063ac66c887ad67;hb=b39198884603dd87583b21c840eb595dcaf3708c;hp=ca4b2478aeb7406d43b65c2a288c520907aa2396;hpb=3e2c57731b396081ee8c012c73994e65d8a693e7;p=mlt diff --git a/src/modules/decklink/producer_decklink.cpp b/src/modules/decklink/producer_decklink.cpp index ca4b2478..3ae216c2 100644 --- a/src/modules/decklink/producer_decklink.cpp +++ b/src/modules/decklink/producer_decklink.cpp @@ -24,15 +24,7 @@ #include #include #include -#ifdef WIN32 -#include -#include "DeckLinkAPI_h.h" -#else -#include "DeckLinkAPI.h" -typedef const char* BSTR; -#endif - -#define SAFE_RELEASE(V) if (V) { V->Release(); V = NULL; } +#include "common.h" class DeckLinkProducer : public IDeckLinkInputCallback @@ -250,6 +242,8 @@ public: pthread_mutex_unlock( &m_mutex ); m_decklinkInput->StopStreams(); + m_decklinkInput->DisableVideoInput(); + m_decklinkInput->DisableAudioInput(); // Cleanup queue pthread_mutex_lock( &m_mutex ); @@ -437,15 +431,16 @@ public: IDeckLinkTimecode* timecode = 0; if ( video->GetTimecode( bmdTimecodeVITC, &timecode ) == S_OK && timecode ) { - const char* timecodeString = 0; + DLString timecodeString = 0; - if ( timecode->GetString( (BSTR*) &timecodeString ) == S_OK ) + if ( timecode->GetString( &timecodeString ) == S_OK ) { - mlt_properties_set( MLT_FRAME_PROPERTIES( frame ), "meta.attr.vitc.markup", timecodeString ); - mlt_log_debug( getProducer(), "timecode %s\n", timecodeString ); + char* s = getCString( timecodeString ); + mlt_properties_set( MLT_FRAME_PROPERTIES( frame ), "meta.attr.vitc.markup", s ); + mlt_log_debug( getProducer(), "timecode %s\n", s ); + freeCString( s ); } - if ( timecodeString ) - free( (void*) timecodeString ); + freeDLString( timecodeString ); SAFE_RELEASE( timecode ); } } @@ -655,16 +650,18 @@ static void on_property_changed( void*, mlt_properties properties, const char *n { if ( decklink->QueryInterface( IID_IDeckLinkInput, (void**) &decklinkInput ) == S_OK ) { - char *name = NULL; - if ( decklink->GetModelName( (BSTR*) &name ) == S_OK ) + DLString name = NULL; + if ( decklink->GetModelName( &name ) == S_OK ) { + char *name_cstr = getCString( name ); const char *format = "device.%d"; char *key = (char*) calloc( 1, strlen( format ) + 1 ); sprintf( key, format, i ); - mlt_properties_set( properties, key, name ); + mlt_properties_set( properties, key, name_cstr ); free( key ); - free( name ); + freeDLString( name ); + freeCString( name_cstr ); } SAFE_RELEASE( decklinkInput ); }