[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [gwenview/workaround-phonon-gstreamer-finished-bug] lib/documentview: Work around for phonon gstream
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2012-09-21 13:58:56
Message-ID: 20120921135856.64DB5A6094 () git ! kde ! org
[Download RAW message or body]

Git commit dd7f70ad936a7cb342cf52e9e100d485539b667e by Aurélien Gâteau.
Committed on 21/09/2012 at 15:56.
Pushed by gateau into branch 'workaround-phonon-gstreamer-finished-bug'.

Work around for phonon gstreamer bug

Current phonon gstreamer does not emit the finished() signal immediatly
after reaching the end of the video.

@Phonon people: do you think the workaround in this commit is
acceptable?

CCBUG: 307156

M  +13   -0    lib/documentview/videoviewadapter.cpp

http://commits.kde.org/gwenview/dd7f70ad936a7cb342cf52e9e100d485539b667e

diff --git a/lib/documentview/videoviewadapter.cpp b/lib/documentview/videoviewadapter.cpp
index deddcd4..e9895ad 100644
--- a/lib/documentview/videoviewadapter.cpp
+++ b/lib/documentview/videoviewadapter.cpp
@@ -346,6 +346,19 @@ void VideoViewAdapter::slotTicked(qint64 value)
     if (!d->mSeekSlider->isSliderDown()) {
         d->mSeekSlider->setValue(value);
     }
+    if (value == d->mMediaObject->totalTime()) {
+        // With phonon-gstreamer backend we sometimes have to wait for 8 seconds
+        // after the end of the video for the finished() signal to be emitted.
+        // See https://bugs.kde.org/show_bug.cgi?id=307156
+        // To workaround this, we emit videoFinished() ourself if the tick value
+        // reaches totalTime.
+        // tick() will continue to be emitted with the same end value until
+        // finished() is emitted. To avoid emitting videoFinished() several times,
+        // We disconnect from tick() and finished().
+        disconnect(d->mMediaObject, SIGNAL(finished()), this, SIGNAL(videoFinished()));
+        disconnect(d->mMediaObject, SIGNAL(tick(qint64)), this, SIGNAL(slotTicked(qint64)));
+        videoFinished();
+    }
 }
 
 } // namespace
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic