virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents events, IDeckLinkDisplayMode*mode, BMDDetectedVideoInputFormatFlags) { // This only gets called if bmdVideoInputEnableFormatDetection was set // when enabling video input HRESULT result; deckstring_t displayModeName = NULL; if (!(events & bmdVideoInputDisplayModeChanged)) { return S_OK; } mode->GetName(&displayModeName); free_deckstring(displayModeName); if (m_deckLinkInput) { m_deckLinkInput->StopStreams(); result = m_deckLinkInput->EnableVideoInput(mode->GetDisplayMode(), m_cfg_pixelFormat, m_cfg_inputFlags); if (result != S_OK) { goto bail; } m_deckLinkInput->StartStreams(); } bail: return S_OK; }
void stop() { if ( !m_started ) return; m_started = false; // Release the wait in getFrame pthread_mutex_lock( &m_mutex ); pthread_cond_broadcast( &m_condition ); pthread_mutex_unlock( &m_mutex ); m_decklinkInput->StopStreams(); m_decklinkInput->DisableVideoInput(); m_decklinkInput->DisableAudioInput(); // Cleanup queue pthread_mutex_lock( &m_mutex ); while ( mlt_frame frame = (mlt_frame) mlt_deque_pop_back( m_queue ) ) mlt_frame_close( frame ); pthread_mutex_unlock( &m_mutex ); }