HRESULT MPEG1Stream::Start(const PROPVARIANT& varStart) { SourceLock lock(m_pSource); HRESULT hr = S_OK; CHECK_HR(hr = CheckShutdown()); // Queue the stream-started event. CHECK_HR(hr = QueueEvent( MEStreamStarted, GUID_NULL, S_OK, &varStart )); m_state = STATE_STARTED; // If we are restarting from paused, there may be // queue sample requests. Dispatch them now. CHECK_HR(hr = DispatchSamples()); done: return hr; }
HRESULT PpboxStream::Start(const PROPVARIANT& varStart) { SourceLock lock(m_pSource); HRESULT hr = S_OK; hr = CheckShutdown(); // Queue the stream-started event. if (SUCCEEDED(hr)) { hr = QueueEvent(MEStreamStarted, GUID_NULL, S_OK, &varStart); } if (SUCCEEDED(hr)) { m_state = STATE_STARTED; } // If we are restarting from paused, there may be // queue sample requests. Dispatch them now. if (SUCCEEDED(hr)) { hr = DispatchSamples(); } return hr; }
HRESULT FlvStream::EndOfStream() { SourceLock lock(source); eos = true; // will notify source eos return DispatchSamples(); }
void CMPEG1Stream::DeliverPayload(IMFSample *pSample) { // Queue the sample. ThrowIfError(m_Samples.InsertBack(pSample)); // Deliver the sample if there is an outstanding request. DispatchSamples(); }
HRESULT MPEG1Stream::EndOfStream() { SourceLock lock(m_pSource); m_bEOS = TRUE; return DispatchSamples(); }
HRESULT PpboxStream::RequestSample(IUnknown* pToken) { HRESULT hr = S_OK; IMFMediaSource *pSource = NULL; // Hold the media source object's critical section. SourceLock lock(m_pSource); hr = CheckShutdown(); if (FAILED(hr)) { goto done; } if (m_state == STATE_STOPPED) { hr = MF_E_INVALIDREQUEST; goto done; } if (!m_bActive) { // If the stream is not active, it should not get sample requests. hr = MF_E_INVALIDREQUEST; goto done; } if (m_bEOS && m_Samples.IsEmpty()) { // This stream has already reached the end of the stream, and the // sample queue is empty. hr = MF_E_END_OF_STREAM; goto done; } hr = m_Requests.InsertBack(pToken); if (FAILED(hr)) { goto done; } // Dispatch the request. hr = DispatchSamples(); if (FAILED(hr)) { goto done; } done: if (FAILED(hr) && (m_state != STATE_SHUTDOWN)) { // An error occurred. Send an MEError even from the source, // unless the source is already shut down. hr = m_pSource->QueueEvent(MEError, GUID_NULL, hr, NULL); } return hr; }
HRESULT FlvStream::DeliverPayload(IMFSample* sample) { // should we check shutdown status? SourceLock lock(source); // Queue the sample. samples.push_back(sample); // Deliver the sample if there is an outstanding request. return DispatchSamples(); }
void CMPEG1Stream::Start(const PROPVARIANT &varStart) { ThrowIfError(CheckShutdown()); // Queue the stream-started event. ThrowIfError(QueueEvent(MEStreamStarted, GUID_NULL, S_OK, &varStart)); m_state = STATE_STARTED; // If we are restarting from paused, there may be // queue sample requests. Dispatch them now. DispatchSamples(); }
HRESULT MPEG1Stream::DeliverPayload(IMFSample *pSample) { SourceLock lock(m_pSource); HRESULT hr = S_OK; // Queue the sample. CHECK_HR(hr = m_Samples.InsertBack(pSample)); // Deliver the sample if there is an outstanding request. CHECK_HR(hr = DispatchSamples()); done: return hr; }
HRESULT PpboxStream::DeliverPayload(IMFSample *pSample) { SourceLock lock(m_pSource); HRESULT hr = S_OK; // Queue the sample. hr = m_Samples.InsertBack(pSample); // Deliver the sample if there is an outstanding request. if (SUCCEEDED(hr)) { hr = DispatchSamples(); } return hr; }
HRESULT MPEG1Stream::RequestSample(IUnknown* pToken) { HRESULT hr = S_OK; IMFMediaSource *pSource = NULL; SourceLock lock(m_pSource); CHECK_HR(hr = CheckShutdown()); if (m_state == STATE_STOPPED) { CHECK_HR(hr = MF_E_INVALIDREQUEST); } if (!m_bActive) { // If the stream is not active, it should not get sample requests. CHECK_HR(hr = MF_E_INVALIDREQUEST); } // Fail if we reached the end of the stream AND the sample queue is empty, if (m_bEOS && m_Samples.IsEmpty()) { CHECK_HR(hr = MF_E_END_OF_STREAM); } CHECK_HR(hr = m_Requests.InsertBack(pToken)); // Dispatch the request. CHECK_HR(hr = DispatchSamples()); done: // If there was an error, queue MEError from the source (except after shutdown). if (FAILED(hr) && (m_state != STATE_SHUTDOWN)) { hr = m_pSource->QueueEvent(MEError, GUID_NULL, hr, NULL); } return hr; }
HRESULT FlvStream::Start(UINT64 nanosec, BOOL isseek) { SourceLock lock(source); _prop_variant_t starttime(nanosec); auto hr = CheckShutdown(); if (ok(hr) && isseek) { samples.clear();// abandon previsou cached samples, but keep tokens QueueEvent(MEStreamSeeked, GUID_NULL, hr, &starttime); } else if (ok(hr)) {// Queue the stream-started event. hr = QueueEvent(MEStreamStarted, GUID_NULL, S_OK, &starttime); } if (ok(hr)) { m_state = SourceState::STATE_STARTED; } // If we are restarting from paused, there may be // queue sample requests. Dispatch them now. if (ok(hr)) { hr = DispatchSamples(); } return hr; }
HRESULT FlvStream::RequestSample(IUnknown* token) { SourceLock lock(source); auto hr = CheckAcceptRequestSample(); if (ok(hr) && eos && samples.empty()) { hr = MF_E_END_OF_STREAM; } if(ok(hr)) requests.push_back(token); // Dispatch the request. if (ok(hr)) hr = DispatchSamples(); if (FAILED(hr) && (m_state != SourceState::STATE_SHUTDOWN)) { // An error occurred. Send an MEError even from the source, // unless the source is already shut down. hr = source->QueueEvent(MEError, GUID_NULL, hr, NULL); } return hr; }
void CMPEG1Stream::EndOfStream() { m_fEOS = true; DispatchSamples(); }