void CloseInterfaces(void) { HRESULT hr; // Relinquish ownership (IMPORTANT!) after hiding video window if(pVW) { hr = pVW->put_Visible(OAFALSE); hr = pVW->put_Owner(NULL); } // Disable event callbacks if (pME) hr = pME->SetNotifyWindow((OAHWND)NULL, 0, 0); #ifdef REGISTER_FILTERGRAPH if (g_dwGraphRegister) { RemoveGraphFromRot(g_dwGraphRegister); g_dwGraphRegister = 0; } #endif // Release and zero DirectShow interfaces SAFE_RELEASE(pME); SAFE_RELEASE(pMS); SAFE_RELEASE(pMP); SAFE_RELEASE(pMC); SAFE_RELEASE(pBA); SAFE_RELEASE(pBV); SAFE_RELEASE(pVW); SAFE_RELEASE(pFS); SAFE_RELEASE(pGB); }
void CloseInterfaces(void) { // Stop previewing data if (g_pMC) g_pMC->StopWhenReady(); g_psCurrent = Stopped; // Stop receiving events if (g_pME) g_pME->SetNotifyWindow(NULL, WM_GRAPHNOTIFY, 0); // Relinquish ownership (IMPORTANT!) of the video window. // Failing to call put_Owner can lead to assert failures within // the video renderer, as it still assumes that it has a valid // parent window. if(g_pVW) { g_pVW->put_Visible(OAFALSE); g_pVW->put_Owner(NULL); } #ifdef REGISTER_FILTERGRAPH // Remove filter graph from the running object table if (g_dwGraphRegister) RemoveGraphFromRot(g_dwGraphRegister); #endif // Release DirectShow interfaces SAFE_RELEASE(g_pMC); SAFE_RELEASE(g_pME); SAFE_RELEASE(g_pVW); SAFE_RELEASE(g_pGraph); SAFE_RELEASE(g_pCapture); }
void CloseInterfaces(void) { HRESULT hr; // Disable event callbacks if (pME) hr = pME->SetNotifyWindow((OAHWND)NULL, 0, 0); #ifdef REGISTER_FILTERGRAPH if (g_dwGraphRegister) { RemoveGraphFromRot(g_dwGraphRegister); g_dwGraphRegister = 0; } #endif // Clear watermark state and timer settings ClearWatermarkState(); // Release and zero DirectShow interfaces SAFE_RELEASE(pME); SAFE_RELEASE(pMS); SAFE_RELEASE(pMC); SAFE_RELEASE(pBA); SAFE_RELEASE(pBMP); SAFE_RELEASE(pWC); SAFE_RELEASE(pGB); }
CVideoRenderer::~CVideoRenderer () { // --- stop the video playback Stop (); #ifdef _DEBUG // --- unregister the graph if( m_dwGraphRegister ) { RemoveGraphFromRot( m_dwGraphRegister ); } #endif Lock (); // --- release our resources SAFE_RELEASE( m_pBasicAudio ); SAFE_RELEASE( m_pMediaControl ); SAFE_RELEASE( m_pMediaSeeking ); SAFE_RELEASE ( m_pGraph ); SAFE_RELEASE ( m_pFilter ); // ACHTUNG: free codec instances Unlock (); DeleteCriticalSection ( &m_Lock ); }
void directx_videofile_server::close_device(void) { // Pause the graph so that its state is known. pause(); // Clear out the buffered frame. If we don't do this, the code // can hang when all of the buffers fill up in the filter graph. read_one_frame(0, _num_columns, 0, _num_rows, 1); if (_pMediaSeeking) { _pMediaSeeking->Release(); } #ifdef REGISTER_FILTERGRAPH if (_dwGraphRegister) { RemoveGraphFromRot(_dwGraphRegister); _dwGraphRegister = 0; } #endif }
void CloseInterfaces(void) { #ifdef REGISTER_FILTERGRAPH if (g_dwGraphRegister) { RemoveGraphFromRot(g_dwGraphRegister); g_dwGraphRegister = 0; } #endif // Clear ticker state and timer settings ClearTickerState(); // Release and zero DirectShow interfaces SAFE_RELEASE(pME); SAFE_RELEASE(pMS); SAFE_RELEASE(pMC); SAFE_RELEASE(pWC); SAFE_RELEASE(pBMP); SAFE_RELEASE(pGB); }
void CloseInterfaces(void) { // Disable event callbacks if (pME) pME->SetNotifyWindow((OAHWND)NULL, 0, 0); #ifdef REGISTER_FILTERGRAPH if (g_dwGraphRegister) { RemoveGraphFromRot(g_dwGraphRegister); g_dwGraphRegister = 0; } #endif // Release and zero DirectShow interfaces SAFE_RELEASE(pME); SAFE_RELEASE(pMS); SAFE_RELEASE(pMC); SAFE_RELEASE(pWC); SAFE_RELEASE(pMix); SAFE_RELEASE(pGB); }
void CAccessSys::CloseInterfaces(void) { // Stop previewing data if (p_control) p_control->StopWhenReady(); e_psCurrent = Stopped; // Stop receiving events //if (p_media_event) // p_media_event->SetNotifyWindow(NULL, WM_GRAPHNOTIFY, 0); // Relinquish ownership (IMPORTANT!) of the video window. // Failing to call put_Owner can lead to assert failures within // the video renderer, as it still assumes that it has a valid // parent window. if (p_video_window) { p_video_window->put_Visible(OAFALSE); p_video_window->put_Owner(NULL); } #ifdef REGISTER_FILTERGRAPH // Remove filter graph from the running object table if (g_dwGraphRegister) RemoveGraphFromRot(g_dwGraphRegister); #endif // Release DirectShow interfaces SAFE_RELEASE(p_control); SAFE_RELEASE(p_media_event); SAFE_RELEASE(p_video_window); SAFE_RELEASE(p_graph); SAFE_RELEASE(p_capture_graph_builder2); b_buildPreview = false; b_getInterfaces = false; }
CDShowCtrl::~CDShowCtrl(void) { RemoveGraphFromRot(m_dwRegister); if( this->mediaCtrl != NULL ){ this->mediaCtrl->Stop(); } SAFE_RELEASE(this->videoDec); SAFE_RELEASE(this->audioDec); SAFE_RELEASE(this->writeFile); SAFE_RELEASE(this->videoScaler); SAFE_RELEASE(this->videoEnc); SAFE_RELEASE(this->audioEnc); SAFE_RELEASE(this->muxer); SAFE_RELEASE(this->mediaCtrl); SAFE_RELEASE(this->graph); SAFE_RELEASE(this->tsSrc); for( size_t i=0; i<this->buffData.size(); i++ ){ delete this->buffData[i]; } this->buffData.clear(); CoUninitialize(); }
void cDxCapture::CloseInterfaces(void) { // Stop previewing data if (m_pMC) m_pMC->StopWhenReady(); m_psCurrent = STOPPED; // Stop receiving events // if (m_pME) // m_pME->SetNotifyWindow(NULL, WM_GRAPHNOTIFY, 0); // Relinquish ownership (IMPORTANT!) of the video window. // Failing to call put_Owner can lead to assert failures within // the video renderer, as it still assumes that it has a valid // parent window. if (m_pVW) { m_pVW->put_Visible(OAFALSE); m_pVW->put_Owner(NULL); } // Remove filter graph from the running object table if (m_dwGraphRegister) RemoveGraphFromRot(m_dwGraphRegister); // Release DirectShow interfaces SAFE_RELEASE(m_pMC); SAFE_RELEASE(m_pME); SAFE_RELEASE(m_pVW); SAFE_RELEASE(m_pGraph); SAFE_RELEASE(m_pCapture); SAFE_RELEASE(m_pGrabber); SAFE_RELEASE(m_pGrabberF); SAFE_RELEASE(m_pNullF); }
// removes each filter from the graph HRESULT CBDAFilterGraph::TearDownGraph() { HRESULT hr = S_OK; CComPtr <IBaseFilter> pFilter; CComPtr <IEnumFilters> pIFilterEnum; m_pITuningSpace = NULL; if(m_fGraphBuilt || m_fGraphFailure) { // unload manually added filters m_pFilterGraph->RemoveFilter(m_pIPSink); m_pFilterGraph->RemoveFilter(m_pMPE); m_pFilterGraph->RemoveFilter(m_pTIF); m_pFilterGraph->RemoveFilter(m_pDemux); m_pFilterGraph->RemoveFilter(m_pNetworkProvider); m_pFilterGraph->RemoveFilter(m_pTunerDevice); m_pFilterGraph->RemoveFilter(m_pCaptureDevice); m_pIPSink = NULL; m_pMPE = NULL; m_pTIF = NULL; m_pDemux = NULL; m_pNetworkProvider = NULL; m_pTunerDevice = NULL; m_pDemodulatorDevice = NULL; m_pCaptureDevice = NULL; // now go unload rendered filters hr = m_pFilterGraph->EnumFilters(&pIFilterEnum); if(FAILED(hr)) { ErrorMessageBox(TEXT("TearDownGraph: cannot EnumFilters\n")); return E_FAIL; } pIFilterEnum->Reset(); while(pIFilterEnum->Next(1, &pFilter, 0) == S_OK) // addrefs filter { hr = m_pFilterGraph->RemoveFilter(pFilter); if (FAILED (hr)) return hr; pIFilterEnum->Reset(); pFilter.Release (); } } #ifdef DEBUG if (m_dwGraphRegister) { RemoveGraphFromRot(m_dwGraphRegister); m_dwGraphRegister = 0; } #endif m_fGraphBuilt = FALSE; return S_OK; }