diff options
Diffstat (limited to 'src/3rdparty/phonon')
-rw-r--r-- | src/3rdparty/phonon/ds9/mediaobject.cpp | 27 | ||||
-rw-r--r-- | src/3rdparty/phonon/gstreamer/audiooutput.cpp | 1 | ||||
-rw-r--r-- | src/3rdparty/phonon/gstreamer/mediaobject.cpp | 100 | ||||
-rw-r--r-- | src/3rdparty/phonon/gstreamer/mediaobject.h | 49 | ||||
-rw-r--r-- | src/3rdparty/phonon/gstreamer/x11renderer.cpp | 1 | ||||
-rw-r--r-- | src/3rdparty/phonon/phonon/phononnamespace.h | 5 | ||||
-rw-r--r-- | src/3rdparty/phonon/qt7/audionode.mm | 16 | ||||
-rw-r--r-- | src/3rdparty/phonon/qt7/backendinfo.mm | 1 | ||||
-rw-r--r-- | src/3rdparty/phonon/qt7/quicktimevideoplayer.h | 1 |
9 files changed, 158 insertions, 43 deletions
diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 93a19b0..1d0b69d 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -519,6 +519,15 @@ namespace Phonon qSwap(m_graphs[0], m_graphs[1]); //swap the graphs + if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid && + catchComError(currentGraph()->renderResult())) { + setState(Phonon::ErrorState); + return; + } + + //we need to play the next media + play(); + //we tell the video widgets to switch now to the new source #ifndef QT_NO_PHONON_VIDEO for (int i = 0; i < m_videoWidgets.count(); ++i) { @@ -527,15 +536,6 @@ namespace Phonon #endif //QT_NO_PHONON_VIDEO emit currentSourceChanged(currentGraph()->mediaSource()); - - if (currentGraph()->isLoading()) { - //will simply tell that when loading is finished - //it should start the playback - play(); - } - - - emit metaDataChanged(currentGraph()->metadata()); if (nextGraph()->hasVideo() != currentGraph()->hasVideo()) { @@ -548,15 +548,6 @@ namespace Phonon #ifndef QT_NO_PHONON_MEDIACONTROLLER setTitles(currentGraph()->titles()); #endif //QT_NO_PHONON_MEDIACONTROLLER - - //this manages only gapless transitions - if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid) { - if (catchComError(currentGraph()->renderResult())) { - setState(Phonon::ErrorState); - } else { - play(); - } - } } Phonon::State MediaObject::state() const diff --git a/src/3rdparty/phonon/gstreamer/audiooutput.cpp b/src/3rdparty/phonon/gstreamer/audiooutput.cpp index fcadac2..138a7e4 100644 --- a/src/3rdparty/phonon/gstreamer/audiooutput.cpp +++ b/src/3rdparty/phonon/gstreamer/audiooutput.cpp @@ -42,6 +42,7 @@ AudioOutput::AudioOutput(Backend *backend, QObject *parent) static int count = 0; m_name = "AudioOutput" + QString::number(count++); if (m_backend->isValid()) { + g_set_application_name(qApp->applicationName().toUtf8()); m_audioBin = gst_bin_new (NULL); gst_object_ref (GST_OBJECT (m_audioBin)); gst_object_sink (GST_OBJECT (m_audioBin)); diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 5398f0c..74fc1b4 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -14,7 +14,6 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. */ - #include <cmath> #include <gst/interfaces/propertyprobe.h> #include "common.h" @@ -24,7 +23,6 @@ #include "backend.h" #include "streamreader.h" #include "phononsrc.h" - #include <QtCore> #include <QtCore/QTimer> #include <QtCore/QVector> @@ -78,6 +76,9 @@ MediaObject::MediaObject(Backend *backend, QObject *parent) , m_videoGraph(0) , m_previousTickTime(-1) , m_resetNeeded(false) + , m_autoplayTitles(true) + , m_availableTitles(0) + , m_currentTitle(1) { qRegisterMetaType<GstCaps*>("GstCaps*"); qRegisterMetaType<State>("State"); @@ -902,8 +903,13 @@ void MediaObject::setSource(const MediaSource &source) break; case MediaSource::Disc: // CD tracks can be specified by setting the url in the following way uri=cdda:4 - m_backend->logMessage("Source type Disc not currently supported", Backend::Warning, this); - setError(tr("Could not open media source."), Phonon::NormalError); + { + QUrl cdurl(QLatin1String("cdda://")); + if (createPipefromURL(cdurl)) + m_loading = true; + else + setError(tr("Could not open media source.")); + } break; default: @@ -954,6 +960,19 @@ void MediaObject::getStreamInfo() m_hasVideo = m_videoStreamFound; emit hasVideoChanged(m_hasVideo); } + + m_availableTitles = 1; + gint64 titleCount; + GstFormat format = gst_format_get_by_nick("track"); + if (gst_element_query_duration (m_pipeline, &format, &titleCount)) { + int oldAvailableTitles = m_availableTitles; + m_availableTitles = (int)titleCount; + if (m_availableTitles != oldAvailableTitles) { + emit availableTitlesChanged(m_availableTitles); + m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); + } + } + } void MediaObject::setPrefinishMark(qint32 newPrefinishMark) @@ -1351,6 +1370,13 @@ void MediaObject::handleEndOfStream() if (!m_seekable) m_atEndOfStream = true; + if (m_autoplayTitles && + m_availableTitles > 1 && + m_currentTitle < m_availableTitles) { + _iface_setCurrentTitle(m_currentTitle + 1); + return; + } + if (m_nextSource.type() != MediaSource::Invalid && m_nextSource.type() != MediaSource::Empty) { // We only emit finish when the queue is actually empty QTimer::singleShot (qMax(0, transitionTime()), this, SLOT(beginPlay())); @@ -1379,6 +1405,72 @@ void MediaObject::notifyStateChange(Phonon::State newstate, Phonon::State oldsta notify(&event); } +#ifndef QT_NO_PHONON_MEDIACONTROLLER +//interface management +bool MediaObject::hasInterface(Interface iface) const +{ + return iface == AddonInterface::TitleInterface; +} + +QVariant MediaObject::interfaceCall(Interface iface, int command, const QList<QVariant> ¶ms) +{ + if (hasInterface(iface)) { + + switch (iface) + { + case TitleInterface: + switch (command) + { + case availableTitles: + return _iface_availableTitles(); + case title: + return _iface_currentTitle(); + case setTitle: + _iface_setCurrentTitle(params.first().toInt()); + break; + case autoplayTitles: + return m_autoplayTitles; + case setAutoplayTitles: + m_autoplayTitles = params.first().toBool(); + break; + } + break; + default: + break; + } + } + return QVariant(); +} +#endif + +int MediaObject::_iface_availableTitles() const +{ + return m_availableTitles; +} + +int MediaObject::_iface_currentTitle() const +{ + return m_currentTitle; +} + +void MediaObject::_iface_setCurrentTitle(int title) +{ + GstFormat trackFormat = gst_format_get_by_nick("track"); + m_backend->logMessage(QString("setCurrentTitle %0").arg(title), Backend::Info, this); + if ((title == m_currentTitle) || (title < 1) || (title > m_availableTitles)) + return; + + m_currentTitle = title; + + //let's seek to the beginning of the song + if (gst_element_seek_simple(m_pipeline, trackFormat, GST_SEEK_FLAG_FLUSH, m_currentTitle - 1)) { + updateTotalTime(); + m_atEndOfStream = false; + emit titleChanged(title); + emit totalTimeChanged(totalTime()); + } +} + } // ns Gstreamer } // ns Phonon diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.h b/src/3rdparty/phonon/gstreamer/mediaobject.h index 4dc3f12..64b3510 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.h +++ b/src/3rdparty/phonon/gstreamer/mediaobject.h @@ -21,7 +21,6 @@ #include "backend.h" #include "common.h" #include "medianode.h" - #include <phonon/mediaobjectinterface.h> #include <phonon/addoninterface.h> @@ -32,7 +31,6 @@ #include <QtCore/QDate> #include <QtCore/QEvent> #include <QtCore/QUrl> - #include <gst/gst.h> QT_BEGIN_NAMESPACE @@ -50,11 +48,20 @@ class AudioPath; class VideoPath; class AudioOutput; -class MediaObject : public QObject, public MediaObjectInterface, public AddonInterface, public MediaNode +class MediaObject : public QObject, public MediaObjectInterface +#ifndef QT_NO_PHONON_MEDIACONTROLLER + , public AddonInterface +#endif + , public MediaNode { friend class Stream; Q_OBJECT - Q_INTERFACES(Phonon::MediaObjectInterface Phonon::AddonInterface Phonon::Gstreamer::MediaNode) + Q_INTERFACES(Phonon::MediaObjectInterface +#ifndef QT_NO_PHONON_MEDIACONTROLLER + Phonon::AddonInterface +#endif + Phonon::Gstreamer::MediaNode + ) public: @@ -93,16 +100,10 @@ public: MediaSource source() const; // No additional interfaces currently supported - bool hasInterface(Interface) const - { - return false; - } - - QVariant interfaceCall(Interface, int, const QList<QVariant> &) - { - return QVariant(); - } - +#ifndef QT_NO_PHONON_MEDIACONTROLLER + bool hasInterface(Interface) const; + QVariant interfaceCall(Interface, int, const QList<QVariant> &); +#endif bool isLoading() { return m_loading; @@ -176,6 +177,19 @@ Q_SIGNALS: QMultiMap<QString, QString> metaData(); void setMetaData(QMultiMap<QString, QString> newData); + // AddonInterface: + void titleChanged(int); + void availableTitlesChanged(int); + + // Not implemented + void chapterChanged(int); + void availableChaptersChanged(int); + void angleChanged(int); + void availableAnglesChanged(int); + + void availableSubtitlesChanged(); + void availableAudioChannelsChanged(); + protected: void beginLoad(); void loadingComplete(); @@ -219,6 +233,10 @@ private: void updateSeekable(); qint64 getPipelinePos() const; + int _iface_availableTitles() const; + int _iface_currentTitle() const; + void _iface_setCurrentTitle(int title); + bool m_resumeState; State m_oldState; quint64 m_oldPos; @@ -264,6 +282,9 @@ private: bool m_resetNeeded; QStringList m_missingCodecs; QMultiMap<QString, QString> m_metaData; + bool m_autoplayTitles; + int m_availableTitles; + int m_currentTitle; }; } } //namespace Phonon::Gstreamer diff --git a/src/3rdparty/phonon/gstreamer/x11renderer.cpp b/src/3rdparty/phonon/gstreamer/x11renderer.cpp index 1de58b6..73877a8 100644 --- a/src/3rdparty/phonon/gstreamer/x11renderer.cpp +++ b/src/3rdparty/phonon/gstreamer/x11renderer.cpp @@ -137,6 +137,7 @@ void X11Renderer::scaleModeChanged(Phonon::VideoWidget::ScaleMode) void X11Renderer::movieSizeChanged(const QSize &movieSize) { + Q_UNUSED(movieSize); if (m_renderWidget) { m_renderWidget->setGeometry(m_videoWidget->calculateDrawFrameRect()); } diff --git a/src/3rdparty/phonon/phonon/phononnamespace.h b/src/3rdparty/phonon/phonon/phononnamespace.h index 0bbf4f4..2492ee6 100644 --- a/src/3rdparty/phonon/phonon/phononnamespace.h +++ b/src/3rdparty/phonon/phonon/phononnamespace.h @@ -25,6 +25,11 @@ #include "phonon_export.h" +#ifdef __QT_SYNCQT__ +// Tell syncqt to create a "Global" header here +#pragma qt_class(Phonon::Global) +#endif + /** * Helper macro that can be used like * \code diff --git a/src/3rdparty/phonon/qt7/audionode.mm b/src/3rdparty/phonon/qt7/audionode.mm index cb9e82f..961230c 100644 --- a/src/3rdparty/phonon/qt7/audionode.mm +++ b/src/3rdparty/phonon/qt7/audionode.mm @@ -68,13 +68,15 @@ void AudioNode::createAndConnectAUNodes() << QString(!FindNextComponent(0, &description) ? "ERROR: COMPONENT NOT FOUND!" : "OK!")) OSStatus err = noErr; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) - err = AUGraphAddNode(m_audioGraph->audioGraphRef(), &description, &m_auNode); - else -#endif - err = AUGraphNewNode(m_audioGraph->audioGraphRef(), &description, 0, 0, &m_auNode); - + + // The proper function to call here is AUGraphAddNode() but the type has + // changed between 10.5 and 10.6. it's still OK to call this function, but + // if we want to use the proper thing we need to move over to + // AudioComponentDescription everywhere, which is very similar to the + // ComponentDescription, but a different size. however, + // AudioComponentDescription only exists on 10.6+. More fun than we need to + // deal with at the moment, so we'll take the "deprecated" warning instead. + err = AUGraphNewNode(m_audioGraph->audioGraphRef(), &description, 0, 0, &m_auNode); BACKEND_ASSERT2(err != kAUGraphErr_OutputNodeErr, "A MediaObject can only be connected to one audio output device.", FATAL_ERROR) BACKEND_ASSERT2(err == noErr, "Could not create new AUNode.", FATAL_ERROR) } diff --git a/src/3rdparty/phonon/qt7/backendinfo.mm b/src/3rdparty/phonon/qt7/backendinfo.mm index e173f05..0d51db0 100644 --- a/src/3rdparty/phonon/qt7/backendinfo.mm +++ b/src/3rdparty/phonon/qt7/backendinfo.mm @@ -22,6 +22,7 @@ #include <AudioUnit/AudioUnit.h> #include <CoreServices/CoreServices.h> +#include <QtGui/qmacdefines_mac.h> #import <QTKit/QTMovie.h> #ifdef QUICKTIME_C_API_AVAILABLE diff --git a/src/3rdparty/phonon/qt7/quicktimevideoplayer.h b/src/3rdparty/phonon/qt7/quicktimevideoplayer.h index 0b3aec2..b80570a 100644 --- a/src/3rdparty/phonon/qt7/quicktimevideoplayer.h +++ b/src/3rdparty/phonon/qt7/quicktimevideoplayer.h @@ -20,6 +20,7 @@ #include "backendheader.h" +#include <QtGui/qmacdefines_mac.h> #import <QTKit/QTDataReference.h> #import <QTKit/QTMovie.h> |