[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdereview/phonon/gstreamer
From: Jens Bache-Wiig <jbache () trolltech ! com>
Date: 2008-01-25 15:45:54
Message-ID: 1201275954.970734.15456.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 766322 by jbache:
Integrate some fixes from Tiago, made testTickSignal pass.
M +4 -4 audiooutput.cpp
M +1 -1 audiooutput.h
M +1 -1 medianode.h
M +24 -15 mediaobject.cpp
M +1 -0 mediaobject.h
M +8 -0 videowidget.cpp
--- trunk/kdereview/phonon/gstreamer/audiooutput.cpp #766321:766322
@@ -31,7 +31,7 @@
AudioOutput::AudioOutput(Backend *backend, QObject *parent)
: QObject(parent)
, MediaNode(backend, AudioSink)
- , m_volume(1.0)
+ , m_volumeLevel(1.0)
, m_device(0) // ### get from backend
, m_volumeElement(0)
, m_audioBin(0)
@@ -93,7 +93,7 @@
qreal AudioOutput::volume() const
{
- return m_volume;
+ return m_volumeLevel;
}
int AudioOutput::outputDevice() const
@@ -108,10 +108,10 @@
else if (newVolume < 0.0)
newVolume = 0.0;
- if (newVolume == m_volume)
+ if (newVolume == m_volumeLevel)
return;
- m_volume = newVolume;
+ m_volumeLevel = newVolume;
if (m_volumeElement) {
g_object_set(G_OBJECT(m_volumeElement), "volume", newVolume, NULL);
--- trunk/kdereview/phonon/gstreamer/audiooutput.h #766321:766322
@@ -62,7 +62,7 @@
private:
- qreal m_volume;
+ qreal m_volumeLevel;
int m_device;
GstElement *m_volumeElement;
--- trunk/kdereview/phonon/gstreamer/medianode.h #766321:766322
@@ -44,7 +44,7 @@
VideoSource = 0x4,
VideoSink = 0x8
};
- Q_DECLARE_FLAGS(NodeDescription, NodeDescriptionEnum);
+ Q_DECLARE_FLAGS(NodeDescription, NodeDescriptionEnum)
MediaNode(Backend *backend, NodeDescription description);
--- trunk/kdereview/phonon/gstreamer/mediaobject.cpp #766321:766322
@@ -34,8 +34,6 @@
#define ABOUT_TO_FINNISH_TIME 2000
-#include <unistd.h> // for usleep
-
QT_BEGIN_NAMESPACE
namespace Phonon
@@ -69,6 +67,7 @@
, m_pipeline(0)
, m_audioGraph(0)
, m_videoGraph(0)
+ , m_previousTickTime(-1)
{
qRegisterMetaType<GstCaps>("GstCaps");
@@ -432,10 +431,13 @@
case Phonon::PausedState:
m_backend->logMessage("phonon state request: paused", Backend::Info, this);
- if (GST_STATE(m_pipeline) == GST_STATE_PAUSED) {
+ if ((GST_STATE(m_pipeline) == GST_STATE_PAUSED) && \
(GST_STATE_PENDING(m_pipeline) == GST_STATE_PAUSED)) { \
changeState(Phonon::PausedState);
} else if (gst_element_set_state(m_pipeline, GST_STATE_PAUSED) != \
GST_STATE_CHANGE_FAILURE) { m_pendingState = Phonon::PausedState;
+ // If pipeline was already paused, and pending state was canceled:
+ if (GST_STATE(m_pipeline) == GST_STATE_PAUSED)
+ changeState(Phonon::PausedState);
} else {
m_backend->logMessage("phonon state request failed", Backend::Info, \
this); }
@@ -443,10 +445,14 @@
case Phonon::StoppedState:
m_backend->logMessage("phonon state request: Stopped", Backend::Info, this);
- if (GST_STATE(m_pipeline) == GST_STATE_READY) {
+ if ((GST_STATE(m_pipeline) == GST_STATE_READY) && \
(GST_STATE_PENDING(m_pipeline) == GST_STATE_READY)) { \
changeState(Phonon::StoppedState);
} else if (gst_element_set_state(m_pipeline, GST_STATE_READY) != \
GST_STATE_CHANGE_FAILURE) { m_pendingState = Phonon::StoppedState;
+ // If pipeline was already stopped, and pending state was canceled:
+ if (GST_STATE(m_pipeline) == GST_STATE_READY) {
+ changeState(Phonon::StoppedState);
+ }
} else {
m_backend->logMessage("phonon state request failed", Backend::Info, \
this); }
@@ -454,10 +460,13 @@
case Phonon::PlayingState:
m_backend->logMessage("phonon state request: Playing", Backend::Info, this);
- if (GST_STATE(m_pipeline) == GST_STATE_PLAYING) {
+ if ((GST_STATE(m_pipeline) == GST_STATE_PLAYING) && \
(GST_STATE_PENDING(m_pipeline) == GST_STATE_PLAYING)) { \
changeState(Phonon::PlayingState);
} else if (gst_element_set_state(m_pipeline, GST_STATE_PLAYING) != \
GST_STATE_CHANGE_FAILURE) { m_pendingState = Phonon::PlayingState;
+ // If pipeline was already playing, and pending state was canceled:
+ if (GST_STATE(m_pipeline) == GST_STATE_PLAYING)
+ changeState(Phonon::PlayingState);
} else {
m_backend->logMessage("phonon state request failed", Backend::Info, \
this); }
@@ -647,8 +656,6 @@
if (errorType() == FatalError)
return;
- stop();
-
// We have to reset the state completely here, otherwise
// remnants of the old pipeline can result in strangenes
// such as failing duration queries etc
@@ -656,8 +663,8 @@
setError(tr("Unable to flush pipeline"));
}
emit currentSourceChanged(m_source);
+ m_previousTickTime = -1;
-
// Go into to loading state
changeState(Phonon::LoadingState);
m_loading = true;
@@ -823,8 +830,10 @@
qint64 currentTime = getPipelinePos();
qint64 totalTime = m_totalTime;
- if (m_tickInterval > 0)
+ if (m_tickInterval > 0 && currentTime != m_previousTickTime) {
emit tick(currentTime);
+ m_previousTickTime = currentTime;
+ }
if (currentTime >= totalTime - m_prefinishMark) {
if (m_prefinishMarkReachedNotEmitted) {
@@ -969,8 +978,9 @@
case GST_STATE_PLAYING :
m_backend->logMessage("gstreamer: pipeline state set to playing", \
Backend::Info, this); m_tickTimer->start();
- changeState(Phonon::PlayingState);
- emitTick();
+ if (m_pendingState == Phonon::PlayingState) {
+ changeState(Phonon::PlayingState);
+ }
break;
case GST_STATE_NULL:
@@ -980,8 +990,7 @@
case GST_STATE_PAUSED :
m_backend->logMessage("gstreamer: pipeline state set to paused", \
Backend::Info, this);
- m_tickTimer->stop();
-
+ m_tickTimer->start();
if (state() == Phonon::LoadingState) {
// If we have video, wait for setVideoCaps
// otherwise we are already done.
@@ -990,9 +999,9 @@
}
} else {
- if (m_pendingState == Phonon::PausedState)
+ if (m_pendingState == Phonon::PausedState) {
changeState(Phonon::PausedState);
- emitTick();
+ }
}
break;
--- trunk/kdereview/phonon/gstreamer/mediaobject.h #766321:766322
@@ -229,6 +229,7 @@
bool m_seekable;
Phonon::ErrorType m_error;
QString m_errorString;
+ int m_previousTickTime;
GstElement *m_pipeline;
GstElement *m_audioGraph;
--- trunk/kdereview/phonon/gstreamer/videowidget.cpp #766321:766322
@@ -24,6 +24,14 @@
#include "videowidget.h"
#include "qrgb.h"
+// support old OpenGL installations (1.2)
+// assume that if TEXTURE0 isn't defined, none are
+#ifndef GL_TEXTURE0
+# define GL_TEXTURE0 0x84C0
+# define GL_TEXTURE1 0x84C1
+# define GL_TEXTURE2 0x84C2
+#endif
+
QT_BEGIN_NAMESPACE
static void frameRendered()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic