diff options
author | Morten Sørvig <msorvig@trolltech.com> | 2009-08-24 12:02:51 (GMT) |
---|---|---|
committer | Morten Sørvig <msorvig@trolltech.com> | 2009-08-24 12:02:51 (GMT) |
commit | e3078a5db9e092d78813180ce077789551929e4f (patch) | |
tree | fce2a4b5607c8dc796faececf71f78ae83effe4e /src/3rdparty | |
parent | 3a801a667c7c78076fc4aa84e47432ddd4a382a5 (diff) | |
parent | db0ebfd97d14bf3c537957d9642ba014318f8418 (diff) | |
download | Qt-e3078a5db9e092d78813180ce077789551929e4f.zip Qt-e3078a5db9e092d78813180ce077789551929e4f.tar.gz Qt-e3078a5db9e092d78813180ce077789551929e4f.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/ds9/ds9.desktop | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/mediaobject.cpp | 73 | ||||
-rw-r--r-- | src/3rdparty/phonon/ds9/mediaobject.h | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/phonon/mediasource.cpp | 8 | ||||
-rw-r--r-- | src/3rdparty/sha1/sha1.cpp | 2 |
5 files changed, 44 insertions, 45 deletions
diff --git a/src/3rdparty/phonon/ds9/ds9.desktop b/src/3rdparty/phonon/ds9/ds9.desktop index 370011e..ece3c9c 100644 --- a/src/3rdparty/phonon/ds9/ds9.desktop +++ b/src/3rdparty/phonon/ds9/ds9.desktop @@ -5,7 +5,7 @@ MimeType=application/x-annodex;video/quicktime;video/x-quicktime;audio/x-m4a;app X-KDE-Library=phonon_ds9 X-KDE-PhononBackendInfo-InterfaceVersion=1 X-KDE-PhononBackendInfo-Version=0.1 -X-KDE-PhononBackendInfo-Website=http://www.trolltech.com/ +X-KDE-PhononBackendInfo-Website=http://qt.nokia.com/ InitialPreference=15 Name=DirectShow9 diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 1d0b69d..f7fd6ae 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -57,24 +57,6 @@ namespace Phonon { } - WorkerThread::Work WorkerThread::dequeueWork() - { - QMutexLocker locker(&m_mutex); - if (m_finished) { - return Work(); - } - Work ret = m_queue.dequeue(); - - //we ensure to have the wait condition in the right state - if (m_queue.isEmpty()) { - m_waitCondition.reset(); - } else { - m_waitCondition.set(); - } - - return ret; - } - void WorkerThread::run() { while (m_finished == false) { @@ -88,11 +70,6 @@ namespace Phonon } DWORD result = ::WaitForMultipleObjects(count, handles, FALSE, INFINITE); if (result == WAIT_OBJECT_0) { - if (m_finished) { - //that's the end if the thread execution - return; - } - handleTask(); } else { //this is the event management @@ -199,18 +176,28 @@ namespace Phonon void WorkerThread::handleTask() { - const Work w = dequeueWork(); - - if (m_finished) { + QMutexLocker locker(&m_mutex); + if (m_finished || m_queue.isEmpty()) { return; } + const Work w = m_queue.dequeue(); + + //we ensure to have the wait condition in the right state + if (m_queue.isEmpty()) { + m_waitCondition.reset(); + } else { + m_waitCondition.set(); + } + HRESULT hr = S_OK; - m_currentRender = w.graph; - m_currentRenderId = w.id; + { + QMutexLocker locker(&m_currentMutex); + m_currentRender = w.graph; + m_currentRenderId = w.id; + } if (w.task == ReplaceGraph) { - QMutexLocker locker(&m_mutex); HANDLE h; int index = -1; @@ -324,13 +311,22 @@ namespace Phonon } } - m_currentRender = Graph(); - m_currentRenderId = 0; - + { + QMutexLocker locker(&m_currentMutex); + m_currentRender = Graph(); + m_currentRenderId = 0; + } } - void WorkerThread::abortCurrentRender(qint16 renderId) - { + void WorkerThread::abortCurrentRender(qint16 renderId) + { + { + QMutexLocker locker(&m_currentMutex); + if (m_currentRender && m_currentRenderId == renderId) { + m_currentRender->Abort(); + } + } + QMutexLocker locker(&m_mutex); bool found = false; //we try to see if there is already an attempt to seek and we remove it @@ -339,13 +335,12 @@ namespace Phonon if (w.id == renderId) { found = true; m_queue.removeAt(i); + if (m_queue.isEmpty()) { + m_waitCondition.reset(); + } } } - - if (m_currentRender && m_currentRenderId == renderId) { - m_currentRender->Abort(); - } - } + } //tells the thread to stop processing void WorkerThread::signalStop() diff --git a/src/3rdparty/phonon/ds9/mediaobject.h b/src/3rdparty/phonon/ds9/mediaobject.h index 2c34ffc..a6beb5f 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.h +++ b/src/3rdparty/phonon/ds9/mediaobject.h @@ -135,7 +135,6 @@ namespace Phonon }; QList<Filter> decoders; //for the state change requests }; - Work dequeueWork(); void handleTask(); Graph m_currentRender; @@ -144,7 +143,8 @@ namespace Phonon bool m_finished; quint16 m_currentWorkId; QWinWaitCondition m_waitCondition; - QMutex m_mutex; + QMutex m_mutex; // mutex for the m_queue, m_finished and m_currentWorkId + QMutex m_currentMutex; //mutex for current renderer and id //this is for WaitForMultipleObjects struct diff --git a/src/3rdparty/phonon/phonon/mediasource.cpp b/src/3rdparty/phonon/phonon/mediasource.cpp index 0a21c87..c003af9 100644 --- a/src/3rdparty/phonon/phonon/mediasource.cpp +++ b/src/3rdparty/phonon/phonon/mediasource.cpp @@ -140,8 +140,12 @@ MediaSourcePrivate::~MediaSourcePrivate() { #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM if (autoDelete) { - delete stream; - delete ioDevice; + //here we use deleteLater because this object + //might be destroyed from another thread + if (stream) + stream->deleteLater(); + if (ioDevice) + ioDevice->deleteLater(); } #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM } diff --git a/src/3rdparty/sha1/sha1.cpp b/src/3rdparty/sha1/sha1.cpp index 03c2773..072a45f 100644 --- a/src/3rdparty/sha1/sha1.cpp +++ b/src/3rdparty/sha1/sha1.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ |