[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdemultimedia/phonon-xine
From: Matthias Kretz <kretz () kde ! org>
Date: 2007-06-18 14:42:32
Message-ID: 1182177752.579945.31546.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 677151 by mkretz:
perfect faking BufferingState when play() is called
M +27 -25 mediaobject.cpp
M +3 -2 mediaobject.h
--- trunk/KDE/kdemultimedia/phonon-xine/mediaobject.cpp #677150:677151
@@ -50,7 +50,8 @@
m_videoPath(0),
m_currentTitle(1),
m_transitionTime(0),
- m_autoplayTitles(true)
+ m_autoplayTitles(true),
+ m_fakingBuffering(false)
{
m_stream.moveToThread(&m_stream);
m_stream.start();
@@ -290,7 +291,7 @@
void MediaObject::play()
{
if (m_state == Phonon::StoppedState || m_state == Phonon::LoadingState || \
m_state == Phonon::PausedState) {
- changeState(Phonon::BufferingState);
+ startToFakeBuffering();
}
m_stream.play();
}
@@ -323,46 +324,47 @@
return m_stream.errorType();
}
-void MediaObject::changeState(Phonon::State newstate)
+void MediaObject::startToFakeBuffering()
{
+ if (m_state == Phonon::BufferingState) {
+ return;
+ }
+
// this method is for "fake" state changes the following state changes are not \
"fakable":
- Q_ASSERT(newstate != Phonon::PlayingState);
Q_ASSERT(m_state != Phonon::PlayingState);
+ kDebug(610) << "fake state change: reached BufferingState after " << m_state << \
endl;
- if (m_state == newstate) {
- return;
- }
-
Phonon::State oldstate = m_state;
- m_state = newstate;
+ m_state = Phonon::BufferingState;
+ m_fakingBuffering = true;
- /*
- if (newstate == Phonon::PlayingState) {
- reachedPlayingState();
- } else if (oldstate == Phonon::PlayingState) {
- leftPlayingState();
- }
- */
-
- kDebug(610) << "fake state change: reached " << newstate << " after " << \
oldstate << endl;
- emit stateChanged(newstate, oldstate);
+ emit stateChanged(Phonon::BufferingState, oldstate);
}
void MediaObject::handleStateChange(Phonon::State newstate, Phonon::State oldstate)
{
if (m_state == newstate) {
+ if (m_fakingBuffering) {
+ Q_ASSERT(m_state == BufferingState);
+ m_fakingBuffering = false;
+ }
+ // BufferingState -> BufferingState, nothing to do
return;
} else if (m_state != oldstate) {
- oldstate = m_state;
+ Q_ASSERT(m_fakingBuffering);
+ Q_ASSERT(m_state == BufferingState);
+ if (newstate == PlayingState || newstate == ErrorState) {
+ m_fakingBuffering = false;
+ oldstate = m_state;
+ } else {
+ // we're faking BufferingState and stay there until we either reach \
BufferingState, + // PlayingState or ErrorState
+ return;
+ }
}
m_state = newstate;
kDebug(610) << "reached " << newstate << " after " << oldstate << endl;
-//X if (newstate == Phonon::PlayingState) {
-//X reachedPlayingState();
-//X } else if (oldstate == Phonon::PlayingState) {
-//X leftPlayingState();
-//X }
emit stateChanged(newstate, oldstate);
}
void MediaObject::handleFinished()
--- trunk/KDE/kdemultimedia/phonon-xine/mediaobject.h #677150:677151
@@ -133,7 +133,7 @@
VideoPath* videoPath() const { return m_videoPath; }
protected slots:
- void changeState(Phonon::State);
+ void startToFakeBuffering();
private slots:
void handleStateChange(Phonon::State newstate, Phonon::State oldstate);
@@ -167,7 +167,8 @@
int m_currentTitle;
qint32 m_prefinishMark;
qint32 m_transitionTime;
- bool m_autoplayTitles;
+ bool m_autoplayTitles : 1;
+ bool m_fakingBuffering : 1;
};
}} //namespace Phonon::Xine
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic