void DirectShowSampleScheduler::setFlushing(bool flushing) { QMutexLocker locker(&m_mutex); const bool isFlushing = m_state & Flushing; if (isFlushing != flushing) { if (flushing) { m_state |= Flushing; for (DirectShowTimedSample *sample = m_head; sample; sample = sample->remove()) { sample->unschedule(m_clock); m_semaphore.release(1); } m_head = 0; m_tail = 0; ::SetEvent(m_flushEvent); } else { m_state &= ~Flushing; if (m_state != Stopped) ::ResetEvent(m_flushEvent); } } }
void DirectShowSampleScheduler::pause() { QMutexLocker locker(&m_mutex); m_state = (m_state & Flushing) | Paused; for (DirectShowTimedSample *sample = m_head; sample; sample = sample->nextSample()) sample->unschedule(m_clock); }
void DirectShowSampleScheduler::stop() { QMutexLocker locker(&m_mutex); m_state = m_state & Flushing; for (DirectShowTimedSample *sample = m_head; sample; sample = sample->remove()) { sample->unschedule(m_clock); m_semaphore.release(1); } m_head = 0; m_tail = 0; }