HRESULT CPullPin::StopThread() { CAutoLock lock(&m_AccessLock); if (!ThreadExists()) { return S_FALSE; } // need to flush to ensure the thread is not blocked // in WaitForNext HRESULT hr = m_pReader->BeginFlush(); if (FAILED(hr)) { return hr; } m_State = TM_Exit; hr = CallWorker(TM_Exit); m_pReader->EndFlush(); // wait for thread to completely exit Close(); // decommit allocator if (m_pAlloc) { m_pAlloc->Decommit(); } return S_OK; }
HRESULT CAMROutputPin::Active() { if (active) { return NOERROR; } FlushQueue(); if (!IsConnected()) { return VFW_E_NOT_CONNECTED; } ev_abort.Reset(); HRESULT hr = CBaseOutputPin::Active(); if (FAILED(hr)) { active = FALSE; return hr; } // new segment DoNewSegment(rtStart, rtStop, rate); // vytvorime novu queue if (!ThreadExists()) { Create(); CallWorker(CMD_RUN); } active = TRUE; return hr; }
STDMETHODIMP CAMRSplitter::Pause() { CAutoLock lck(&lock_filter); if (m_State == State_Stopped) { ev_abort.Reset(); // activate pins for (int i=0; i<output.GetCount(); i++) { output[i]->Active(); } if (input) { input->Active(); } // seekneme na danu poziciu DoNewSeek(); // pustime parser thread if (!ThreadExists()) { Create(); CallWorker(CMD_RUN); } } m_State = State_Paused; return NOERROR; }
STDMETHODIMP OggDemuxFilter::Pause() { CAutoLock locLock(m_pLock); LOG(logDEBUG) << __FUNCTIONW__; if (m_State == State_Stopped) { LOG(logDEBUG) <<L"Pause -- was stopped"; if (ThreadExists() == FALSE) { LOG(logDEBUG) << L"Pause -- CREATING THREAD"; Create(); } LOG(logDEBUG) << L"Pause -- RUNNING THREAD"; CallWorker(THREAD_RUN); } HRESULT hr = CBaseFilter::Pause(); LOG(logDEBUG) << __FUNCTIONW__ << L"Base class returned: 0x" << std::hex << hr; return hr; }
HRESULT CPullPin::StartThread() { CAutoLock lock(&m_AccessLock); if (!m_pAlloc || !m_pReader) { return E_UNEXPECTED; } HRESULT hr; if (!ThreadExists()) { // commit allocator hr = m_pAlloc->Commit(); if (FAILED(hr)) { return hr; } // start thread if (!Create()) { return E_FAIL; } } m_State = TM_Start; hr = (HRESULT) CallWorker(m_State); return hr; }
HRESULT CTTASplitterInputPin::Active() { HRESULT hr; if (m_pParentFilter->IsActive()) { return S_FALSE; } if (!IsConnected()) { return NOERROR; } hr = CBaseInputPin::Active(); if (FAILED(hr)) { return hr; } if (!Create()) { return E_FAIL; } CallWorker(CMD_RUN); return NOERROR; }
HRESULT CBaseSplitterOutputPin::Inactive() { CAutoLock cAutoLock(m_pLock); if(ThreadExists()) CallWorker(CMD_EXIT); return __super::Inactive(); }
HRESULT CTTASplitterInputPin::Inactive() { if (ThreadExists()) { m_bAbort = TRUE; CallWorker(CMD_EXIT); Close(); } return CBasePin::Inactive(); }
HRESULT CWavPackSplitterFilterInputPin::Inactive() { // Stop the thread if (ThreadExists()) { m_bAbort = TRUE; CallWorker(CMD_EXIT); Close(); } return CBasePin::Inactive(); }
STDMETHODIMP CBaseMuxerFilter::Stop() { CAutoLock cAutoLock(this); HRESULT hr = __super::Stop(); if(FAILED(hr)) return hr; CallWorker(CMD_EXIT); return hr; }
CAsyncUrlReader::~CAsyncUrlReader() { if (ThreadExists()) { CallWorker(CMD_EXIT); } if (!m_fn.IsEmpty()) { CMultiFiles::Close(); DeleteFile(m_fn); } }
STDMETHODIMP CStreamDriveThruFilter::Pause() { HRESULT hr; if(FAILED(hr = __super::Pause())) return hr; CallWorker(CMD_PAUSE); return S_OK; }
STDMETHODIMP CStreamDriveThruFilter::Stop() { HRESULT hr; if(FAILED(hr = __super::Stop())) return hr; CallWorker(CMD_STOP); return S_OK; }
STDMETHODIMP CStreamDriveThruFilter::Run(REFERENCE_TIME tStart) { HRESULT hr; if(FAILED(hr = __super::Run(tStart))) return hr; CallWorker(CMD_RUN); return S_OK; }
STDMETHODIMP CWavPackSplitterFilterInputPin::EndFlush() { HRESULT hr = CBaseInputPin::EndFlush(); if (FAILED(hr)) { return hr; } if (ThreadExists()) { CallWorker(CMD_RUN); } return NOERROR; }
CAsyncUrlReader::CAsyncUrlReader(CString url, HRESULT& hr) : CAsyncFileReader(url, hr) { if(SUCCEEDED(hr)) return; m_url = url; if(CAMThread::Create()) CallWorker(CMD_INIT); hr = Open(m_fn, modeRead|shareDenyRead|typeBinary|osSequentialScan) ? S_OK : E_FAIL; m_len = (ULONGLONG)-1; // force GetLength() return actual length always }
STDMETHODIMP OggDemuxFilter::Stop() { CAutoLock locLock(m_pLock); LOG(logDEBUG) << __FUNCTIONW__; CallWorker(THREAD_EXIT); Close(); DeliverBeginFlush(); //mSetIgnorePackets = true; DeliverEndFlush(); return CBaseFilter::Stop(); }
STDMETHODIMP CWavPackDSSplitterInputPin::EndFlush() { HRESULT hr = CBaseInputPin::EndFlush(); if (FAILED(hr)) return hr; DebugLog("CWavPackDSSplitterInputPin::EndFlush 0x%08X", GetCurrentThreadId()); if (ThreadExists()) CallWorker(CMD_RUN); return NOERROR; }
STDMETHODIMP CBaseSplitterFilter::Stop() { CAutoLock cAutoLock(this); DeliverBeginFlush(); CallWorker(CMD_EXIT); DeliverEndFlush(); HRESULT hr; if(FAILED(hr = __super::Stop())) return hr; return S_OK; }
STDMETHODIMP CWavPackDSSplitterInputPin::BeginFlush() { HRESULT hr = CBaseInputPin::BeginFlush(); if (FAILED(hr)) return hr; DebugLog("CWavPackDSSplitterInputPin::BeginFlush 0x%08X", GetCurrentThreadId()); if (!ThreadExists()) return NOERROR; m_bAbort = TRUE; CallWorker(CMD_STOP); return NOERROR; }
HRESULT CWavPackDSSplitterInputPin::Inactive() { DebugLog("CWavPackDSSplitterInputPin::Inactive 0x%08X", GetCurrentThreadId()); // Stop the thread if (ThreadExists()) { m_bAbort = TRUE; CallWorker(CMD_EXIT); Close(); } return CBasePin::Inactive(); }
STDMETHODIMP CWavPackSplitterFilterInputPin::BeginFlush() { HRESULT hr = CBaseInputPin::BeginFlush(); if (FAILED(hr)) { return hr; } if (!ThreadExists()) { return NOERROR; } m_bAbort = TRUE; CallWorker(CMD_STOP); return NOERROR; }
STDMETHODIMP CBaseMuxerFilter::Pause() { CAutoLock cAutoLock(this); FILTER_STATE fs = m_State; HRESULT hr = __super::Pause(); if(FAILED(hr)) return hr; if(fs == State_Stopped && m_pOutput) { CAMThread::Create(); CallWorker(CMD_RUN); } return hr; }
HRESULT CAVISplitter::PauseThread() { CAutoLock lock(&m_AccessLock); if (!ThreadExists()) { return E_UNEXPECTED; } HRESULT hr = S_OK; // Need to flush to ensure the thread is not blocked // in WaitForNext m_scanner.BeginFlush(); m_thread_state = tm_pause; hr = CallWorker(tm_pause); //WriteToLog("<CAVISplitter::PauseThread> CallWorker(tm_pause)"); m_scanner.EndFlush(); return hr; }
STDMETHODIMP OggDemuxFilter::SetPositions(LONGLONG *pCurrent,DWORD dwCurrentFlags,LONGLONG *pStop,DWORD dwStopFlags) { CAutoLock locLock(m_pLock); LOG(logDEBUG3) << "IMediaSeeking::SetPositions(" << ReferenceTime(*pCurrent) << ", " << dwCurrentFlags << ", " << ReferenceTime(*pStop) << ", " << dwStopFlags << ") -> 0x" << std::hex << S_OK; if (m_seekTable == NULL || !m_seekTable->enabled()) { return E_NOTIMPL; } DeliverBeginFlush(); //Find the byte position for this time. if (*pCurrent > m_seekTable->fileDuration()) { *pCurrent = m_seekTable->fileDuration(); } else if (*pCurrent < 0) { *pCurrent = 0; } OggGranuleSeekTable::tSeekPair locStartPos = m_seekTable->seekPos(*pCurrent); //For now, seek to the position directly, later we will discard the preroll //Probably don't ever want to do this. We want to record the desired time, // and it will be up to the decoders to drop anything that falls before it. DeliverEndFlush(); DeliverNewSegment(*pCurrent, m_seekTable->fileDuration(), 1.0); // Second is the file position. SetRequestedSeekPos(locStartPos.second.first); if (CallWorker(THREAD_SEEK) == E_FAIL) { // Thread not running, we're changing the current position ourselfs SetCurrentReaderPos(GetRequestedSeekPos()); } return S_OK; }
HRESULT CPullPin::PauseThread() { CAutoLock lock(&m_AccessLock); if(!ThreadExists()) { return E_UNEXPECTED; } // need to flush to ensure the thread is not blocked // in WaitForNext HRESULT hr = m_pReader->BeginFlush(); if(FAILED(hr)) { return hr; } m_State = TM_Pause; hr = CallWorker(TM_Pause); m_pReader->EndFlush(); return hr; }
HRESULT CAVISplitter::StartThread() { CAutoLock lock(&m_AccessLock); HRESULT hr = S_OK; if (!ThreadExists()) { // commit allocator // Start thread if (!Create()) { return E_FAIL; } } if (m_thread_state != tm_start) { m_thread_state = tm_start; hr = (HRESULT) CallWorker(m_thread_state); } return hr; }
HRESULT CAMROutputPin::Inactive() { if (!active) { return NOERROR; } active = FALSE; // destroy everything ev_abort.Set(); HRESULT hr = CBaseOutputPin::Inactive(); ASSERT(SUCCEEDED(hr)); if (ThreadExists()) { CallWorker(CMD_EXIT); Close(); } FlushQueue(); ev_abort.Reset(); return NOERROR; }
HRESULT CAVISplitter::StopThread() { CAutoLock lock(&m_AccessLock); if (!ThreadExists()) { return S_FALSE; } HRESULT hr = S_OK; // need to flush to ensure the thread is not blocked // in WaitForNext m_scanner.BeginFlush(); m_thread_state = tm_exit; hr = CallWorker(tm_exit); //WriteToLog("<CAVISplitter::StopThread> CallWorker(tm_exit)"); m_scanner.EndFlush(); // wait for thread to completely exit Close(); return S_OK; }
HRESULT CWavPackDSSplitterInputPin::Active() { HRESULT hr; DebugLog("CWavPackDSSplitterInputPin::Active 0x%08X", GetCurrentThreadId()); if(m_pParentFilter->IsActive()) return S_FALSE; if (!IsConnected()) return NOERROR; hr = CBaseInputPin::Active(); if (FAILED(hr)) return hr; // Create and start the thread if (!Create()) return E_FAIL; CallWorker(CMD_RUN); return NOERROR; }