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

List:       kde-commits
Subject:    [dragon] src/app: fix vidoe resume
From:       Harald Sitter <sitter () kde ! org>
Date:       2012-05-31 22:43:10
Message-ID: 20120531224310.9D401A60BB () git ! kde ! org
[Download RAW message or body]

Git commit b5c133bbe759a03dfb1e6c14a30fae17c57f20f8 by Harald Sitter.
Committed on 01/06/2012 at 00:43.
Pushed by sitter into branch 'master'.

fix vidoe resume

phonon does not support seeking before playback is started, this was
recently removed as it was supporting wrong(tm) code. playback
functions of phonon are either async or semi-async, therefore any
state bound actions must only be taken when the appropriate state was
entered

M  +7    -3    src/app/videoWindow.cpp
M  +2    -1    src/app/videoWindow.h

http://commits.kde.org/dragon/b5c133bbe759a03dfb1e6c14a30fae17c57f20f8

diff --git a/src/app/videoWindow.cpp b/src/app/videoWindow.cpp
index fa4c7f5..7b400a2 100644
--- a/src/app/videoWindow.cpp
+++ b/src/app/videoWindow.cpp
@@ -87,6 +87,7 @@ VideoWindow::VideoWindow( QWidget *parent )
         , m_subLanguages( new QActionGroup( this ) )
         , m_audioLanguages( new QActionGroup( this ) )
         , m_logo( new QLabel( this ) )
+        , m_initialOffset( 0 )
         , m_aDataOutput(0)
 {
 
@@ -219,10 +220,8 @@ VideoWindow::play( qint64 offset )
     QApplication::setOverrideCursor( Qt::WaitCursor );
 
     m_justLoaded = false;
+    m_initialOffset = offset;
     m_media->play();
-    if( offset > 0 )
-        seek( offset );
-    kDebug() << "Does this media have Video stream? " << TheStream::hasVideo();
 
     QApplication::restoreOverrideCursor();
 
@@ -506,6 +505,11 @@ kDebug() << "chapters: " << m_controller->availableChapters() << \
" titles: " <<  states << QLatin1String( "Loading" ) << QLatin1String( "Stopped" ) << \
QLatin1String( "Playing" ) << QLatin1String( "Buffering" ) << QLatin1String( "Paused" \
                ) << QLatin1String( "Error" );
     kDebug() << "going from " << states.at(oldstate) << " to " << \
states.at(currentState);  
+    if( currentState == Phonon::PlayingState && m_initialOffset > 0) {
+        seek(m_initialOffset);
+        m_initialOffset = 0;
+    }
+
     if( currentState == Phonon::PlayingState  && m_media->hasVideo() )
     {
         m_logo->hide();
diff --git a/src/app/videoWindow.h b/src/app/videoWindow.h
index c695add..543d28b 100644
--- a/src/app/videoWindow.h
+++ b/src/app/videoWindow.h
@@ -62,11 +62,12 @@ namespace Dragon
 
         QTimer* m_cursorTimer;
         bool m_justLoaded;
-		bool m_adjustedSize;
+        bool m_adjustedSize;
         QActionGroup* m_subLanguages;
         QActionGroup* m_audioLanguages;
         QWidget* m_logo;
         bool m_isPreview;
+        quint64 m_initialOffset;
 
         Phonon::VideoWidget *m_vWidget;
         Phonon::AudioOutput *m_aOutput;


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

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