From kde-commits Thu May 31 22:43:10 2012 From: Harald Sitter Date: Thu, 31 May 2012 22:43:10 +0000 To: kde-commits Subject: [dragon] src/app: fix vidoe resume Message-Id: <20120531224310.9D401A60BB () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=133850439112296 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 =3D false; + m_initialOffset =3D offset; m_media->play(); - if( offset > 0 ) - seek( offset ); - kDebug() << "Does this media have Video stream? " << TheStream::hasVid= eo(); = QApplication::restoreOverrideCursor(); = @@ -506,6 +505,11 @@ kDebug() << "chapters: " << m_controller->availableCha= pters() << " titles: " << states << QLatin1String( "Loading" ) << QLatin1String( "Stopped" ) << = QLatin1String( "Playing" ) << QLatin1String( "Buffering" ) << QLatin1String= ( "Paused" ) << QLatin1String( "Error" ); kDebug() << "going from " << states.at(oldstate) << " to " << states.a= t(currentState); = + if( currentState =3D=3D Phonon::PlayingState && m_initialOffset > 0) { + seek(m_initialOffset); + m_initialOffset =3D 0; + } + if( currentState =3D=3D 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;