summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2010-02-03 01:42:04 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2010-02-03 01:42:04 (GMT)
commit3c90f04c31d266a640ccf3b187d6971f7ade7500 (patch)
tree09a9e45f59ed686732c7d0b5a3b8c6d9aa56b40e
parent53ff697fb83c69e02a72a73ee13e9ca4f795c5a8 (diff)
downloadQt-3c90f04c31d266a640ccf3b187d6971f7ade7500.zip
Qt-3c90f04c31d266a640ccf3b187d6971f7ade7500.tar.gz
Qt-3c90f04c31d266a640ccf3b187d6971f7ade7500.tar.bz2
Share a single instance of DirectShowEventLoop between services.
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp22
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h2
2 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
index d205ac1..a3362db 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
@@ -58,6 +58,7 @@
#include <uuids.h>
+Q_GLOBAL_STATIC(DirectShowEventLoop, qt_directShowEventLoop)
QT_BEGIN_NAMESPACE
@@ -85,6 +86,7 @@ DirectShowPlayerService::DirectShowPlayerService(QObject *parent)
, m_videoRendererControl(0)
, m_videoWindowControl(0)
, m_taskThread(0)
+ , m_loop(qt_directShowEventLoop())
, m_pendingTasks(0)
, m_executingTask(0)
, m_executedTasks(0)
@@ -107,7 +109,7 @@ DirectShowPlayerService::DirectShowPlayerService(QObject *parent)
m_metaDataControl = new DirectShowMetaDataControl(this);
m_videoOutputControl = new DirectShowVideoOutputControl;
m_audioEndpointControl = new DirectShowAudioEndpointControl(this);
- m_videoRendererControl = new DirectShowVideoRendererControl(&m_loop);
+ m_videoRendererControl = new DirectShowVideoRendererControl(m_loop);
m_videoWindowControl = new Vmr9VideoWindowControl;
m_taskThread = new DirectShowPlayerServiceThread(this);
@@ -284,7 +286,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
{
- IBaseFilter *source = new DirectShowIOSource(m_stream, &m_loop);
+ IBaseFilter *source = new DirectShowIOSource(m_stream, m_loop);
if (SUCCEEDED(m_graph->AddFilter(source, L"Source"))) {
m_executedTasks = SetSource;
@@ -468,7 +470,7 @@ void DirectShowPlayerService::releaseGraph()
::SetEvent(m_taskHandle);
- m_loop.wait(&m_mutex);
+ m_loop->wait(&m_mutex);
}
}
@@ -491,7 +493,7 @@ void DirectShowPlayerService::doReleaseGraph(QMutexLocker *locker)
m_graph->Release();
m_graph = 0;
- m_loop.wake();
+ m_loop->wake();
}
int DirectShowPlayerService::findStreamTypes(IBaseFilter *source) const
@@ -665,7 +667,7 @@ void DirectShowPlayerService::stop()
if (m_executingTask & (Play | Pause | Seek)) {
m_pendingTasks |= Stop;
- m_loop.wait(&m_mutex);
+ m_loop->wait(&m_mutex);
}
if (m_executedTasks & (Play | Pause)) {
@@ -830,7 +832,7 @@ void DirectShowPlayerService::setAudioOutput(IBaseFilter *filter)
::SetEvent(m_taskHandle);
- m_loop.wait(&m_mutex);
+ m_loop->wait(&m_mutex);
}
m_audioOutput->Release();
}
@@ -876,7 +878,7 @@ void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker)
m_executedTasks &= ~SetAudioOutput;
- m_loop.wake();
+ m_loop->wake();
}
void DirectShowPlayerService::setVideoOutput(IBaseFilter *filter)
@@ -890,7 +892,7 @@ void DirectShowPlayerService::setVideoOutput(IBaseFilter *filter)
::SetEvent(m_taskHandle);
- m_loop.wait(&m_mutex);
+ m_loop->wait(&m_mutex);
}
m_videoOutput->Release();
}
@@ -934,7 +936,7 @@ void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker)
m_executedTasks &= ~SetVideoOutput;
- m_loop.wake();
+ m_loop->wake();
}
void DirectShowPlayerService::customEvent(QEvent *event)
@@ -1171,7 +1173,7 @@ void DirectShowPlayerService::run()
} else if (m_pendingTasks & Stop) {
m_pendingTasks ^= Stop;
- m_loop.wake();
+ m_loop->wake();
} else if (m_pendingTasks & Pause) {
m_pendingTasks ^= Pause;
m_executingTask = Pause;
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
index 9ea5d7d..576520e 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
@@ -181,6 +181,7 @@ private:
DirectShowAudioEndpointControl *m_audioEndpointControl;
QThread *m_taskThread;
+ DirectShowEventLoop *m_loop;
int m_pendingTasks;
int m_executingTask;
int m_executedTasks;
@@ -204,7 +205,6 @@ private:
QUrl m_url;
QMediaResourceList m_resources;
QMutex m_mutex;
- DirectShowEventLoop m_loop;
friend class DirectShowPlayerServiceThread;
};