diff options
author | axis <qt-info@nokia.com> | 2009-11-06 15:50:21 +0100 |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-11-06 15:50:21 +0100 |
commit | d1aa89647824cbaf9af4fc943d4514018973ddc1 (patch) | |
tree | e8e13c32613a896311117fc39c45fe8b6f27144d /src/3rdparty/phonon | |
parent | 351ba8b9ca4f0db176c9e3553d105be0ef35c844 (diff) | |
parent | daf5f511ee813fc4fffba64bed558d0413270388 (diff) | |
download | qt4-tools-d1aa89647824cbaf9af4fc943d4514018973ddc1.tar.gz |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/3rdparty/phonon')
45 files changed, 586 insertions, 100 deletions
diff --git a/src/3rdparty/phonon/ds9/iodevicereader.cpp b/src/3rdparty/phonon/ds9/iodevicereader.cpp index e0c505c7d9..695af59085 100644 --- a/src/3rdparty/phonon/ds9/iodevicereader.cpp +++ b/src/3rdparty/phonon/ds9/iodevicereader.cpp @@ -36,17 +36,20 @@ namespace Phonon //these mediatypes define a stream, its type will be autodetected by DirectShow static QVector<AM_MEDIA_TYPE> getMediaTypes() { - AM_MEDIA_TYPE mt = { MEDIATYPE_Stream, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; + //the order here is important because otherwise, + //directshow might not be able to detect the stream type correctly + + AM_MEDIA_TYPE mt = { MEDIATYPE_Stream, MEDIASUBTYPE_Avi, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; QVector<AM_MEDIA_TYPE> ret; - //normal auto-detect stream - ret << mt; //AVI stream - mt.subtype = MEDIASUBTYPE_Avi; ret << mt; //WAVE stream mt.subtype = MEDIASUBTYPE_WAVE; ret << mt; + //normal auto-detect stream (must be at the end!) + mt.subtype = MEDIASUBTYPE_NULL; + ret << mt; return ret; } diff --git a/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp b/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp index 924b6118d6..5d88d10cb2 100644 --- a/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp +++ b/src/3rdparty/phonon/gstreamer/abstractrenderer.cpp @@ -17,6 +17,7 @@ #include "abstractrenderer.h" +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE namespace Phonon @@ -52,5 +53,5 @@ void AbstractRenderer::movieSizeChanged(const QSize &size) } //namespace Phonon::Gstreamer QT_END_NAMESPACE - +#endif //QT_NO_PHONON_VIDEO diff --git a/src/3rdparty/phonon/gstreamer/abstractrenderer.h b/src/3rdparty/phonon/gstreamer/abstractrenderer.h index 140413d142..10a28227a5 100644 --- a/src/3rdparty/phonon/gstreamer/abstractrenderer.h +++ b/src/3rdparty/phonon/gstreamer/abstractrenderer.h @@ -23,6 +23,7 @@ #include "medianode.h" #include <phonon/videowidget.h> +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE class QString; @@ -58,5 +59,5 @@ protected: } //namespace Phonon::Gstreamer QT_END_NAMESPACE - +#endif //QT_NO_PHONON_VIDEO #endif // Phonon_GSTREAMER_ABSTRACTRENDERER_H diff --git a/src/3rdparty/phonon/gstreamer/artssink.cpp b/src/3rdparty/phonon/gstreamer/artssink.cpp index ff56da9d66..441607dd3e 100644 --- a/src/3rdparty/phonon/gstreamer/artssink.cpp +++ b/src/3rdparty/phonon/gstreamer/artssink.cpp @@ -233,7 +233,7 @@ static void arts_sink_init (ArtsSink * src, ArtsSinkClass * g_class) Q_UNUSED(g_class); GST_DEBUG_OBJECT (src, "initializing artssink"); src->stream = 0; - +#ifndef QT_NO_LIBRARY p_arts_init = (Ptr_arts_init)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_init"); p_arts_play_stream = (Ptr_arts_play_stream)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_play_stream"); p_arts_close_stream = (Ptr_arts_close_stream)QLibrary::resolve(QLatin1String("artsc"), 0, "arts_close_stream"); @@ -250,6 +250,7 @@ static void arts_sink_init (ArtsSink * src, ArtsSinkClass * g_class) } } sinkCount ++; +#endif //QT_NO_LIBRARY } static void arts_sink_dispose (GObject * object) diff --git a/src/3rdparty/phonon/gstreamer/audioeffect.cpp b/src/3rdparty/phonon/gstreamer/audioeffect.cpp index db72c8b593..d3d7a35d0a 100644 --- a/src/3rdparty/phonon/gstreamer/audioeffect.cpp +++ b/src/3rdparty/phonon/gstreamer/audioeffect.cpp @@ -23,7 +23,7 @@ #include "gsthelper.h" #include <gst/gst.h> - +#ifndef QT_NO_PHONON_EFFECT QT_BEGIN_NAMESPACE namespace Phonon @@ -75,4 +75,5 @@ GstElement* AudioEffect::createEffectBin() } //namespace Phonon::Gstreamer QT_END_NAMESPACE +#endif //QT_NO_PHONON_EFFECT #include "moc_audioeffect.cpp" diff --git a/src/3rdparty/phonon/gstreamer/audioeffect.h b/src/3rdparty/phonon/gstreamer/audioeffect.h index 3a985e553b..f49f8d2061 100644 --- a/src/3rdparty/phonon/gstreamer/audioeffect.h +++ b/src/3rdparty/phonon/gstreamer/audioeffect.h @@ -29,8 +29,8 @@ #include <gst/gst.h> +#ifndef QT_NO_PHONON_EFFECT QT_BEGIN_NAMESPACE - namespace Phonon { namespace Gstreamer @@ -49,7 +49,7 @@ namespace Gstreamer QString m_effectName; }; }} //namespace Phonon::Gstreamer - QT_END_NAMESPACE +#endif //QT_NO_PHONON_EFFECT #endif // Phonon_GSTREAMER_AUDIOEFFECT_H diff --git a/src/3rdparty/phonon/gstreamer/backend.cpp b/src/3rdparty/phonon/gstreamer/backend.cpp index cd49454ea8..e1ffd1fe24 100644 --- a/src/3rdparty/phonon/gstreamer/backend.cpp +++ b/src/3rdparty/phonon/gstreamer/backend.cpp @@ -55,12 +55,13 @@ Backend::Backend(QObject *parent, const QVariantList &) g_error_free(err); qRegisterMetaType<Message>("Message"); - +#ifndef QT_NO_PROPERTIES setProperty("identifier", QLatin1String("phonon_gstreamer")); setProperty("backendName", QLatin1String("Gstreamer")); setProperty("backendComment", QLatin1String("Gstreamer plugin for Phonon")); setProperty("backendVersion", QLatin1String("0.2")); setProperty("backendWebsite", QLatin1String("http://qt.nokia.com/")); +#endif //QT_NO_PROPERTIES //check if we should enable debug output QString debugLevelString = qgetenv("PHONON_GST_DEBUG"); @@ -117,13 +118,15 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const m_audioOutputs.append(ao); return ao; } +#ifndef QT_NO_PHONON_EFFECT case EffectClass: return new AudioEffect(this, args[0].toInt(), parent); - +#endif //QT_NO_PHONON_EFFECT case AudioDataOutputClass: logMessage("createObject() : AudioDataOutput not implemented"); break; +#ifndef QT_NO_PHONON_VIDEO case VideoDataOutputClass: logMessage("createObject() : VideoDataOutput not implemented"); break; @@ -132,9 +135,11 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QWidget *widget = qobject_cast<QWidget*>(parent); return new VideoWidget(this, widget); } - +#endif //QT_NO_PHONON_VIDEO +#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT case VolumeFaderEffectClass: return new VolumeFaderEffect(this, parent); +#endif //QT_NO_PHONON_VOLUMEFADEREFFECT case VisualizationClass: //Fall through default: diff --git a/src/3rdparty/phonon/gstreamer/devicemanager.cpp b/src/3rdparty/phonon/gstreamer/devicemanager.cpp index 22403966d5..60e860f1d4 100644 --- a/src/3rdparty/phonon/gstreamer/devicemanager.cpp +++ b/src/3rdparty/phonon/gstreamer/devicemanager.cpp @@ -72,18 +72,21 @@ DeviceManager::DeviceManager(Backend *backend) : QObject(backend) , m_backend(backend) { + m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); + m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); + +#ifndef QT_NO_SETTINGS QSettings settings(QLatin1String("Trolltech")); settings.beginGroup(QLatin1String("Qt")); - m_audioSink = qgetenv("PHONON_GST_AUDIOSINK"); if (m_audioSink.isEmpty()) { m_audioSink = settings.value(QLatin1String("audiosink"), "Auto").toByteArray().toLower(); } - m_videoSinkWidget = qgetenv("PHONON_GST_VIDEOMODE"); if (m_videoSinkWidget.isEmpty()) { m_videoSinkWidget = settings.value(QLatin1String("videomode"), "Auto").toByteArray().toLower(); } +#endif //QT_NO_SETTINGS if (m_backend->isValid()) updateDeviceList(); @@ -243,6 +246,7 @@ GstElement *DeviceManager::createAudioSink(Category category) return sink; } +#ifndef QT_NO_PHONON_VIDEO AbstractRenderer *DeviceManager::createVideoRenderer(VideoWidget *parent) { #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES) @@ -265,6 +269,7 @@ AbstractRenderer *DeviceManager::createVideoRenderer(VideoWidget *parent) #endif return new WidgetRenderer(parent); } +#endif //QT_NO_PHONON_VIDEO /* * Returns a positive device id or -1 if device diff --git a/src/3rdparty/phonon/gstreamer/effect.cpp b/src/3rdparty/phonon/gstreamer/effect.cpp index f653535963..4937246a6d 100644 --- a/src/3rdparty/phonon/gstreamer/effect.cpp +++ b/src/3rdparty/phonon/gstreamer/effect.cpp @@ -25,8 +25,8 @@ #include <gst/gst.h> +#ifndef QT_NO_PHONON_EFFECT QT_BEGIN_NAMESPACE - namespace Phonon { namespace Gstreamer @@ -241,6 +241,6 @@ void Effect::setParameterValue(const EffectParameter &p, const QVariant &v) } } //namespace Phonon::Gstreamer - QT_END_NAMESPACE +#endif //QT_NO_PHONON_EFFECT #include "moc_effect.cpp" diff --git a/src/3rdparty/phonon/gstreamer/effect.h b/src/3rdparty/phonon/gstreamer/effect.h index dbbb45748c..51cbe9c6fb 100644 --- a/src/3rdparty/phonon/gstreamer/effect.h +++ b/src/3rdparty/phonon/gstreamer/effect.h @@ -28,8 +28,8 @@ #include <gst/gst.h> +#ifndef QT_NO_PHONON_EFFECT QT_BEGIN_NAMESPACE - namespace Phonon { namespace Gstreamer @@ -58,7 +58,7 @@ namespace Gstreamer QList<Phonon::EffectParameter> m_parameterList; }; }} //namespace Phonon::Gstreamer - QT_END_NAMESPACE +#endif //QT_NO_PHONON_EFFECT #endif // Phonon_GSTREAMER_EFFECT_H diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 5dcbd42f5d..5713263be7 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -87,7 +87,7 @@ MediaObject::MediaObject(Backend *backend, QObject *parent) m_name = "MediaObject" + QString::number(count++); if (!m_backend->isValid()) { - setError(tr("Cannot start playback. \n\nCheck your Gstreamer installation and make sure you " + setError(tr("Cannot start playback. \n\nCheck your GStreamer installation and make sure you " "\nhave libgstreamer-plugins-base installed."), Phonon::FatalError); } else { m_root = this; @@ -226,6 +226,7 @@ void MediaObject::cb_unknown_type (GstElement *decodebin, GstPad *pad, GstCaps * QString value = "unknown codec"; // These functions require GStreamer > 0.10.12 +#ifndef QT_NO_LIBRARY static Ptr_gst_pb_utils_init p_gst_pb_utils_init = 0; static Ptr_gst_pb_utils_get_codec_description p_gst_pb_utils_get_codec_description = 0; if (!p_gst_pb_utils_init) { @@ -239,10 +240,13 @@ void MediaObject::cb_unknown_type (GstElement *decodebin, GstPad *pad, GstCaps * codecName = p_gst_pb_utils_get_codec_description (caps); value = QString::fromUtf8(codecName); g_free (codecName); - } else { + } else +#endif //QT_NO_LIBRARY + { // For GStreamer versions < 0.10.12 GstStructure *str = gst_caps_get_structure (caps, 0); value = QString::fromUtf8(gst_structure_get_name (str)); + } media->addMissingCodecName(value); } @@ -392,6 +396,7 @@ bool MediaObject::createPipefromURL(const QUrl &url) */ bool MediaObject::createPipefromStream(const MediaSource &source) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM // Remove any existing data source if (m_datasource) { gst_bin_remove(GST_BIN(m_pipeline), m_datasource); @@ -413,6 +418,10 @@ bool MediaObject::createPipefromStream(const MediaSource &source) return false; } return true; +#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM + Q_UNUSED(source); + return false; +#endif } void MediaObject::createPipeline() diff --git a/src/3rdparty/phonon/gstreamer/phononsrc.cpp b/src/3rdparty/phonon/gstreamer/phononsrc.cpp index f893fb50b8..97d7220d98 100644 --- a/src/3rdparty/phonon/gstreamer/phononsrc.cpp +++ b/src/3rdparty/phonon/gstreamer/phononsrc.cpp @@ -109,18 +109,25 @@ static void phonon_src_class_init (PhononSrcClass * klass) static void phonon_src_init (PhononSrc * src, PhononSrcClass * g_class) { Q_UNUSED(g_class); +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM src->device = 0; +#else + Q_UNUSED(src); +#endif } static void phonon_src_finalize (GObject * object) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM PhononSrc *src; src = GST_PHONON_SRC (object); delete src->device; src->device = 0; +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM G_OBJECT_CLASS (parent_class)->finalize (object); } +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM static gboolean phonon_src_set_device(PhononSrc * src, StreamReader* device) { GstState state; @@ -145,6 +152,7 @@ wrong_state: return FALSE; } } +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM static void phonon_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { @@ -153,6 +161,7 @@ static void phonon_src_set_property (GObject * object, guint prop_id, const GVal src = GST_PHONON_SRC (object); switch (prop_id) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM case ARG_PHONONSRC: { StreamReader *dev = (StreamReader*)(g_value_get_pointer(value)); @@ -160,6 +169,9 @@ static void phonon_src_set_property (GObject * object, guint prop_id, const GVal phonon_src_set_device(src, dev); break; } +#else + Q_UNUSED(value); +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -174,9 +186,13 @@ static void phonon_src_get_property (GObject * object, guint prop_id, GValue * v src = GST_PHONON_SRC (object); switch (prop_id) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM case ARG_PHONONSRC: g_value_set_pointer(value, src->device); break; +#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM + Q_UNUSED(value); +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -185,6 +201,7 @@ static void phonon_src_get_property (GObject * object, guint prop_id, GValue * v static GstFlowReturn phonon_src_create_read (PhononSrc * src, guint64 offset, guint length, GstBuffer ** buffer) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM Q_ASSERT(src->device); if (!src->device) return GST_FLOW_ERROR; @@ -204,6 +221,13 @@ static GstFlowReturn phonon_src_create_read (PhononSrc * src, guint64 offset, gu gst_mini_object_unref(GST_MINI_OBJECT(buf)); return GST_FLOW_ERROR; +#else //QT_NO_PHONON_ABSTRACTMEDIASTREAM + Q_UNUSED(src); + Q_UNUSED(offset); + Q_UNUSED(length); + Q_UNUSED(buffer); + return GST_FLOW_ERROR; +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM } static GstFlowReturn phonon_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer) @@ -218,19 +242,23 @@ static GstFlowReturn phonon_src_create (GstBaseSrc * basesrc, guint64 offset, gu static gboolean phonon_src_is_seekable (GstBaseSrc * basesrc) { PhononSrc *src = GST_PHONON_SRC (basesrc); +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM if (src->device) return src->device->streamSeekable(); +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM return false; } static gboolean phonon_src_get_size (GstBaseSrc * basesrc, guint64 * size) { +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM PhononSrc *src; src = GST_PHONON_SRC (basesrc); if (src->device && src->device->streamSeekable()) { *size = src->device->streamSize(); return TRUE; } +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM *size = 0; return FALSE; } diff --git a/src/3rdparty/phonon/gstreamer/phononsrc.h b/src/3rdparty/phonon/gstreamer/phononsrc.h index a2cd8b39ff..a50f8a2635 100644 --- a/src/3rdparty/phonon/gstreamer/phononsrc.h +++ b/src/3rdparty/phonon/gstreamer/phononsrc.h @@ -49,7 +49,9 @@ typedef struct _PhononSrcClass PhononSrcClass; // PhononSrc: struct _PhononSrc { GstBaseSrc element; +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM StreamReader *device; +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM }; struct _PhononSrcClass { diff --git a/src/3rdparty/phonon/gstreamer/streamreader.cpp b/src/3rdparty/phonon/gstreamer/streamreader.cpp index 04fa6ccb04..f8219e633f 100644 --- a/src/3rdparty/phonon/gstreamer/streamreader.cpp +++ b/src/3rdparty/phonon/gstreamer/streamreader.cpp @@ -20,7 +20,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <phonon/streaminterface.h> QT_BEGIN_NAMESPACE - +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM namespace Phonon { namespace Gstreamer @@ -49,5 +49,6 @@ bool StreamReader::read(quint64 pos, int length, char * buffer) } } +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/gstreamer/streamreader.h b/src/3rdparty/phonon/gstreamer/streamreader.h index c2e61c8302..387370c488 100644 --- a/src/3rdparty/phonon/gstreamer/streamreader.h +++ b/src/3rdparty/phonon/gstreamer/streamreader.h @@ -23,6 +23,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. QT_BEGIN_NAMESPACE +#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM + namespace Phonon { class MediaSource; @@ -91,6 +93,8 @@ private: } } +#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM + QT_END_NAMESPACE #endif diff --git a/src/3rdparty/phonon/gstreamer/videowidget.cpp b/src/3rdparty/phonon/gstreamer/videowidget.cpp index efc750a16e..e1f0ec97f8 100644 --- a/src/3rdparty/phonon/gstreamer/videowidget.cpp +++ b/src/3rdparty/phonon/gstreamer/videowidget.cpp @@ -33,6 +33,7 @@ #include "widgetrenderer.h" #include "x11renderer.h" +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE namespace Phonon @@ -383,5 +384,6 @@ void VideoWidget::mediaNodeEvent(const MediaNodeEvent *event) } //namespace Phonon::Gstreamer QT_END_NAMESPACE +#endif //QT_NO_PHONON_VIDEO #include "moc_videowidget.cpp" diff --git a/src/3rdparty/phonon/gstreamer/videowidget.h b/src/3rdparty/phonon/gstreamer/videowidget.h index a0ebe5f820..dc0754d6ee 100644 --- a/src/3rdparty/phonon/gstreamer/videowidget.h +++ b/src/3rdparty/phonon/gstreamer/videowidget.h @@ -28,6 +28,7 @@ #include <gst/gst.h> +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE class QString; @@ -102,5 +103,5 @@ private: } //namespace Phonon::Gstreamer QT_END_NAMESPACE - +#endif //QT_NO_PHONON_VIDEO #endif // Phonon_GSTREAMER_VIDEOWIDGET_H diff --git a/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp b/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp index d7ee11bfcc..bf0d6467fc 100644 --- a/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp +++ b/src/3rdparty/phonon/gstreamer/volumefadereffect.cpp @@ -21,11 +21,11 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT namespace Phonon { namespace Gstreamer { - VolumeFaderEffect::VolumeFaderEffect(Backend *backend, QObject *parent) : Effect(backend, parent, AudioSource | AudioSink) , m_fadeCurve(Phonon::VolumeFaderEffect::Fade3Decibel) @@ -156,7 +156,7 @@ bool VolumeFaderEffect::event(QEvent *event) } }} //namespace Phonon::Gstreamer - +#endif //QT_NO_PHONON_VOLUMEFADEREFFECT QT_END_NAMESPACE #include "moc_volumefadereffect.cpp" diff --git a/src/3rdparty/phonon/gstreamer/volumefadereffect.h b/src/3rdparty/phonon/gstreamer/volumefadereffect.h index d74014cefb..748d2d6081 100644 --- a/src/3rdparty/phonon/gstreamer/volumefadereffect.h +++ b/src/3rdparty/phonon/gstreamer/volumefadereffect.h @@ -30,7 +30,7 @@ #include <gst/gst.h> QT_BEGIN_NAMESPACE - +#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT namespace Phonon { namespace Gstreamer @@ -64,7 +64,7 @@ namespace Gstreamer QTime m_fadeStartTime; }; }} //namespace Phonon::Gstreamer - +#endif //QT_NO_PHONON_VOLUMEFADEREFFECT QT_END_NAMESPACE #endif // Phonon_GSTREAMER_VOLUMEFADEREFFECT_H diff --git a/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp b/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp index d4a411ffc5..423af9db5c 100644 --- a/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp +++ b/src/3rdparty/phonon/gstreamer/widgetrenderer.cpp @@ -32,6 +32,7 @@ # define GL_TEXTURE2 0x84C2 #endif +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE static void frameRendered() @@ -148,3 +149,4 @@ bool WidgetRenderer::eventFilter(QEvent * event) } //namespace Phonon::Gstreamer QT_END_NAMESPACE +#endif //QT_NO_PHONON_VIDEO diff --git a/src/3rdparty/phonon/gstreamer/widgetrenderer.h b/src/3rdparty/phonon/gstreamer/widgetrenderer.h index ff64fa7d32..03ee9c065a 100644 --- a/src/3rdparty/phonon/gstreamer/widgetrenderer.h +++ b/src/3rdparty/phonon/gstreamer/widgetrenderer.h @@ -26,6 +26,7 @@ #include <QtOpenGL/QGLWidget> #endif +#ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE class QString; @@ -59,5 +60,5 @@ private: } //namespace Phonon::Gstreamer QT_END_NAMESPACE - +#endif //QT_NO_PHONON_VIDEO #endif // Phonon_GSTREAMER_WIDGETRENDERER_H diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index af2c31ec4f..f2efaa09f0 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -318,7 +318,8 @@ void MMF::AbstractMediaPlayer::doVolumeChanged() case PausedState: case PlayingState: case BufferingState: { - const int err = setDeviceVolume(m_volume * m_mmfMaxVolume); + const qreal volume = (m_volume * m_mmfMaxVolume) + 0.5; + const int err = setDeviceVolume(volume); if (KErrNone != err) { setError(NormalError); @@ -359,26 +360,27 @@ qint64 MMF::AbstractMediaPlayer::toMilliSeconds(const TTimeIntervalMicroSeconds return in.Int64() / 1000; } -void MMF::AbstractMediaPlayer::changeState(PrivateState newState) +//----------------------------------------------------------------------------- +// Slots +//----------------------------------------------------------------------------- + +void MMF::AbstractMediaPlayer::tick() { - TRACE_CONTEXT(AbstractPlayer::changeState, EAudioInternal); - TRACE_ENTRY("state %d newState %d", privateState(), newState); + // For the MWC compiler, we need to qualify the base class. + emit MMF::AbstractPlayer::tick(currentTime()); +} - // TODO: add some invariants to check that the transition is valid +void MMF::AbstractMediaPlayer::changeState(PrivateState newState) +{ + TRACE_CONTEXT(AbstractMediaPlayer::changeState, EAudioInternal); const Phonon::State oldPhononState = phononState(privateState()); const Phonon::State newPhononState = phononState(newState); - if (oldPhononState != newPhononState) { - TRACE("emit stateChanged(%d, %d)", newPhononState, oldPhononState); - emit stateChanged(newPhononState, oldPhononState); - } - setState(newState); + // TODO: add some invariants to check that the transition is valid + AbstractPlayer::changeState(newState); - if ( - LoadingState == oldPhononState - and StoppedState == newPhononState - ) { + if (LoadingState == oldPhononState && StoppedState == newPhononState) { // Ensure initial volume is set on MMF API before starting playback doVolumeChanged(); @@ -390,18 +392,28 @@ void MMF::AbstractMediaPlayer::changeState(PrivateState newState) play(); } } - - TRACE_EXIT_0(); } -//----------------------------------------------------------------------------- -// Slots -//----------------------------------------------------------------------------- - -void MMF::AbstractMediaPlayer::tick() +void MMF::AbstractMediaPlayer::updateMetaData() { - // For the MWC compiler, we need to qualify the base class. - emit MMF::AbstractPlayer::tick(currentTime()); + TRACE_CONTEXT(AbstractMediaPlayer::updateMetaData, EAudioInternal); + TRACE_ENTRY_0(); + + m_metaData.clear(); + + const int numberOfEntries = numberOfMetaDataEntries(); + for(int i=0; i<numberOfEntries; ++i) { + const QPair<QString, QString> entry = metaDataEntry(i); + + // Note that we capitalize the key, as required by the Ogg Vorbis + // metadata standard to which Phonon adheres: + // http://xiph.org/vorbis/doc/v-comment.html + m_metaData.insert(entry.first.toUpper(), entry.second); + } + + emit metaDataChanged(m_metaData); + + TRACE_EXIT_0(); } QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 698b899e96..cff7babf66 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -71,12 +71,12 @@ protected: virtual int setDeviceVolume(int mmfVolume) = 0; virtual int openFile(RFile& file) = 0; virtual void close() = 0; - - /** - * Changes state and emits stateChanged() - */ virtual void changeState(PrivateState newState); + void updateMetaData(); + virtual int numberOfMetaDataEntries() const = 0; + virtual QPair<QString, QString> metaDataEntry(int index) const = 0; + protected: bool tickTimerRunning() const; void startTickTimer(); @@ -109,6 +109,8 @@ private: MediaSource m_source; MediaSource m_nextSource; + QMultiMap<QString, QString> m_metaData; + }; } } diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp index e3c0ecb41e..de2722d2b1 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp @@ -118,12 +118,14 @@ void MMF::AbstractPlayer::videoOutputChanged() // Default behaviour is empty - overridden by VideoPlayer } -void MMF::AbstractPlayer::setError(Phonon::ErrorType error) +void MMF::AbstractPlayer::setError(Phonon::ErrorType error, + const QString &errorMessage) { TRACE_CONTEXT(AbstractPlayer::setError, EAudioInternal); TRACE_ENTRY("state %d error %d", m_state, error); m_error = error; + m_errorString = errorMessage; changeState(ErrorState); TRACE_EXIT_0(); @@ -138,9 +140,7 @@ Phonon::ErrorType MMF::AbstractPlayer::errorType() const QString MMF::AbstractPlayer::errorString() const { - // TODO: put in proper error strings - QString result; - return result; + return m_errorString; } Phonon::State MMF::AbstractPlayer::phononState() const @@ -173,5 +173,29 @@ void MMF::AbstractPlayer::setState(PrivateState newState) m_state = newState; } +void MMF::AbstractPlayer::changeState(PrivateState newState) +{ + TRACE_CONTEXT(AbstractPlayer::changeState, EAudioInternal); + TRACE_ENTRY("state %d newState %d", privateState(), newState); + + // TODO: add some invariants to check that the transition is valid + + const Phonon::State oldPhononState = phononState(privateState()); + + // We need to change the state before we emit stateChanged(), because + // some user code, for instance the mediaplayer, switch on MediaObject's + // state. + setState(newState); + + const Phonon::State newPhononState = phononState(newState); + + if (oldPhononState != newPhononState) { + TRACE("emit stateChanged(%d, %d)", newPhononState, oldPhononState); + emit stateChanged(newPhononState, oldPhononState); + } + + TRACE_EXIT_0(); +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index 08558cf2ef..66496cc02b 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -93,16 +93,18 @@ public: /** * Records error and changes state to ErrorState */ - void setError(Phonon::ErrorType error); + void setError(Phonon::ErrorType error, + const QString &errorMessage = QString()); Phonon::State state() const; + Q_SIGNALS: void totalTimeChanged(qint64 length); void finished(); void tick(qint64 time); void stateChanged(Phonon::State oldState, Phonon::State newState); - + void metaDataChanged(const QMultiMap<QString, QString>& metaData); protected: /** @@ -132,7 +134,10 @@ protected: PrivateState privateState() const; - virtual void changeState(PrivateState newState) = 0; + /** + * Changes state and emits stateChanged() + */ + virtual void changeState(PrivateState newState); /** * Modifies m_state directly. Typically you want to call changeState(), @@ -152,6 +157,7 @@ protected: private: PrivateState m_state; Phonon::ErrorType m_error; + QString m_errorString; qint32 m_tickInterval; qint32 m_transitionTime; qint32 m_prefinishMark; diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp new file mode 100644 index 0000000000..0447d57b45 --- /dev/null +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp @@ -0,0 +1,175 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +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 "ancestormovemonitor.h" +#include "utils.h" +#include "videooutput.h" + +#include <QCoreApplication> + +QT_BEGIN_NAMESPACE + +using namespace Phonon::MMF; + +/*! \class MMF::AncestorMoveMonitor + \internal + \brief Class which installs a global event filter, and listens for move + events which may affect the absolute position of widgets registered with + the monitor + See QTBUG-4956 +*/ + +//----------------------------------------------------------------------------- +// Constructor / destructor +//----------------------------------------------------------------------------- + +AncestorMoveMonitor::AncestorMoveMonitor(QObject *parent) + : QObject(parent) +{ + QCoreApplication::instance()->installEventFilter(this); +} + +AncestorMoveMonitor::~AncestorMoveMonitor() +{ + QCoreApplication::instance()->removeEventFilter(this); +} + + +//----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +void AncestorMoveMonitor::registerTarget(VideoOutput *target) +{ + TRACE_CONTEXT(AncestorMoveMonitor::registerTarget, EVideoInternal); + TRACE_ENTRY("target 0x%08x", target); + + // First un-register the target, in case this is being called as a result + // of re-parenting. This is not the most efficient way to update the + // target hash, but since this is not likely to be a frequent operation, + // simplicity is preferred over outright speed. In any case, re-parenting + // of the video widget leads to re-creation of native windows, which is + // likely to take far more processing than any implementation of this + // function. + unRegisterTarget(target); + + QWidget *ancestor = target->parentWidget(); + while(ancestor) { + const Hash::iterator it = m_hash.find(ancestor); + if(m_hash.end() == it) { + TargetList targetList; + targetList.append(target); + m_hash.insert(ancestor, targetList); + } else { + TargetList& targetList = it.value(); + Q_ASSERT(targetList.indexOf(target) == -1); + targetList.append(target); + } + ancestor = ancestor->parentWidget(); + } + + dump(); + + TRACE_EXIT_0(); +} + +void AncestorMoveMonitor::unRegisterTarget(VideoOutput *target) +{ + TRACE_CONTEXT(AncestorMoveMonitor::unRegisterTarget, EVideoInternal); + TRACE_ENTRY("target 0x%08x", target); + + Hash::iterator it = m_hash.begin(); + while(it != m_hash.end()) { + TargetList& targetList = it.value(); + const int index = targetList.indexOf(target); + if(index != -1) + targetList.removeAt(index); + if(targetList.count()) + ++it; + else + it = m_hash.erase(it); + } + + dump(); + + TRACE_EXIT_0(); +} + +bool AncestorMoveMonitor::eventFilter(QObject *watched, QEvent *event) +{ + TRACE_CONTEXT(AncestorMoveMonitor::eventFilter, EVideoInternal); + + if(event->type() == QEvent::Move || event->type() == QEvent::ParentChange) { + + //TRACE_ENTRY("watched 0x%08x event.type %d", watched, event->type()); + + const Hash::const_iterator it = m_hash.find(watched); + if(it != m_hash.end()) { + const TargetList& targetList = it.value(); + VideoOutput* target = 0; + foreach(target, targetList) { + switch (event->type()) { + + case QEvent::Move: + // Notify the target that its ancestor has moved + target->ancestorMoved(); + break; + + case QEvent::ParentChange: + // Update ancestor list for the target + registerTarget(target); + break; + + default: + Q_ASSERT(false); + } + } + } + + //TRACE_EXIT_0(); + } + + // The event is never consumed by this filter + return false; +} + +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +void AncestorMoveMonitor::dump() +{ +#ifndef QT_NO_DEBUG + TRACE_CONTEXT(AncestorMoveMonitor::dump, EVideoInternal); + for(Hash::const_iterator it = m_hash.begin(); + it != m_hash.end(); ++it) { + const QObject *ancestor = it.key(); + TRACE("ancestor 0x%08x", ancestor); + const TargetList& targetList = it.value(); + VideoOutput* target = 0; + foreach(target, targetList) { + TRACE(" target 0x%08x", target); + } + } +#endif +} + + + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.h b/src/3rdparty/phonon/mmf/ancestormovemonitor.h new file mode 100644 index 0000000000..0e681aa1e3 --- /dev/null +++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.h @@ -0,0 +1,95 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +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/>. + +*/ + +#ifndef PHONON_MMF_ANCESTORMOVEMONITOR_H +#define PHONON_MMF_ANCESTORMOVEMONITOR_H + +#include <QObject> +#include <QHash> +#include <QList> + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ +class VideoOutput; + +class AncestorMoveMonitor : public QObject +{ + Q_OBJECT + +public: + explicit AncestorMoveMonitor(QObject *parent); + ~AncestorMoveMonitor(); + + /** + * Register target widget for notification. + * + * The widget receives an ancestorMoveEvent callback when a move event + * is delivered to any of its ancestors: + * + * If the target is already registered, this function causes its + * ancestor list to be updated - therefore it should be called when + * the target receives a ParentChange event. + */ + void registerTarget(VideoOutput *target); + + /** + * Remove target from the monitor. + * + * The target will no longer receive notification when move events are + * delivered to its ancestors. + */ + void unRegisterTarget(VideoOutput *target); + +protected: + /** + * Function which receives events from the global event filter. + */ + bool eventFilter(QObject *watched, QEvent *event); + + void dump(); + +private: + /** + * List of registered target widgets which descend from a given + * ancestor. + * + * Note that the members of the list should be non-redundant; this + * invariant is checked in debug builds. Semantically, the value is + * therefore a set, however we use QList rather than QSet for + * efficiency of iteration. + */ + typedef QList<VideoOutput *> TargetList; + + /** + * Map from widget on which the move event occurs, to widgets which + * descend from it and therefore need to be notified. + */ + typedef QHash<QObject *, TargetList> Hash; + Hash m_hash; + +}; +} +} + +QT_END_NAMESPACE + +#endif diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index 1d259a80dc..8fccfe6edf 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -182,8 +182,8 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError, if (KErrNone == aError) { maxVolumeChanged(m_player->MaxVolume()); - emit totalTimeChanged(totalTime()); + updateMetaData(); changeState(StoppedState); } else { // TODO: set different error states according to value of aError? @@ -251,5 +251,24 @@ void MMF::AudioPlayer::MaloLoadingComplete() #endif // QT_PHONON_MMF_AUDIO_DRM +//----------------------------------------------------------------------------- +// Private functions +//----------------------------------------------------------------------------- + +int MMF::AudioPlayer::numberOfMetaDataEntries() const +{ + int numberOfEntries = 0; + m_player->GetNumberOfMetaDataEntries(numberOfEntries); // ignoring return code + return numberOfEntries; +} + +QPair<QString, QString> MMF::AudioPlayer::metaDataEntry(int index) const +{ + CMMFMetaDataEntry *entry = 0; + QT_TRAP_THROWING(entry = m_player->GetMetaDataEntryL(index)); + return QPair<QString, QString>(qt_TDesC2QString(entry->Name()), qt_TDesC2QString(entry->Value())); +} + + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index 60ef436038..bc600764a7 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -94,6 +94,10 @@ public: private: void construct(); + // AbstractMediaPlayer + virtual int numberOfMetaDataEntries() const; + virtual QPair<QString, QString> metaDataEntry(int index) const; + private: /** * Using CPlayerType typedef in order to be able to easily switch between diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index f542ec9c72..cac27e3ab2 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -24,6 +24,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <apmstd.h> // for TDataType #include "abstractaudioeffect.h" +#include "ancestormovemonitor.h" #include "audiooutput.h" #include "audioplayer.h" #include "backend.h" @@ -45,7 +46,9 @@ using namespace Phonon::MMF; \internal */ -Backend::Backend(QObject *parent) : QObject(parent) +Backend::Backend(QObject *parent) + : QObject(parent) + , m_ancestorMoveMonitor(new AncestorMoveMonitor(this)) { TRACE_CONTEXT(Backend::Backend, EBackend); TRACE_ENTRY_0(); @@ -87,7 +90,7 @@ QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const return EffectFactory::createAudioEffect(effect, parent); } case VideoWidgetClass: - result = new VideoWidget(qobject_cast<QWidget *>(parent)); + result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast<QWidget *>(parent)); break; default: diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h index 1886ae66e0..9e3d3b3aa8 100644 --- a/src/3rdparty/phonon/mmf/backend.h +++ b/src/3rdparty/phonon/mmf/backend.h @@ -19,8 +19,11 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #ifndef PHONON_MMF_BACKEND_H #define PHONON_MMF_BACKEND_H +#include "ancestormovemonitor.h" + #include <Phonon/MediaSource> #include <Phonon/BackendInterface> +#include <QScopedPointer> QT_BEGIN_NAMESPACE @@ -47,6 +50,10 @@ public: Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); + +private: + QScopedPointer<AncestorMoveMonitor> m_ancestorMoveMonitor; + }; } } diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp index bd21d20377..e6f38559a1 100644 --- a/src/3rdparty/phonon/mmf/dummyplayer.cpp +++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp @@ -87,11 +87,6 @@ qint64 MMF::DummyPlayer::currentTime() const return 0; } -QString MMF::DummyPlayer::errorString() const -{ - return QString(); -} - Phonon::ErrorType MMF::DummyPlayer::errorType() const { return Phonon::NoError; @@ -127,9 +122,5 @@ void MMF::DummyPlayer::doSetTickInterval(qint32) } -void MMF::DummyPlayer::changeState(PrivateState) -{ -} - QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h index 9ff9f78af7..c6270c9ce6 100644 --- a/src/3rdparty/phonon/mmf/dummyplayer.h +++ b/src/3rdparty/phonon/mmf/dummyplayer.h @@ -54,7 +54,6 @@ public: virtual bool isSeekable() const; virtual qint64 currentTime() const; virtual Phonon::State state() const; - virtual QString errorString() const; virtual Phonon::ErrorType errorType() const; virtual qint64 totalTime() const; virtual MediaSource source() const; @@ -64,9 +63,6 @@ public: // AbstractPlayer virtual void doSetTickInterval(qint32 interval); - -protected: - virtual void changeState(PrivateState newState); }; } } diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index 214baa0ae4..e9c5e27210 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -62,9 +62,9 @@ QHash<QByteArray, QVariant> EffectFactory::audioEffectDescriptions(AbstractAudio switch (type) { case AbstractAudioEffect::EffectAudioEqualizer: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "audio equalizer"), "Audio equalizer."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Audio Equalizer"), "Audio equalizer."); case AbstractAudioEffect::EffectBassBoost: - return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass boost"), "Bass boost."); + return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Bass Boost"), "Bass boost."); case AbstractAudioEffect::EffectDistanceAttenuation: return constructEffectDescription(QCoreApplication::translate("Phonon::MMF::EffectFactory", "Distance Attenuation"), "Distance Attenuation."); case AbstractAudioEffect::EffectEnvironmentalReverb: diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 29ac2df909..f004fd7189 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -239,6 +239,7 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) const bool oldPlayerSeekable = oldPlayer->isSeekable(); Phonon::ErrorType error = NoError; + QString errorMessage; // Determine media type switch (source.type()) { @@ -253,7 +254,7 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) mediaType = fileMediaType(url.toLocalFile()); } else { - TRACE_0("Network streaming not supported yet"); + errorMessage = QLatin1String("Network streaming not supported yet"); error = NormalError; } } @@ -286,7 +287,8 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) newPlayer = new DummyPlayer(); } - newPlayer->setError(NormalError); + error = NormalError; + errorMessage = tr("Media type could not be determined"); break; case MediaTypeAudio: @@ -320,10 +322,13 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) connect(m_player.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), SIGNAL(stateChanged(Phonon::State, Phonon::State))); connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished())); connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); + connect(m_player.data(), SIGNAL(metaDataChanged(const QMultiMap<QString, QString>&)), SIGNAL(metaDataChanged(const QMultiMap<QString, QString>&))); - if (error != NoError ) { - newPlayer = new DummyPlayer(); - newPlayer->setError(error); + // We need to call setError() after doing the connects, otherwise the + // error won't be received. + if (error != NoError) { + Q_ASSERT(m_player); + m_player->setError(error, errorMessage); } TRACE_EXIT_0(); diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index d1d2337724..ba7d005c68 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -110,6 +110,9 @@ MMF::VideoPlayer::~VideoPlayer() TRACE_CONTEXT(VideoPlayer::~VideoPlayer, EVideoApi); TRACE_ENTRY_0(); + if (m_videoOutput) + m_videoOutput->setObserver(0); + TRACE_EXIT_0(); } @@ -487,6 +490,19 @@ bool MMF::VideoPlayer::getNativeWindowSystemHandles() TRACE_RETURN("changed %d", changed); } +int MMF::VideoPlayer::numberOfMetaDataEntries() const +{ + int numberOfEntries = 0; + TRAP_IGNORE(numberOfEntries = m_player->NumberOfMetaDataEntriesL()); + return numberOfEntries; +} + +QPair<QString, QString> MMF::VideoPlayer::metaDataEntry(int index) const +{ + CMMFMetaDataEntry *entry = 0; + QT_TRAP_THROWING(entry = m_player->MetaDataEntryL(index)); + return QPair<QString, QString>(qt_TDesC2QString(entry->Name()), qt_TDesC2QString(entry->Value())); +} QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index 8072404372..fa4e59b65a 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -86,6 +86,10 @@ private: void updateMmfOutput(); + // AbstractMediaPlayer + virtual int numberOfMetaDataEntries() const; + virtual QPair<QString, QString> metaDataEntry(int index) const; + private: QScopedPointer<CVideoPlayerUtility> m_player; diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index f0393a7bbf..5288b4d5ba 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -16,6 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ +#include "ancestormovemonitor.h" #include "utils.h" #include "videooutput.h" #include "videooutputobserver.h" @@ -44,8 +45,10 @@ using namespace Phonon::MMF; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::VideoOutput::VideoOutput(QWidget* parent) +MMF::VideoOutput::VideoOutput + (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : QWidget(parent) + , m_ancestorMoveMonitor(ancestorMoveMonitor) , m_observer(0) { TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal); @@ -63,6 +66,8 @@ MMF::VideoOutput::VideoOutput(QWidget* parent) // to be invisible when running on the target device. qt_widget_private(this)->extraData()->disableBlit = true; + registerForAncestorMoved(); + dump(); TRACE_EXIT_0(); @@ -73,6 +78,8 @@ MMF::VideoOutput::~VideoOutput() TRACE_CONTEXT(VideoOutput::~VideoOutput, EVideoInternal); TRACE_ENTRY_0(); + m_ancestorMoveMonitor->unRegisterTarget(this); + TRACE_EXIT_0(); } @@ -97,6 +104,15 @@ void MMF::VideoOutput::setObserver(VideoOutputObserver* observer) m_observer = observer; } +void MMF::VideoOutput::ancestorMoved() +{ + TRACE_CONTEXT(VideoOutput::ancestorMoved, EVideoInternal); + TRACE_ENTRY_0(); + + videoOutputRegionChanged(); + + TRACE_EXIT_0(); +} //----------------------------------------------------------------------------- // QWidget @@ -154,8 +170,11 @@ bool MMF::VideoOutput::event(QEvent* event) TRACE_0("WinIdChange"); videoOutputRegionChanged(); return true; - } - else + } else if (event->type() == QEvent::ParentChange) { + // Tell ancestor move monitor to update ancestor list for this widget + registerForAncestorMoved(); + return true; + } else return QWidget::event(event); } @@ -171,6 +190,11 @@ void MMF::VideoOutput::videoOutputRegionChanged() m_observer->videoOutputRegionChanged(); } +void MMF::VideoOutput::registerForAncestorMoved() +{ + m_ancestorMoveMonitor->registerTarget(this); +} + void MMF::VideoOutput::dump() const { #ifndef QT_NO_DEBUG diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index 7bc0b52b43..db4d127a11 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -30,6 +30,7 @@ namespace Phonon { namespace MMF { +class AncestorMoveMonitor; class VideoOutputObserver; class VideoOutput : public QWidget @@ -37,12 +38,14 @@ class VideoOutput : public QWidget Q_OBJECT public: - explicit VideoOutput(QWidget* parent); + VideoOutput(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); ~VideoOutput(); void setFrameSize(const QSize& size); void setObserver(VideoOutputObserver* observer); + void ancestorMoved(); + protected: // Override QWidget functions QSize sizeHint() const; @@ -55,11 +58,17 @@ private: void dump() const; void videoOutputRegionChanged(); + void registerForAncestorMoved(); + private: - QSize m_frameSize; + // Not owned + AncestorMoveMonitor* m_ancestorMoveMonitor; // Not owned - VideoOutputObserver* m_observer; + VideoOutputObserver* m_observer; + + QSize m_frameSize; + }; } } diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 8a5c9ff924..7d7abf1ef2 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -49,9 +49,10 @@ static const qreal DefaultSaturation = 1.0; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::VideoWidget::VideoWidget(QWidget* parent) +MMF::VideoWidget::VideoWidget + (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : MediaNode(parent) - , m_widget(new VideoOutput(parent)) + , m_widget(new VideoOutput(ancestorMoveMonitor, parent)) , m_aspectRatio(DefaultAspectRatio) , m_brightness(DefaultBrightness) , m_scaleMode(DefaultScaleMode) diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h index 970f749623..318dfae7cd 100644 --- a/src/3rdparty/phonon/mmf/videowidget.h +++ b/src/3rdparty/phonon/mmf/videowidget.h @@ -31,6 +31,7 @@ namespace Phonon { namespace MMF { +class AncestorMoveMonitor; class VideoOutput; class VideoWidget : public MediaNode @@ -40,7 +41,7 @@ class VideoWidget : public MediaNode Q_INTERFACES(Phonon::VideoWidgetInterface) public: - VideoWidget(QWidget* parent); + VideoWidget(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); ~VideoWidget(); // VideoWidgetInterface diff --git a/src/3rdparty/phonon/phonon/factory.cpp b/src/3rdparty/phonon/phonon/factory.cpp index 5c3752aad3..d5010e7489 100644 --- a/src/3rdparty/phonon/phonon/factory.cpp +++ b/src/3rdparty/phonon/phonon/factory.cpp @@ -111,6 +111,7 @@ void Factory::setBackend(QObject *b) bool FactoryPrivate::createBackend() { +#ifndef QT_NO_LIBRARY Q_ASSERT(m_backendObject == 0); #ifndef QT_NO_PHONON_PLATFORMPLUGIN PlatformPlugin *f = globalFactory->platformPlugin(); @@ -186,14 +187,20 @@ bool FactoryPrivate::createBackend() SLOT(objectDescriptionChanged(ObjectDescriptionType))); return true; +#else //QT_NO_LIBRARY + pWarning() << Q_FUNC_INFO << "Trying to use Phonon with QT_NO_LIBRARY defined. " + "That is currently not supported"; + return false; +#endif } FactoryPrivate::FactoryPrivate() + : #ifndef QT_NO_PHONON_PLATFORMPLUGIN - : m_platformPlugin(0), - m_noPlatformPlugin(false) + m_platformPlugin(0), + m_noPlatformPlugin(false), #endif //QT_NO_PHONON_PLATFORMPLUGIN - , m_backendObject(0) + m_backendObject(0) { // Add the post routine to make sure that all other global statics (especially the ones from Qt) // are still available. If the FactoryPrivate dtor is called too late many bad things can happen @@ -442,6 +449,7 @@ QObject *Factory::backend(bool createWhenNull) return globalFactory->m_backendObject; } +#ifndef QT_NO_PROPERTIES #define GET_STRING_PROPERTY(name) \ QString Factory::name() \ { \ @@ -457,7 +465,7 @@ GET_STRING_PROPERTY(backendComment) GET_STRING_PROPERTY(backendVersion) GET_STRING_PROPERTY(backendIcon) GET_STRING_PROPERTY(backendWebsite) - +#endif //QT_NO_PROPERTIES QObject *Factory::registerQObject(QObject *o) { if (o) { diff --git a/src/3rdparty/phonon/phonon/globalconfig.cpp b/src/3rdparty/phonon/phonon/globalconfig.cpp index d13e491de4..3718c6ae97 100644 --- a/src/3rdparty/phonon/phonon/globalconfig.cpp +++ b/src/3rdparty/phonon/phonon/globalconfig.cpp @@ -38,7 +38,10 @@ QT_BEGIN_NAMESPACE namespace Phonon { -GlobalConfig::GlobalConfig() : m_config(QLatin1String("kde.org"), QLatin1String("libphonon")) +GlobalConfig::GlobalConfig() +#ifndef QT_NO_SETTINGS + : m_config(QLatin1String("kde.org"), QLatin1String("libphonon")) +#endif //QT_NO_SETTINGS { } @@ -82,6 +85,7 @@ static void filter(ObjectDescriptionType type, BackendInterface *backendIface, Q } } +#ifndef QT_NO_PHONON_SETTINGSGROUP static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon::Category category, QList<int> &defaultList) { if (defaultList.size() <= 1) { @@ -126,7 +130,9 @@ static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon return deviceList; } +#endif //QT_NO_PHONON_SETTINGSGROUP +#ifndef QT_NO_PHONON_SETTINGSGROUP QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int override) const { //The devices need to be stored independently for every backend @@ -172,7 +178,7 @@ QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int return listSortedByConfig(backendConfig, category, defaultList); } - +#endif //QT_NO_SETTINGSGROUPS int GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override) const { QList<int> ret = audioOutputDeviceListFor(category, override); @@ -184,6 +190,7 @@ int GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override) #ifndef QT_NO_PHONON_AUDIOCAPTURE QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, int override) const { +#ifndef QT_NO_PHONON_SETTINGSGROUP //The devices need to be stored independently for every backend const QSettingsGroup backendConfig(&m_config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier()); const QSettingsGroup generalGroup(&m_config, QLatin1String("General")); @@ -226,6 +233,9 @@ QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, in } return listSortedByConfig(backendConfig, category, defaultList); +#else //QT_NO_SETTINGSGROUP + return QList<int>(); +#endif //QT_NO_SETTINGSGROUP } int GlobalConfig::audioCaptureDeviceFor(Phonon::Category category, int override) const diff --git a/src/3rdparty/phonon/phonon/globalconfig_p.h b/src/3rdparty/phonon/phonon/globalconfig_p.h index 023858f87a..034bce3051 100644 --- a/src/3rdparty/phonon/phonon/globalconfig_p.h +++ b/src/3rdparty/phonon/phonon/globalconfig_p.h @@ -46,7 +46,9 @@ namespace Phonon AdvancedDevicesFromSettings = 2, HideUnavailableDevices = 4 }; +#ifndef QT_NO_PHONON_SETTINGSGROUP QList<int> audioOutputDeviceListFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; +#endif //QT_NO_PHONON_SETTINGSGROUP int audioOutputDeviceFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const; #ifndef QT_NO_PHONON_AUDIOCAPTURE @@ -55,7 +57,9 @@ namespace Phonon #endif //QT_NO_PHONON_AUDIOCAPTURE protected: +#ifndef QT_NO_SETTINGS QSettings m_config; +#endif //QT_NO_SETTINGS }; } // namespace Phonon diff --git a/src/3rdparty/phonon/phonon/qsettingsgroup_p.h b/src/3rdparty/phonon/phonon/qsettingsgroup_p.h index 95f6c9bafa..501fe37615 100644 --- a/src/3rdparty/phonon/phonon/qsettingsgroup_p.h +++ b/src/3rdparty/phonon/phonon/qsettingsgroup_p.h @@ -27,6 +27,8 @@ #include <QtCore/QString> #include <QtCore/QVariant> +#ifndef QT_NO_PHONON_SETTINGSGROUP + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -87,5 +89,6 @@ class QSettingsGroup QT_END_NAMESPACE QT_END_HEADER +#endif //QT_NO_PHONON_SETTINGSGROUP #endif // PHONON_QSETTINGSGROUP_P_H |