summaryrefslogtreecommitdiffstats
path: root/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2010-03-17 01:58:26 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2010-03-17 02:00:49 (GMT)
commitb30e7e47491bd33b31ee2dc5b4a69981f1212f09 (patch)
tree59b3f98f15bffb53a8329c10662d19ae93f5738b /src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
parentf3037064addd81ef73dd4b8a7b352e338239006d (diff)
downloadQt-b30e7e47491bd33b31ee2dc5b4a69981f1212f09.zip
Qt-b30e7e47491bd33b31ee2dc5b4a69981f1212f09.tar.gz
Qt-b30e7e47491bd33b31ee2dc5b4a69981f1212f09.tar.bz2
Pause the direct show graph when the playback rate is 0.0.
Reviewed-by: Justin McPherson
Diffstat (limited to 'src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp')
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp61
1 files changed, 46 insertions, 15 deletions
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
index 317fa5c..d54d188 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
@@ -274,7 +274,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
}
if (SUCCEEDED(hr)) {
- m_executedTasks = SetSource;
+ m_executedTasks |= SetSource;
m_pendingTasks |= Render;
if (m_audioOutput)
@@ -282,7 +282,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
if (m_videoOutput)
m_pendingTasks |= SetVideoOutput;
- if (m_rate != 1.0)
+ if (m_rate != 1.0 && m_rate != 0.0)
m_pendingTasks |= SetRate;
m_source = source;
@@ -319,7 +319,7 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
source->setDevice(m_stream);
if (SUCCEEDED(m_graph->AddFilter(source, L"Source"))) {
- m_executedTasks = SetSource;
+ m_executedTasks |= SetSource;
m_pendingTasks |= Render;
if (m_audioOutput)
@@ -327,7 +327,7 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
if (m_videoOutput)
m_pendingTasks |= SetVideoOutput;
- if (m_rate != 1.0)
+ if (m_rate != 1.0 && m_rate != 0.0)
m_pendingTasks |= SetRate;
m_source = source;
@@ -346,7 +346,10 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
void DirectShowPlayerService::doRender(QMutexLocker *locker)
{
- m_pendingTasks |= m_executedTasks & (Play | Pause);
+ if (m_executedTasks & Pause)
+ m_pendingTasks |= Pause;
+ else if (m_executedTasks & Play && m_rate != 0.0)
+ m_pendingTasks |= Play;
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
@@ -624,8 +627,13 @@ void DirectShowPlayerService::play()
{
QMutexLocker locker(&m_mutex);
- m_pendingTasks &= ~Pause;
- m_pendingTasks |= Play;
+ if (m_rate != 0.0) {
+ m_pendingTasks &= ~Pause;
+ m_pendingTasks |= Play;
+ } else {
+ m_pendingTasks |= Pause;
+ m_executedTasks |= Play;
+ }
if (m_executedTasks & Render) {
if (m_executedTasks & Stop) {
@@ -650,6 +658,7 @@ void DirectShowPlayerService::doPlay(QMutexLocker *locker)
if (SUCCEEDED(hr)) {
m_executedTasks |= Play;
+ m_executedTasks &= ~Pause;
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
} else {
@@ -704,6 +713,9 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker)
m_executedTasks |= Pause;
+ if (m_rate != 0.0)
+ m_executedTasks &= ~Play;
+
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
} else {
m_error = QMediaPlayer::ResourceError;
@@ -764,9 +776,27 @@ void DirectShowPlayerService::setRate(qreal rate)
{
QMutexLocker locker(&m_mutex);
- m_rate = rate;
+ if (m_rate == rate)
+ return;
+
+ if (rate == 0.0) {
+ if (m_pendingTasks & Play) {
+ m_executedTasks |= Play;
+ m_pendingTasks &= ~(Play | SetRate);
+
+ if (!((m_executingTask | m_executedTasks) & Pause))
+ m_pendingTasks |= Pause;
+ } else if ((m_executingTask | m_executedTasks) & Play) {
+ m_pendingTasks |= Pause;
+ }
+ } else {
+ m_pendingTasks |= SetRate;
+
+ if (m_rate == 0.0 && (m_executedTasks & Play) && !(m_executingTask & Play))
+ m_pendingTasks |= Play;
+ }
- m_pendingTasks |= SetRate;
+ m_rate = rate;
if (m_executedTasks & FinalizeLoad)
::SetEvent(m_taskHandle);
@@ -800,8 +830,9 @@ void DirectShowPlayerService::doSetRate(QMutexLocker *locker)
seeking->Release();
} else if (m_rate != 1.0) {
- m_rate = 1.0;
+ m_rate = 1.0;
}
+
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(RateChange)));
}
@@ -1344,16 +1375,16 @@ void DirectShowPlayerService::run()
m_executingTask = Stop;
doStop(&locker);
- } else if (m_pendingTasks & SetRate) {
- m_pendingTasks ^= SetRate;
- m_executingTask = SetRate;
-
- doSetRate(&locker);
} else if (m_pendingTasks & Pause) {
m_pendingTasks ^= Pause;
m_executingTask = Pause;
doPause(&locker);
+ } else if (m_pendingTasks & SetRate) {
+ m_pendingTasks ^= SetRate;
+ m_executingTask = SetRate;
+
+ doSetRate(&locker);
} else if (m_pendingTasks & Seek) {
m_pendingTasks ^= Seek;
m_executingTask = Seek;