summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/phonon')
-rw-r--r--src/3rdparty/phonon/ds9/mediaobject.cpp35
-rw-r--r--src/3rdparty/phonon/ds9/mediaobject.h3
-rw-r--r--src/3rdparty/phonon/ds9/videowidget.cpp17
3 files changed, 41 insertions, 14 deletions
diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp
index b163ad4dd..de2078ab3 100644
--- a/src/3rdparty/phonon/ds9/mediaobject.cpp
+++ b/src/3rdparty/phonon/ds9/mediaobject.cpp
@@ -192,8 +192,11 @@ namespace Phonon
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) {
int index = -1;
for(int i = 0; i < FILTER_COUNT; ++i) {
@@ -217,9 +220,6 @@ namespace Phonon
m_graphHandle[index].handle = h;
}
} else if (w.task == Render) {
- //we need to unlock here because the use might trigger a call to abort
- //which uses the same mutex
- locker.unlock();
if (w.filter) {
//let's render pins
w.graph->AddFilter(w.filter, 0);
@@ -238,7 +238,6 @@ namespace Phonon
if (hr != E_ABORT) {
emit asyncRenderFinished(w.id, hr, w.graph);
}
- locker.relock();
} else if (w.task == Seek) {
//that's a seekrequest
ComPointer<IMediaSeeking> mediaSeeking(w.graph, IID_IMediaSeeking);
@@ -311,12 +310,22 @@ namespace Phonon
}
}
- m_currentRender = Graph();
- m_currentRenderId = 0;
+ {
+ QMutexLocker locker(&m_currentMutex);
+ m_currentRender = Graph();
+ m_currentRenderId = 0;
+ }
}
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;
for(int i = 0; !found && i < m_queue.size(); ++i) {
@@ -324,12 +333,11 @@ 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
@@ -504,6 +512,9 @@ namespace Phonon
qSwap(m_graphs[0], m_graphs[1]); //swap the graphs
+ if (m_transitionTime >= 0)
+ m_graphs[1]->stop(); //make sure we stop the previous graph
+
if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid &&
catchComError(currentGraph()->renderResult())) {
setState(Phonon::ErrorState);
diff --git a/src/3rdparty/phonon/ds9/mediaobject.h b/src/3rdparty/phonon/ds9/mediaobject.h
index fe52604ae..a6beb5f59 100644
--- a/src/3rdparty/phonon/ds9/mediaobject.h
+++ b/src/3rdparty/phonon/ds9/mediaobject.h
@@ -143,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/ds9/videowidget.cpp b/src/3rdparty/phonon/ds9/videowidget.cpp
index 34ff8cbb8..091be16d9 100644
--- a/src/3rdparty/phonon/ds9/videowidget.cpp
+++ b/src/3rdparty/phonon/ds9/videowidget.cpp
@@ -84,7 +84,19 @@ namespace Phonon
void setCurrentRenderer(AbstractVideoRenderer *renderer)
{
m_currentRenderer = renderer;
- update();
+ //we disallow repaint on that widget for just a fraction of second
+ //this allows better transition between videos
+ setUpdatesEnabled(false);
+ m_flickerFreeTimer.start(20, this);
+ }
+
+ void timerEvent(QTimerEvent *e)
+ {
+ if (e->timerId() == m_flickerFreeTimer.timerId()) {
+ m_flickerFreeTimer.stop();
+ setUpdatesEnabled(true);
+ }
+ QWidget::timerEvent(e);
}
QSize sizeHint() const
@@ -106,6 +118,8 @@ namespace Phonon
void paintEvent(QPaintEvent *e)
{
+ if (!updatesEnabled())
+ return; //this avoids repaint from native events
checkCurrentRenderingMode();
m_currentRenderer->repaintCurrentFrame(this, e->rect());
}
@@ -160,6 +174,7 @@ namespace Phonon
VideoWidget *m_node;
AbstractVideoRenderer *m_currentRenderer;
QVariant m_restoreScreenSaverActive;
+ QBasicTimer m_flickerFreeTimer;
};
VideoWidget::VideoWidget(QWidget *parent)