From 149e986ce129ccc656942d79fb1c9687dbe7958c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 5 Nov 2009 16:12:31 +0000 Subject: Removed logging from Phonon MMF backend This statement calls a function (RWindowBase::ClientHandle) which was introduced in S60 3.2. Although there is a runtime check, a build made against 3.2 or above will fail on a 3.1 device. This manifests itself by the plugin failing to load. The log statement is not really necessary anyway, because, for window-owning controls, the window handle is the same value as the CCoeControl* pointer. This means that logging RWindowBase::ClientHandle is redundant information. Task-number: QTBUG-5406 Reviewed-by: trustme --- src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp index 03220a7..f836109 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp @@ -108,14 +108,6 @@ QList QAnnotatorWindow::annotation(const QObject& object) stream << "window: "; - // ClientHandle() is available first in 5.0. -#if !defined(__SERIES60_31__) && !defined(__S60_32__) - if (QSysInfo::s60Version() > QSysInfo::SV_S60_3_2) - // Client-side window handle - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "cli " << reinterpret_cast(window->ClientHandle()) << ' '; -#endif - // Server-side address of CWsWindow object // This is useful for correlation with the window tree dumped by the window // server (see RWsSession::LogCommand). -- cgit v0.12 From 2494d3042eceed5a654e5330ed17baba0029ee89 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 9 Nov 2009 08:40:21 +0000 Subject: Fixed compiler warning for RVCT 2.2 Reviewed-by: trustme --- .../mmf/mmfphonondebug/objectdump_symbian.cpp | 47 +++++++++++----------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp index f836109..d0818eb 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp @@ -99,38 +99,39 @@ QList QAnnotatorWindow::annotation(const QObject& object) if (widget) { const CCoeControl* control = widget->effectiveWinId(); - RDrawableWindow *window = 0; - if (control && (window = control->DrawableWindow())) { - - QByteArray array; - QTextStream stream(&array); + if (control) { + RDrawableWindow *const window = control->DrawableWindow(); + if(window) { + QByteArray array; + QTextStream stream(&array); - stream << "window: "; + stream << "window: "; - // Server-side address of CWsWindow object - // This is useful for correlation with the window tree dumped by the window - // server (see RWsSession::LogCommand). - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "srv " << reinterpret_cast(window->WsHandle()) << ' '; + // Server-side address of CWsWindow object + // This is useful for correlation with the window tree dumped by the window + // server (see RWsSession::LogCommand). + // Cast to a void pointer so that log output is in hexadecimal format. + stream << "srv " << reinterpret_cast(window->WsHandle()) << ' '; - stream << "group " << window->WindowGroupId() << ' '; + stream << "group " << window->WindowGroupId() << ' '; - // Client-side handle to the parent window. - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "parent " << reinterpret_cast(window->Parent()) << ' '; + // Client-side handle to the parent window. + // Cast to a void pointer so that log output is in hexadecimal format. + stream << "parent " << reinterpret_cast(window->Parent()) << ' '; - stream << window->Position().iX << ',' << window->Position().iY << ' '; - stream << '(' << window->AbsPosition().iX << ',' << window->AbsPosition().iY << ") "; - stream << window->Size().iWidth << 'x' << window->Size().iHeight << ' '; + stream << window->Position().iX << ',' << window->Position().iY << ' '; + stream << '(' << window->AbsPosition().iX << ',' << window->AbsPosition().iY << ") "; + stream << window->Size().iWidth << 'x' << window->Size().iHeight << ' '; - const TDisplayMode displayMode = window->DisplayMode(); - stream << "mode " << displayMode << ' '; + const TDisplayMode displayMode = window->DisplayMode(); + stream << "mode " << displayMode << ' '; - stream << "ord " << window->OrdinalPosition(); + stream << "ord " << window->OrdinalPosition(); - stream.flush(); - result.append(array); + stream.flush(); + result.append(array); + } } } -- cgit v0.12 From cc2d8068fea504483b2602128e2169b482feb308 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Mon, 9 Nov 2009 12:10:24 +0100 Subject: Replace mmfphonondebug.lib with #ifndef QT_NO_DEBUG. The debug{} directive in src/plugins/phonon/mmf/plugin/plugin.pro does not have any effect - this can be seen by looking at the generated MMP file, which has a STATICLIBRARY directive which is applied in both UDEB and UREL builds. This is the general problem that .pro files cannot tell distinction between the different targets that one makespec covers. Also remove objectdumpstub; objectdump was originally prepared for QtGui inclusion, but since that never happened, no other platforms than Symbian needs to be covered. Task-number: QTBUG-5466 Reviewed-by: Gareth Stockwell --- .../phonon/mmf/mmfphonondebug/objectdump.cpp | 527 -------------------- .../phonon/mmf/mmfphonondebug/objectdump.h | 166 ------- .../phonon/mmf/mmfphonondebug/objectdump_global.h | 30 -- .../phonon/mmf/mmfphonondebug/objectdump_stub.cpp | 40 -- .../mmf/mmfphonondebug/objectdump_symbian.cpp | 160 ------- .../phonon/mmf/mmfphonondebug/objectdump_symbian.h | 66 --- .../phonon/mmf/mmfphonondebug/objecttree.cpp | 102 ---- .../phonon/mmf/mmfphonondebug/objecttree.h | 117 ----- src/3rdparty/phonon/mmf/objectdump.cpp | 529 +++++++++++++++++++++ src/3rdparty/phonon/mmf/objectdump.h | 166 +++++++ src/3rdparty/phonon/mmf/objectdump_global.h | 30 ++ src/3rdparty/phonon/mmf/objectdump_symbian.cpp | 163 +++++++ src/3rdparty/phonon/mmf/objectdump_symbian.h | 66 +++ src/3rdparty/phonon/mmf/objecttree.cpp | 104 ++++ src/3rdparty/phonon/mmf/objecttree.h | 117 +++++ src/plugins/phonon/mmf/mmf.pro | 103 +++- .../phonon/mmf/mmfphonondebug/mmfphonondebug.pro | 31 -- src/plugins/phonon/mmf/plugin/plugin.pro | 91 ---- 18 files changed, 1275 insertions(+), 1333 deletions(-) delete mode 100644 src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp delete mode 100644 src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h delete mode 100644 src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h delete mode 100644 src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp delete mode 100644 src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp delete mode 100644 src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h delete mode 100644 src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp delete mode 100644 src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h create mode 100644 src/3rdparty/phonon/mmf/objectdump.cpp create mode 100644 src/3rdparty/phonon/mmf/objectdump.h create mode 100644 src/3rdparty/phonon/mmf/objectdump_global.h create mode 100644 src/3rdparty/phonon/mmf/objectdump_symbian.cpp create mode 100644 src/3rdparty/phonon/mmf/objectdump_symbian.h create mode 100644 src/3rdparty/phonon/mmf/objecttree.cpp create mode 100644 src/3rdparty/phonon/mmf/objecttree.h delete mode 100644 src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro delete mode 100644 src/plugins/phonon/mmf/plugin/plugin.pro diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp deleted file mode 100644 index 9add439..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/* 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 . - -*/ - -#include -#include -#include -#include -#include - -#include "objectdump.h" -#include "objecttree.h" - -QT_BEGIN_NAMESPACE - -namespace ObjectDump -{ - -//----------------------------------------------------------------------------- -// QObjectAnnotator -//----------------------------------------------------------------------------- - -QAnnotator::~QAnnotator() -{ - -} - - -//----------------------------------------------------------------------------- -// Annotators -//----------------------------------------------------------------------------- - -QList QAnnotatorBasic::annotation(const QObject& object) -{ - QList result; - - QByteArray array; - QTextStream stream(&array); - - stream << '[' << &object << ']'; - stream << ' '; - stream << object.metaObject()->className(); - - if (object.objectName() != "") - stream << " \"" << object.objectName() << '"'; - - if (object.isWidgetType()) - stream << " isWidget"; - - stream.flush(); - result.append(array); - return result; -} - -QList QAnnotatorWidget::annotation(const QObject& object) -{ - QList result; - - const QWidget* widget = qobject_cast(&object); - if (widget) { - - QByteArray array; - QTextStream stream(&array); - - stream << "widget: "; - - if (widget->isVisible()) - stream << "visible "; - else - stream << "invisible "; - - stream << widget->x() << ',' << widget->y() << ' '; - stream << widget->size().width() << 'x'<< widget->size().height() << ' '; - - stream << "hint " << widget->sizeHint().width() << 'x' << widget->sizeHint().height(); - - stream.flush(); - result.append(array); - } - - return result; -} - - -//----------------------------------------------------------------------------- -// Base class for QDumperPrivate, QVisitorPrivate -//----------------------------------------------------------------------------- - -class QDumperBase -{ -public: - QDumperBase(); - ~QDumperBase(); - - void setPrefix(const QString& prefix); - void addAnnotator(QAnnotator* annotator); - -protected: - QByteArray m_prefix; - QList m_annotators; - -}; - -QDumperBase::QDumperBase() -{ - -} - -QDumperBase::~QDumperBase() -{ - QAnnotator* annotator; - foreach(annotator, m_annotators) - delete annotator; -} - -void QDumperBase::setPrefix(const QString& prefix) -{ - m_prefix = prefix.count() - ? (prefix + " ").toAscii() - : prefix.toAscii(); -} - -void QDumperBase::addAnnotator(QAnnotator* annotator) -{ - // Protect against an exception occurring during QList::append - QScopedPointer holder(annotator); - m_annotators.append(annotator); - holder.take(); -} - - -//----------------------------------------------------------------------------- -// QDumper -//----------------------------------------------------------------------------- - -class QDumperPrivate : public QDumperBase -{ -public: - QDumperPrivate(); - ~QDumperPrivate(); - - void dumpObject(const QObject& object); - -}; - - -QDumperPrivate::QDumperPrivate() -{ - -} - -QDumperPrivate::~QDumperPrivate() -{ - -} - -void QDumperPrivate::dumpObject(const QObject& object) -{ - QAnnotator* annotator; - foreach(annotator, m_annotators) { - - const QList annotations = annotator->annotation(object); - QByteArray annotation; - foreach(annotation, annotations) { - QByteArray buffer(m_prefix); - buffer.append(annotation); - qDebug() << buffer.constData(); - } - } -} - - -QDumper::QDumper() - : d_ptr(new QDumperPrivate) -{ - -} - -QDumper::~QDumper() -{ - -} - -void QDumper::setPrefix(const QString& prefix) -{ - d_func()->setPrefix(prefix); -} - -void QDumper::addAnnotator(QAnnotator* annotator) -{ - d_func()->addAnnotator(annotator); -} - -void QDumper::dumpObject(const QObject& object) -{ - d_func()->dumpObject(object); -} - - -//----------------------------------------------------------------------------- -// QVisitor -//----------------------------------------------------------------------------- - -class QVisitorPrivate : public QDumperBase -{ -public: - QVisitorPrivate(); - ~QVisitorPrivate(); - - void setIndent(unsigned indent); - - void visitNode(const QObject& object); - void visitComplete(); - -private: - class Node - { - public: - Node(); - ~Node(); - - QList m_annotation; - QList m_children; - - typedef QList::const_iterator child_iterator; - }; - -private: - Node* findNode(const QObject* object) const; - QByteArray branchBuffer(const QList& branches, bool isNodeLine, bool isLastChild) const; - void dumpRecursive(const Node& node, QList branches, bool isLastChild); - void dumpNode(const Node& node, const QList& branches, bool isLastChild); - -private: - unsigned m_indent; - - QScopedPointer m_root; - - // Hash table used to associate internal nodes with QObjects - typedef QHash Hash; - Hash m_hash; -}; - -static const unsigned DefaultIndent = 2; - -QVisitorPrivate::QVisitorPrivate() - : m_indent(DefaultIndent) -{ - -} - -QVisitorPrivate::~QVisitorPrivate() -{ - -} - -void QVisitorPrivate::setIndent(unsigned indent) -{ - m_indent = indent; -} - -// Builds up a mirror of the object tree, rooted in m_root, with each node -// storing annotations generated by -void QVisitorPrivate::visitNode(const QObject& object) -{ - QObject* const objectParent = object.parent(); - Node* const nodeParent = objectParent ? findNode(objectParent) : 0; - - // Create a new node and store in scoped pointer for exception safety - Node* node = new Node; - QScopedPointer nodePtr(node); - - // Associate node with QObject - m_hash.insert(&object, node); - - // Insert node into internal tree - if (nodeParent) - { - nodeParent->m_children.append(nodePtr.take()); - } - else - { - Q_ASSERT(m_root.isNull()); - m_root.reset(nodePtr.take()); - } - - // Generate and store annotations - QAnnotator* annotator; - foreach(annotator, m_annotators) - node->m_annotation.append( annotator->annotation(object) ); -} - -void QVisitorPrivate::visitComplete() -{ - QList branches; - static const bool isLastChild = true; - dumpRecursive(*m_root, branches, isLastChild); - m_root.reset(0); -} - -QVisitorPrivate::Node* QVisitorPrivate::findNode(const QObject* object) const -{ - Hash::const_iterator i = m_hash.find(object); - return (m_hash.end() == i) ? 0 : *i; -} - -QByteArray QVisitorPrivate::branchBuffer - (const QList& branches, bool isNodeLine, bool isLastChild) const -{ - const int depth = branches.count(); - - const QByteArray indent(m_indent, ' '); - const QByteArray horiz(m_indent, '-'); - - QByteArray buffer; - QTextStream stream(&buffer); - - for (int i=0; i branches, bool isLastChild) -{ - dumpNode(node, branches, isLastChild); - - // Recurse down tree - const Node::child_iterator begin = node.m_children.begin(); - const Node::child_iterator end = node.m_children.end(); - for (Node::child_iterator i = begin; end != i; ++i) { - - isLastChild = (end == i + 1); - - if (begin == i) - branches.push_back(!isLastChild); - else - branches.back() = !isLastChild; - - static const bool isNodeLine = false; - const QByteArray buffer = branchBuffer(branches, isNodeLine, false); - qDebug() << buffer.constData(); - - dumpRecursive(**i, branches, isLastChild); - } -} - -void QVisitorPrivate::dumpNode - (const Node& node, const QList& branches, bool isLastChild) -{ - const QList::const_iterator - begin = node.m_annotation.begin(), end = node.m_annotation.end(); - - if (begin == end) { - // No annotations - just dump the object pointer - const bool isNodeLine = true; - QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild); - qDebug() << 0; // TODO - } - else { - // Dump annotations - for (QList::const_iterator i = begin; end != i; ++i) { - const bool isNodeLine = (begin == i); - QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild); - buffer.append(*i); - qDebug() << buffer.constData(); - } - } -} - - -// QVisitorPrivate::Node - -QVisitorPrivate::Node::Node() -{ - -} - -QVisitorPrivate::Node::~Node() -{ - Node* child; - foreach(child, m_children) - delete child; -} - - -// QVisitor - -QVisitor::QVisitor() - : d_ptr(new QVisitorPrivate) -{ - -} - -QVisitor::~QVisitor() -{ - -} - -void QVisitor::setPrefix(const QString& prefix) -{ - d_func()->setPrefix(prefix); -} - -void QVisitor::setIndent(unsigned indent) -{ - d_func()->setIndent(indent); -} - -void QVisitor::addAnnotator(QAnnotator* annotator) -{ - d_func()->addAnnotator(annotator); -} - -void QVisitor::visitPrepare() -{ - // Do nothing -} - -void QVisitor::visitNode(const QObject& object) -{ - d_func()->visitNode(object); -} - -void QVisitor::visitComplete() -{ - d_func()->visitComplete(); -} - - -//----------------------------------------------------------------------------- -// Utility functions -//----------------------------------------------------------------------------- - -void addDefaultAnnotators_sys(QDumper& visitor); -void addDefaultAnnotators_sys(QVisitor& visitor); - -void addDefaultAnnotators(QDumper& dumper) -{ - dumper.addAnnotator(new QAnnotatorBasic); - dumper.addAnnotator(new QAnnotatorWidget); - - // Add platform-specific annotators - addDefaultAnnotators_sys(dumper); -} - -void addDefaultAnnotators(QVisitor& visitor) -{ - visitor.addAnnotator(new QAnnotatorBasic); - visitor.addAnnotator(new QAnnotatorWidget); - - // Add platform-specific annotators - addDefaultAnnotators_sys(visitor); -} - -void dumpTreeFromRoot(const QObject& root, QVisitor& visitor) -{ - // Set up iteration range - ObjectTree::DepthFirstConstIterator begin(root), end; - - // Invoke generic visitor algorithm - ObjectTree::visit(begin, end, visitor); -} - -void dumpTreeFromLeaf(const QObject& leaf, QVisitor& visitor) -{ - // Walk up to root - const QObject* root = &leaf; - while(root->parent()) - { - root = root->parent(); - } - - dumpTreeFromRoot(*root, visitor); -} - -void dumpAncestors(const QObject& leaf, QVisitor& visitor) -{ - // Set up iteration range - ObjectTree::AncestorConstIterator begin(leaf), end; - - // Invoke generic visitor algorithm - ObjectTree::visit(begin, end, visitor); -} - - -} // namespace ObjectDump - -QT_END_NAMESPACE - - - diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h deleted file mode 100644 index e94b3ac..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h +++ /dev/null @@ -1,166 +0,0 @@ -/* 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 . - -*/ - -#ifndef OBJECTDUMP_H -#define OBJECTDUMP_H - -#include "objectdump_global.h" - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace ObjectDump -{ - -/** - * Abstract base for annotator classes invoked by QVisitor. - */ -class OBJECTDUMP_EXPORT QAnnotator : public QObject -{ - Q_OBJECT -public: - virtual ~QAnnotator(); - virtual QList annotation(const QObject& object) = 0; -}; - -/** - * Annotator which replicates QObject::dumpObjectTree functionality. - */ -class OBJECTDUMP_EXPORT QAnnotatorBasic : public QAnnotator -{ - Q_OBJECT -public: - QList annotation(const QObject& object); -}; - -/** - * Annotator which returns widget information. - */ -class OBJECTDUMP_EXPORT QAnnotatorWidget : public QAnnotator -{ - Q_OBJECT -public: - QList annotation(const QObject& object); -}; - - -class QDumperPrivate; - -/** - * Class used to dump information about individual QObjects. - */ -class OBJECTDUMP_EXPORT QDumper : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDumper) - -public: - QDumper(); - ~QDumper(); - - /** - * Specify a prefix, to be printed on each line of output. - */ - void setPrefix(const QString& prefix); - - /** - * Takes ownership of annotator. - */ - void addAnnotator(QAnnotator* annotator); - - /** - * Invoke each annotator on the object and write to debug output. - */ - void dumpObject(const QObject& object); - -private: - QScopedPointer d_ptr; - -}; - - -class QVisitorPrivate; - -/** - * Visitor class which dumps information about nodes in the object tree. - */ -class OBJECTDUMP_EXPORT QVisitor : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QVisitor) - -public: - QVisitor(); - ~QVisitor(); - - /** - * Specify a prefix, to be printed on each line of output. - */ - void setPrefix(const QString& prefix); - - /** - * Set number of spaces by which each level of the tree is indented. - */ - void setIndent(unsigned indent); - - /** - * Called by the visitor algorithm before starting the visit. - */ - void visitPrepare(); - - /** - * Called by the visitor algorithm as each node is visited. - */ - void visitNode(const QObject& object); - - /** - * Called by the visitor algorithm when the visit is complete. - */ - void visitComplete(); - - /** - * Takes ownership of annotator. - */ - void addAnnotator(QAnnotator* annotator); - -private: - QScopedPointer d_ptr; - -}; - - -//----------------------------------------------------------------------------- -// Utility functions -//----------------------------------------------------------------------------- - -void OBJECTDUMP_EXPORT addDefaultAnnotators(QDumper& dumper); -void OBJECTDUMP_EXPORT addDefaultAnnotators(QVisitor& visitor); - -void OBJECTDUMP_EXPORT dumpTreeFromRoot(const QObject& root, QVisitor& visitor); -void OBJECTDUMP_EXPORT dumpTreeFromLeaf(const QObject& leaf, QVisitor& visitor); -void OBJECTDUMP_EXPORT dumpAncestors(const QObject& leaf, QVisitor& visitor); - -} // namespace ObjectDump - -QT_END_NAMESPACE - -#endif diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h deleted file mode 100644 index b8987e0..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 . - -*/ - -#ifndef OBJECTDUMP_GLOBAL_H -#define OBJECTDUMP_GLOBAL_H - -#include - -#if defined(OBJECTDUMP_LIBRARY) -# define OBJECTDUMP_EXPORT -#else -# define OBJECTDUMP_EXPORT -#endif - -#endif diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp deleted file mode 100644 index 6207dac..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 . - -*/ - -#include "objectdump.h" - -QT_BEGIN_NAMESPACE - -namespace ObjectDump -{ - -void addDefaultAnnotators_sys(QDumper& /*dumper*/) -{ - -} - -void addDefaultAnnotators_sys(QVisitor& /*visitor*/) -{ - -} - -} // namespace ObjectDump - -QT_END_NAMESPACE - - diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp deleted file mode 100644 index f836109..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* 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 . - -*/ - -#include -#include -#include -#include "objectdump_symbian.h" - -#include // to access QWExtra - -QT_BEGIN_NAMESPACE - -namespace ObjectDump -{ -namespace Symbian -{ - -QList QAnnotatorWidget::annotation(const QObject& object) -{ - QList result; - - const QWidget* widget = qobject_cast(&object); - if (widget) { - - const QWExtra* extra = qt_widget_private(const_cast(widget))->extraData(); - - if (extra) { - - QByteArray array; - QTextStream stream(&array); - - stream << "widget (Symbian): "; - stream << "activated " << extra->activated << ' '; - stream << "disableBlit " << extra->disableBlit << ' '; - - stream.flush(); - result.append(array); - } - } - - return result; -} - -QList QAnnotatorControl::annotation(const QObject& object) -{ - QList result; - - const QWidget* widget = qobject_cast(&object); - if (widget) { - - const CCoeControl* control = widget->effectiveWinId(); - if (control) { - - QByteArray array; - QTextStream stream(&array); - - stream << "control: " << control << ' '; - stream << "parent " << control->Parent() << ' '; - - if (control->IsVisible()) - stream << "visible "; - else - stream << "invisible "; - - stream << control->Position().iX << ',' << control->Position().iY << ' '; - stream << control->Size().iWidth << 'x' << control->Size().iHeight; - - if (control->OwnsWindow()) - stream << " ownsWindow "; - - stream.flush(); - result.append(array); - } - } - - return result; -} - -QList QAnnotatorWindow::annotation(const QObject& object) -{ - QList result; - - const QWidget* widget = qobject_cast(&object); - if (widget) { - - const CCoeControl* control = widget->effectiveWinId(); - RDrawableWindow *window = 0; - - if (control && (window = control->DrawableWindow())) { - - QByteArray array; - QTextStream stream(&array); - - stream << "window: "; - - // Server-side address of CWsWindow object - // This is useful for correlation with the window tree dumped by the window - // server (see RWsSession::LogCommand). - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "srv " << reinterpret_cast(window->WsHandle()) << ' '; - - stream << "group " << window->WindowGroupId() << ' '; - - // Client-side handle to the parent window. - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "parent " << reinterpret_cast(window->Parent()) << ' '; - - stream << window->Position().iX << ',' << window->Position().iY << ' '; - stream << '(' << window->AbsPosition().iX << ',' << window->AbsPosition().iY << ") "; - stream << window->Size().iWidth << 'x' << window->Size().iHeight << ' '; - - const TDisplayMode displayMode = window->DisplayMode(); - stream << "mode " << displayMode << ' '; - - stream << "ord " << window->OrdinalPosition(); - - stream.flush(); - result.append(array); - } - } - - return result; -} - -} // namespace Symbian - -void addDefaultAnnotators_sys(QDumper& dumper) -{ - dumper.addAnnotator(new Symbian::QAnnotatorWidget); - dumper.addAnnotator(new Symbian::QAnnotatorControl); - dumper.addAnnotator(new Symbian::QAnnotatorWindow); -} - -void addDefaultAnnotators_sys(QVisitor& visitor) -{ - visitor.addAnnotator(new Symbian::QAnnotatorWidget); - visitor.addAnnotator(new Symbian::QAnnotatorControl); - visitor.addAnnotator(new Symbian::QAnnotatorWindow); -} - -} // namespace ObjectDump - -QT_END_NAMESPACE - - diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h deleted file mode 100644 index 563c862..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h +++ /dev/null @@ -1,66 +0,0 @@ -/* 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 . - -*/ - -#ifndef OBJECTDUMP_SYMBIAN_H -#define OBJECTDUMP_SYMBIAN_H - -#include "objectdump.h" - -QT_BEGIN_NAMESPACE - -namespace ObjectDump -{ -namespace Symbian -{ - -/** - * Annotator which returns Symbian-specific widget information - */ -class QAnnotatorWidget : public QAnnotator -{ - Q_OBJECT -public: - QList annotation(const QObject& object); -}; - -/** - * Annotator which returns control information - */ -class QAnnotatorControl : public QAnnotator -{ - Q_OBJECT -public: - QList annotation(const QObject& object); -}; - -/** - * Annotator which returns window information - */ -class QAnnotatorWindow : public QAnnotator -{ - Q_OBJECT -public: - QList annotation(const QObject& object); -}; - -} // namespace Symbian -} // namespace ObjectDump - -QT_END_NAMESPACE - -#endif diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp deleted file mode 100644 index bc61435..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* 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 . - -*/ - -#include -#include -#include "objecttree.h" - -QT_BEGIN_NAMESPACE - -namespace ObjectTree -{ - -DepthFirstConstIterator::DepthFirstConstIterator() - : m_pointee(0) -{ - -} - -DepthFirstConstIterator::DepthFirstConstIterator - (const QObject& root) - : m_pointee(&root) -{ - -} - -DepthFirstConstIterator& - DepthFirstConstIterator::operator++() -{ - const QObjectList& children = m_pointee->children(); - - if (children.count() == 0) { - backtrack(); - } - else { - m_history.push(0); - m_pointee = children.first(); - } - - return *this; -} - -void DepthFirstConstIterator::backtrack() -{ - if (m_history.count()) { - const int index = m_history.top(); - m_history.pop(); - - const QObjectList& siblings = m_pointee->parent()->children(); - if (siblings.count() > index + 1) { - m_history.push(index + 1); - m_pointee = siblings[index + 1]; - } - else { - m_pointee = m_pointee->parent(); - backtrack(); - } - } - else { - // Reached end of search - m_pointee = 0; - } -} - - - -AncestorConstIterator::AncestorConstIterator() -{ - -} - -AncestorConstIterator::AncestorConstIterator(const QObject& leaf) -{ - m_ancestors.push(&leaf); - QObject* ancestor = leaf.parent(); - while(ancestor) - { - m_ancestors.push(ancestor); - ancestor = ancestor->parent(); - } -} - -} // namespace ObjectTree - -QT_END_NAMESPACE - - - diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h b/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h deleted file mode 100644 index 98bdf14..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h +++ /dev/null @@ -1,117 +0,0 @@ -/* 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 . - -*/ - -#ifndef OBJECTTREE_H -#define OBJECTTREE_H - -#include "objectdump_global.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace ObjectTree -{ - -/** - * Depth-first iterator for QObject tree - */ -class OBJECTDUMP_EXPORT DepthFirstConstIterator -{ -public: - DepthFirstConstIterator(); - DepthFirstConstIterator(const QObject& root); - - DepthFirstConstIterator& operator++(); - - inline bool operator==(const DepthFirstConstIterator& other) const - { return other.m_pointee == m_pointee; } - - inline bool operator!=(const DepthFirstConstIterator& other) const - { return other.m_pointee != m_pointee; } - - inline const QObject* operator->() const { return m_pointee; } - inline const QObject& operator*() const { return *m_pointee; } - -private: - void backtrack(); - -private: - const QObject* m_pointee; - QStack m_history; -}; - -/** - * Ancestor iterator for QObject tree - */ -class OBJECTDUMP_EXPORT AncestorConstIterator -{ -public: - AncestorConstIterator(); - AncestorConstIterator(const QObject& root); - - inline AncestorConstIterator& operator++() - { m_ancestors.pop(); return *this; } - - inline bool operator==(const AncestorConstIterator& other) const - { return other.m_ancestors == m_ancestors; } - - inline bool operator!=(const AncestorConstIterator& other) const - { return other.m_ancestors != m_ancestors; } - - inline const QObject* operator->() const { return m_ancestors.top(); } - inline const QObject& operator*() const { return *m_ancestors.top(); } - -private: - QStack m_ancestors; - -}; - -/** - * Generic algorithm for visiting nodes in an object tree. Nodes in the - * tree are visited in a const context, therefore they are not modified - * by this algorithm. - * - * Visitor must provide functions with the following signatures: - * - * Called before visit begins - * void visitPrepare() - * - * Called on each node visited - * void visitNode(const QObject& object) - * - * Called when visit is complete - * void visitComplete() - */ -template -void visit(Iterator begin, Iterator end, Visitor& visitor) -{ - visitor.visitPrepare(); - - for ( ; begin != end; ++begin) - visitor.visitNode(*begin); - - visitor.visitComplete(); -} - -} // namespace ObjectTree - -QT_END_NAMESPACE - -#endif // OBJECTTREE_H diff --git a/src/3rdparty/phonon/mmf/objectdump.cpp b/src/3rdparty/phonon/mmf/objectdump.cpp new file mode 100644 index 0000000..6b6b71e --- /dev/null +++ b/src/3rdparty/phonon/mmf/objectdump.cpp @@ -0,0 +1,529 @@ +/* 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 . + +*/ + +#ifndef QT_NO_DEBUG + +#include +#include +#include +#include +#include + +#include "objectdump.h" +#include "objecttree.h" + +QT_BEGIN_NAMESPACE + +namespace ObjectDump +{ + +//----------------------------------------------------------------------------- +// QObjectAnnotator +//----------------------------------------------------------------------------- + +QAnnotator::~QAnnotator() +{ + +} + + +//----------------------------------------------------------------------------- +// Annotators +//----------------------------------------------------------------------------- + +QList QAnnotatorBasic::annotation(const QObject& object) +{ + QList result; + + QByteArray array; + QTextStream stream(&array); + + stream << '[' << &object << ']'; + stream << ' '; + stream << object.metaObject()->className(); + + if (object.objectName() != "") + stream << " \"" << object.objectName() << '"'; + + if (object.isWidgetType()) + stream << " isWidget"; + + stream.flush(); + result.append(array); + return result; +} + +QList QAnnotatorWidget::annotation(const QObject& object) +{ + QList result; + + const QWidget* widget = qobject_cast(&object); + if (widget) { + + QByteArray array; + QTextStream stream(&array); + + stream << "widget: "; + + if (widget->isVisible()) + stream << "visible "; + else + stream << "invisible "; + + stream << widget->x() << ',' << widget->y() << ' '; + stream << widget->size().width() << 'x'<< widget->size().height() << ' '; + + stream << "hint " << widget->sizeHint().width() << 'x' << widget->sizeHint().height(); + + stream.flush(); + result.append(array); + } + + return result; +} + + +//----------------------------------------------------------------------------- +// Base class for QDumperPrivate, QVisitorPrivate +//----------------------------------------------------------------------------- + +class QDumperBase +{ +public: + QDumperBase(); + ~QDumperBase(); + + void setPrefix(const QString& prefix); + void addAnnotator(QAnnotator* annotator); + +protected: + QByteArray m_prefix; + QList m_annotators; + +}; + +QDumperBase::QDumperBase() +{ + +} + +QDumperBase::~QDumperBase() +{ + QAnnotator* annotator; + foreach(annotator, m_annotators) + delete annotator; +} + +void QDumperBase::setPrefix(const QString& prefix) +{ + m_prefix = prefix.count() + ? (prefix + " ").toAscii() + : prefix.toAscii(); +} + +void QDumperBase::addAnnotator(QAnnotator* annotator) +{ + // Protect against an exception occurring during QList::append + QScopedPointer holder(annotator); + m_annotators.append(annotator); + holder.take(); +} + + +//----------------------------------------------------------------------------- +// QDumper +//----------------------------------------------------------------------------- + +class QDumperPrivate : public QDumperBase +{ +public: + QDumperPrivate(); + ~QDumperPrivate(); + + void dumpObject(const QObject& object); + +}; + + +QDumperPrivate::QDumperPrivate() +{ + +} + +QDumperPrivate::~QDumperPrivate() +{ + +} + +void QDumperPrivate::dumpObject(const QObject& object) +{ + QAnnotator* annotator; + foreach(annotator, m_annotators) { + + const QList annotations = annotator->annotation(object); + QByteArray annotation; + foreach(annotation, annotations) { + QByteArray buffer(m_prefix); + buffer.append(annotation); + qDebug() << buffer.constData(); + } + } +} + + +QDumper::QDumper() + : d_ptr(new QDumperPrivate) +{ + +} + +QDumper::~QDumper() +{ + +} + +void QDumper::setPrefix(const QString& prefix) +{ + d_func()->setPrefix(prefix); +} + +void QDumper::addAnnotator(QAnnotator* annotator) +{ + d_func()->addAnnotator(annotator); +} + +void QDumper::dumpObject(const QObject& object) +{ + d_func()->dumpObject(object); +} + + +//----------------------------------------------------------------------------- +// QVisitor +//----------------------------------------------------------------------------- + +class QVisitorPrivate : public QDumperBase +{ +public: + QVisitorPrivate(); + ~QVisitorPrivate(); + + void setIndent(unsigned indent); + + void visitNode(const QObject& object); + void visitComplete(); + +private: + class Node + { + public: + Node(); + ~Node(); + + QList m_annotation; + QList m_children; + + typedef QList::const_iterator child_iterator; + }; + +private: + Node* findNode(const QObject* object) const; + QByteArray branchBuffer(const QList& branches, bool isNodeLine, bool isLastChild) const; + void dumpRecursive(const Node& node, QList branches, bool isLastChild); + void dumpNode(const Node& node, const QList& branches, bool isLastChild); + +private: + unsigned m_indent; + + QScopedPointer m_root; + + // Hash table used to associate internal nodes with QObjects + typedef QHash Hash; + Hash m_hash; +}; + +static const unsigned DefaultIndent = 2; + +QVisitorPrivate::QVisitorPrivate() + : m_indent(DefaultIndent) +{ + +} + +QVisitorPrivate::~QVisitorPrivate() +{ + +} + +void QVisitorPrivate::setIndent(unsigned indent) +{ + m_indent = indent; +} + +// Builds up a mirror of the object tree, rooted in m_root, with each node +// storing annotations generated by +void QVisitorPrivate::visitNode(const QObject& object) +{ + QObject* const objectParent = object.parent(); + Node* const nodeParent = objectParent ? findNode(objectParent) : 0; + + // Create a new node and store in scoped pointer for exception safety + Node* node = new Node; + QScopedPointer nodePtr(node); + + // Associate node with QObject + m_hash.insert(&object, node); + + // Insert node into internal tree + if (nodeParent) + { + nodeParent->m_children.append(nodePtr.take()); + } + else + { + Q_ASSERT(m_root.isNull()); + m_root.reset(nodePtr.take()); + } + + // Generate and store annotations + QAnnotator* annotator; + foreach(annotator, m_annotators) + node->m_annotation.append( annotator->annotation(object) ); +} + +void QVisitorPrivate::visitComplete() +{ + QList branches; + static const bool isLastChild = true; + dumpRecursive(*m_root, branches, isLastChild); + m_root.reset(0); +} + +QVisitorPrivate::Node* QVisitorPrivate::findNode(const QObject* object) const +{ + Hash::const_iterator i = m_hash.find(object); + return (m_hash.end() == i) ? 0 : *i; +} + +QByteArray QVisitorPrivate::branchBuffer + (const QList& branches, bool isNodeLine, bool isLastChild) const +{ + const int depth = branches.count(); + + const QByteArray indent(m_indent, ' '); + const QByteArray horiz(m_indent, '-'); + + QByteArray buffer; + QTextStream stream(&buffer); + + for (int i=0; i branches, bool isLastChild) +{ + dumpNode(node, branches, isLastChild); + + // Recurse down tree + const Node::child_iterator begin = node.m_children.begin(); + const Node::child_iterator end = node.m_children.end(); + for (Node::child_iterator i = begin; end != i; ++i) { + + isLastChild = (end == i + 1); + + if (begin == i) + branches.push_back(!isLastChild); + else + branches.back() = !isLastChild; + + static const bool isNodeLine = false; + const QByteArray buffer = branchBuffer(branches, isNodeLine, false); + qDebug() << buffer.constData(); + + dumpRecursive(**i, branches, isLastChild); + } +} + +void QVisitorPrivate::dumpNode + (const Node& node, const QList& branches, bool isLastChild) +{ + const QList::const_iterator + begin = node.m_annotation.begin(), end = node.m_annotation.end(); + + if (begin == end) { + // No annotations - just dump the object pointer + const bool isNodeLine = true; + QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild); + qDebug() << 0; // TODO + } + else { + // Dump annotations + for (QList::const_iterator i = begin; end != i; ++i) { + const bool isNodeLine = (begin == i); + QByteArray buffer = branchBuffer(branches, isNodeLine, isLastChild); + buffer.append(*i); + qDebug() << buffer.constData(); + } + } +} + + +// QVisitorPrivate::Node + +QVisitorPrivate::Node::Node() +{ + +} + +QVisitorPrivate::Node::~Node() +{ + Node* child; + foreach(child, m_children) + delete child; +} + + +// QVisitor + +QVisitor::QVisitor() + : d_ptr(new QVisitorPrivate) +{ + +} + +QVisitor::~QVisitor() +{ + +} + +void QVisitor::setPrefix(const QString& prefix) +{ + d_func()->setPrefix(prefix); +} + +void QVisitor::setIndent(unsigned indent) +{ + d_func()->setIndent(indent); +} + +void QVisitor::addAnnotator(QAnnotator* annotator) +{ + d_func()->addAnnotator(annotator); +} + +void QVisitor::visitPrepare() +{ + // Do nothing +} + +void QVisitor::visitNode(const QObject& object) +{ + d_func()->visitNode(object); +} + +void QVisitor::visitComplete() +{ + d_func()->visitComplete(); +} + + +//----------------------------------------------------------------------------- +// Utility functions +//----------------------------------------------------------------------------- + +void addDefaultAnnotators_sys(QDumper& visitor); +void addDefaultAnnotators_sys(QVisitor& visitor); + +void addDefaultAnnotators(QDumper& dumper) +{ + dumper.addAnnotator(new QAnnotatorBasic); + dumper.addAnnotator(new QAnnotatorWidget); + + // Add platform-specific annotators + addDefaultAnnotators_sys(dumper); +} + +void addDefaultAnnotators(QVisitor& visitor) +{ + visitor.addAnnotator(new QAnnotatorBasic); + visitor.addAnnotator(new QAnnotatorWidget); + + // Add platform-specific annotators + addDefaultAnnotators_sys(visitor); +} + +void dumpTreeFromRoot(const QObject& root, QVisitor& visitor) +{ + // Set up iteration range + ObjectTree::DepthFirstConstIterator begin(root), end; + + // Invoke generic visitor algorithm + ObjectTree::visit(begin, end, visitor); +} + +void dumpTreeFromLeaf(const QObject& leaf, QVisitor& visitor) +{ + // Walk up to root + const QObject* root = &leaf; + while(root->parent()) + { + root = root->parent(); + } + + dumpTreeFromRoot(*root, visitor); +} + +void dumpAncestors(const QObject& leaf, QVisitor& visitor) +{ + // Set up iteration range + ObjectTree::AncestorConstIterator begin(leaf), end; + + // Invoke generic visitor algorithm + ObjectTree::visit(begin, end, visitor); +} + + +} // namespace ObjectDump + +QT_END_NAMESPACE + +#endif + diff --git a/src/3rdparty/phonon/mmf/objectdump.h b/src/3rdparty/phonon/mmf/objectdump.h new file mode 100644 index 0000000..e94b3ac --- /dev/null +++ b/src/3rdparty/phonon/mmf/objectdump.h @@ -0,0 +1,166 @@ +/* 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 . + +*/ + +#ifndef OBJECTDUMP_H +#define OBJECTDUMP_H + +#include "objectdump_global.h" + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace ObjectDump +{ + +/** + * Abstract base for annotator classes invoked by QVisitor. + */ +class OBJECTDUMP_EXPORT QAnnotator : public QObject +{ + Q_OBJECT +public: + virtual ~QAnnotator(); + virtual QList annotation(const QObject& object) = 0; +}; + +/** + * Annotator which replicates QObject::dumpObjectTree functionality. + */ +class OBJECTDUMP_EXPORT QAnnotatorBasic : public QAnnotator +{ + Q_OBJECT +public: + QList annotation(const QObject& object); +}; + +/** + * Annotator which returns widget information. + */ +class OBJECTDUMP_EXPORT QAnnotatorWidget : public QAnnotator +{ + Q_OBJECT +public: + QList annotation(const QObject& object); +}; + + +class QDumperPrivate; + +/** + * Class used to dump information about individual QObjects. + */ +class OBJECTDUMP_EXPORT QDumper : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QDumper) + +public: + QDumper(); + ~QDumper(); + + /** + * Specify a prefix, to be printed on each line of output. + */ + void setPrefix(const QString& prefix); + + /** + * Takes ownership of annotator. + */ + void addAnnotator(QAnnotator* annotator); + + /** + * Invoke each annotator on the object and write to debug output. + */ + void dumpObject(const QObject& object); + +private: + QScopedPointer d_ptr; + +}; + + +class QVisitorPrivate; + +/** + * Visitor class which dumps information about nodes in the object tree. + */ +class OBJECTDUMP_EXPORT QVisitor : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QVisitor) + +public: + QVisitor(); + ~QVisitor(); + + /** + * Specify a prefix, to be printed on each line of output. + */ + void setPrefix(const QString& prefix); + + /** + * Set number of spaces by which each level of the tree is indented. + */ + void setIndent(unsigned indent); + + /** + * Called by the visitor algorithm before starting the visit. + */ + void visitPrepare(); + + /** + * Called by the visitor algorithm as each node is visited. + */ + void visitNode(const QObject& object); + + /** + * Called by the visitor algorithm when the visit is complete. + */ + void visitComplete(); + + /** + * Takes ownership of annotator. + */ + void addAnnotator(QAnnotator* annotator); + +private: + QScopedPointer d_ptr; + +}; + + +//----------------------------------------------------------------------------- +// Utility functions +//----------------------------------------------------------------------------- + +void OBJECTDUMP_EXPORT addDefaultAnnotators(QDumper& dumper); +void OBJECTDUMP_EXPORT addDefaultAnnotators(QVisitor& visitor); + +void OBJECTDUMP_EXPORT dumpTreeFromRoot(const QObject& root, QVisitor& visitor); +void OBJECTDUMP_EXPORT dumpTreeFromLeaf(const QObject& leaf, QVisitor& visitor); +void OBJECTDUMP_EXPORT dumpAncestors(const QObject& leaf, QVisitor& visitor); + +} // namespace ObjectDump + +QT_END_NAMESPACE + +#endif diff --git a/src/3rdparty/phonon/mmf/objectdump_global.h b/src/3rdparty/phonon/mmf/objectdump_global.h new file mode 100644 index 0000000..b8987e0 --- /dev/null +++ b/src/3rdparty/phonon/mmf/objectdump_global.h @@ -0,0 +1,30 @@ +/* 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 . + +*/ + +#ifndef OBJECTDUMP_GLOBAL_H +#define OBJECTDUMP_GLOBAL_H + +#include + +#if defined(OBJECTDUMP_LIBRARY) +# define OBJECTDUMP_EXPORT +#else +# define OBJECTDUMP_EXPORT +#endif + +#endif diff --git a/src/3rdparty/phonon/mmf/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/objectdump_symbian.cpp new file mode 100644 index 0000000..19355d9 --- /dev/null +++ b/src/3rdparty/phonon/mmf/objectdump_symbian.cpp @@ -0,0 +1,163 @@ +/* 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 . + +*/ + +#ifndef QT_NO_DEBUG + +#include +#include +#include +#include "objectdump_symbian.h" + +#include // to access QWExtra + +QT_BEGIN_NAMESPACE + +namespace ObjectDump +{ +namespace Symbian +{ + +QList QAnnotatorWidget::annotation(const QObject& object) +{ + QList result; + + const QWidget* widget = qobject_cast(&object); + if (widget) { + + const QWExtra* extra = qt_widget_private(const_cast(widget))->extraData(); + + if (extra) { + + QByteArray array; + QTextStream stream(&array); + + stream << "widget (Symbian): "; + stream << "activated " << extra->activated << ' '; + stream << "disableBlit " << extra->disableBlit << ' '; + + stream.flush(); + result.append(array); + } + } + + return result; +} + +QList QAnnotatorControl::annotation(const QObject& object) +{ + QList result; + + const QWidget* widget = qobject_cast(&object); + if (widget) { + + const CCoeControl* control = widget->effectiveWinId(); + if (control) { + + QByteArray array; + QTextStream stream(&array); + + stream << "control: " << control << ' '; + stream << "parent " << control->Parent() << ' '; + + if (control->IsVisible()) + stream << "visible "; + else + stream << "invisible "; + + stream << control->Position().iX << ',' << control->Position().iY << ' '; + stream << control->Size().iWidth << 'x' << control->Size().iHeight; + + if (control->OwnsWindow()) + stream << " ownsWindow "; + + stream.flush(); + result.append(array); + } + } + + return result; +} + +QList QAnnotatorWindow::annotation(const QObject& object) +{ + QList result; + + const QWidget* widget = qobject_cast(&object); + if (widget) { + + const CCoeControl* control = widget->effectiveWinId(); + RDrawableWindow *window = 0; + + if (control && (window = control->DrawableWindow())) { + + QByteArray array; + QTextStream stream(&array); + + stream << "window: "; + + // Server-side address of CWsWindow object + // This is useful for correlation with the window tree dumped by the window + // server (see RWsSession::LogCommand). + // Cast to a void pointer so that log output is in hexadecimal format. + stream << "srv " << reinterpret_cast(window->WsHandle()) << ' '; + + stream << "group " << window->WindowGroupId() << ' '; + + // Client-side handle to the parent window. + // Cast to a void pointer so that log output is in hexadecimal format. + stream << "parent " << reinterpret_cast(window->Parent()) << ' '; + + stream << window->Position().iX << ',' << window->Position().iY << ' '; + stream << '(' << window->AbsPosition().iX << ',' << window->AbsPosition().iY << ") "; + stream << window->Size().iWidth << 'x' << window->Size().iHeight << ' '; + + const TDisplayMode displayMode = window->DisplayMode(); + stream << "mode " << displayMode << ' '; + + stream << "ord " << window->OrdinalPosition(); + + stream.flush(); + result.append(array); + } + } + + return result; +} + +} // namespace Symbian + +void addDefaultAnnotators_sys(QDumper& dumper) +{ + dumper.addAnnotator(new Symbian::QAnnotatorWidget); + dumper.addAnnotator(new Symbian::QAnnotatorControl); + dumper.addAnnotator(new Symbian::QAnnotatorWindow); +} + +void addDefaultAnnotators_sys(QVisitor& visitor) +{ + visitor.addAnnotator(new Symbian::QAnnotatorWidget); + visitor.addAnnotator(new Symbian::QAnnotatorControl); + visitor.addAnnotator(new Symbian::QAnnotatorWindow); +} + +} // namespace ObjectDump + +QT_END_NAMESPACE + +#endif + diff --git a/src/3rdparty/phonon/mmf/objectdump_symbian.h b/src/3rdparty/phonon/mmf/objectdump_symbian.h new file mode 100644 index 0000000..563c862 --- /dev/null +++ b/src/3rdparty/phonon/mmf/objectdump_symbian.h @@ -0,0 +1,66 @@ +/* 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 . + +*/ + +#ifndef OBJECTDUMP_SYMBIAN_H +#define OBJECTDUMP_SYMBIAN_H + +#include "objectdump.h" + +QT_BEGIN_NAMESPACE + +namespace ObjectDump +{ +namespace Symbian +{ + +/** + * Annotator which returns Symbian-specific widget information + */ +class QAnnotatorWidget : public QAnnotator +{ + Q_OBJECT +public: + QList annotation(const QObject& object); +}; + +/** + * Annotator which returns control information + */ +class QAnnotatorControl : public QAnnotator +{ + Q_OBJECT +public: + QList annotation(const QObject& object); +}; + +/** + * Annotator which returns window information + */ +class QAnnotatorWindow : public QAnnotator +{ + Q_OBJECT +public: + QList annotation(const QObject& object); +}; + +} // namespace Symbian +} // namespace ObjectDump + +QT_END_NAMESPACE + +#endif diff --git a/src/3rdparty/phonon/mmf/objecttree.cpp b/src/3rdparty/phonon/mmf/objecttree.cpp new file mode 100644 index 0000000..750db22 --- /dev/null +++ b/src/3rdparty/phonon/mmf/objecttree.cpp @@ -0,0 +1,104 @@ +/* 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 . + +*/ + +#ifndef QT_NO_DEBUG + +#include +#include +#include "objecttree.h" + +QT_BEGIN_NAMESPACE + +namespace ObjectTree +{ + +DepthFirstConstIterator::DepthFirstConstIterator() + : m_pointee(0) +{ + +} + +DepthFirstConstIterator::DepthFirstConstIterator + (const QObject& root) + : m_pointee(&root) +{ + +} + +DepthFirstConstIterator& + DepthFirstConstIterator::operator++() +{ + const QObjectList& children = m_pointee->children(); + + if (children.count() == 0) { + backtrack(); + } + else { + m_history.push(0); + m_pointee = children.first(); + } + + return *this; +} + +void DepthFirstConstIterator::backtrack() +{ + if (m_history.count()) { + const int index = m_history.top(); + m_history.pop(); + + const QObjectList& siblings = m_pointee->parent()->children(); + if (siblings.count() > index + 1) { + m_history.push(index + 1); + m_pointee = siblings[index + 1]; + } + else { + m_pointee = m_pointee->parent(); + backtrack(); + } + } + else { + // Reached end of search + m_pointee = 0; + } +} + + + +AncestorConstIterator::AncestorConstIterator() +{ + +} + +AncestorConstIterator::AncestorConstIterator(const QObject& leaf) +{ + m_ancestors.push(&leaf); + QObject* ancestor = leaf.parent(); + while(ancestor) + { + m_ancestors.push(ancestor); + ancestor = ancestor->parent(); + } +} + +} // namespace ObjectTree + +QT_END_NAMESPACE + +#endif + diff --git a/src/3rdparty/phonon/mmf/objecttree.h b/src/3rdparty/phonon/mmf/objecttree.h new file mode 100644 index 0000000..98bdf14 --- /dev/null +++ b/src/3rdparty/phonon/mmf/objecttree.h @@ -0,0 +1,117 @@ +/* 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 . + +*/ + +#ifndef OBJECTTREE_H +#define OBJECTTREE_H + +#include "objectdump_global.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace ObjectTree +{ + +/** + * Depth-first iterator for QObject tree + */ +class OBJECTDUMP_EXPORT DepthFirstConstIterator +{ +public: + DepthFirstConstIterator(); + DepthFirstConstIterator(const QObject& root); + + DepthFirstConstIterator& operator++(); + + inline bool operator==(const DepthFirstConstIterator& other) const + { return other.m_pointee == m_pointee; } + + inline bool operator!=(const DepthFirstConstIterator& other) const + { return other.m_pointee != m_pointee; } + + inline const QObject* operator->() const { return m_pointee; } + inline const QObject& operator*() const { return *m_pointee; } + +private: + void backtrack(); + +private: + const QObject* m_pointee; + QStack m_history; +}; + +/** + * Ancestor iterator for QObject tree + */ +class OBJECTDUMP_EXPORT AncestorConstIterator +{ +public: + AncestorConstIterator(); + AncestorConstIterator(const QObject& root); + + inline AncestorConstIterator& operator++() + { m_ancestors.pop(); return *this; } + + inline bool operator==(const AncestorConstIterator& other) const + { return other.m_ancestors == m_ancestors; } + + inline bool operator!=(const AncestorConstIterator& other) const + { return other.m_ancestors != m_ancestors; } + + inline const QObject* operator->() const { return m_ancestors.top(); } + inline const QObject& operator*() const { return *m_ancestors.top(); } + +private: + QStack m_ancestors; + +}; + +/** + * Generic algorithm for visiting nodes in an object tree. Nodes in the + * tree are visited in a const context, therefore they are not modified + * by this algorithm. + * + * Visitor must provide functions with the following signatures: + * + * Called before visit begins + * void visitPrepare() + * + * Called on each node visited + * void visitNode(const QObject& object) + * + * Called when visit is complete + * void visitComplete() + */ +template +void visit(Iterator begin, Iterator end, Visitor& visitor) +{ + visitor.visitPrepare(); + + for ( ; begin != end; ++begin) + visitor.visitNode(*begin); + + visitor.visitComplete(); +} + +} // namespace ObjectTree + +QT_END_NAMESPACE + +#endif // OBJECTTREE_H diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index ff27ea1..8522c06 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -1,4 +1,101 @@ -TEMPLATE = subdirs -SUBDIRS = mmfphonondebug plugin +# MMF Phonon backend + +QT += phonon +TARGET = phonon_mmf +PHONON_MMF_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf + +# Uncomment the following line in order to use the CDrmPlayerUtility client +# API for audio playback, rather than CMdaAudioPlayerUtility. +#CONFIG += phonon_mmf_audio_drm + +phonon_mmf_audio_drm { + LIBS += -lDrmAudioPlayUtility + DEFINES += QT_PHONON_MMF_AUDIO_DRM +} else { + LIBS += -lmediaclientaudio +} + +# This is necessary because both epoc32/include and Phonon contain videoplayer.h. +# By making /epoc32/include the first SYSTEMINCLUDE, we ensure that +# '#include ' picks up the Symbian header, as intended. +PREPEND_INCLUDEPATH = /epoc32/include + +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + +HEADERS += \ + $$PHONON_MMF_DIR/abstractaudioeffect.h \ + $$PHONON_MMF_DIR/abstractmediaplayer.h \ + $$PHONON_MMF_DIR/abstractplayer.h \ + $$PHONON_MMF_DIR/ancestormovemonitor.h \ + $$PHONON_MMF_DIR/audioequalizer.h \ + $$PHONON_MMF_DIR/audiooutput.h \ + $$PHONON_MMF_DIR/audioplayer.h \ + $$PHONON_MMF_DIR/backend.h \ + $$PHONON_MMF_DIR/bassboost.h \ + $$PHONON_MMF_DIR/defs.h \ + $$PHONON_MMF_DIR/dummyplayer.h \ + $$PHONON_MMF_DIR/effectfactory.h \ + $$PHONON_MMF_DIR/mediaobject.h \ + $$PHONON_MMF_DIR/mmf_medianode.h \ + $$PHONON_MMF_DIR/mmf_videoplayer.h \ + $$PHONON_MMF_DIR/objectdump.h \ + $$PHONON_MMF_DIR/objectdump_global.h \ + $$PHONON_MMF_DIR/objecttree.h \ + $$PHONON_MMF_DIR/utils.h \ + $$PHONON_MMF_DIR/videooutput.h \ + $$PHONON_MMF_DIR/videooutputobserver.h \ + $$PHONON_MMF_DIR/videowidget.h \ + $$PHONON_MMF_DIR/volumeobserver.h + +SOURCES += \ + $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ + $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ + $$PHONON_MMF_DIR/abstractplayer.cpp \ + $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ + $$PHONON_MMF_DIR/audioequalizer.cpp \ + $$PHONON_MMF_DIR/audiooutput.cpp \ + $$PHONON_MMF_DIR/audioplayer.cpp \ + $$PHONON_MMF_DIR/backend.cpp \ + $$PHONON_MMF_DIR/bassboost.cpp \ + $$PHONON_MMF_DIR/dummyplayer.cpp \ + $$PHONON_MMF_DIR/effectfactory.cpp \ + $$PHONON_MMF_DIR/mediaobject.cpp \ + $$PHONON_MMF_DIR/mmf_medianode.cpp \ + $$PHONON_MMF_DIR/mmf_videoplayer.cpp \ + $$PHONON_MMF_DIR/objectdump.cpp \ + $$PHONON_MMF_DIR/objecttree.cpp \ + $$PHONON_MMF_DIR/utils.cpp \ + $$PHONON_MMF_DIR/videooutput.cpp \ + $$PHONON_MMF_DIR/videowidget.cpp + +HEADERS += $$PHONON_MMF_DIR/objectdump_symbian.h +SOURCES += $$PHONON_MMF_DIR/objectdump_symbian.cpp + +LIBS += -lcone +LIBS += -lws32 + +# This is only needed for debug builds, but is always linked against. +LIBS += -lhal + +TARGET.CAPABILITY = all -tcb + +LIBS += -lmediaclientvideo # For CVideoPlayerUtility +LIBS += -lcone # For CCoeEnv +LIBS += -lws32 # For RWindow +LIBS += -lefsrv # For file server +LIBS += -lapgrfx -lapmime # For recognizer +LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry + +# These are for effects. +LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect + +# This is needed for having the .qtplugin file properly created on Symbian. +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend + +target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend +INSTALLS += target + +include(../../qpluginbase.pri) + +TARGET.UID3=0x2001E629 -plugin.depends = mmfphonondebug diff --git a/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro b/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro deleted file mode 100644 index 2cfec15..0000000 --- a/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro +++ /dev/null @@ -1,31 +0,0 @@ -TEMPLATE = lib -TARGET = phonon_mmf_debug -OBJECTDUMP_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf/mmfphonondebug - -CONFIG += staticlib - -DEFINES += OBJECTDUMP_LIBRARY - -HEADERS += \ - $$OBJECTDUMP_DIR/objectdump_global.h \ - $$OBJECTDUMP_DIR/objectdump.h \ - $$OBJECTDUMP_DIR/objecttree.h - -SOURCES += \ - $$OBJECTDUMP_DIR/objectdump.cpp \ - $$OBJECTDUMP_DIR/objecttree.cpp - -symbian { - HEADERS += $$OBJECTDUMP_DIR/objectdump_symbian.h - SOURCES += $$OBJECTDUMP_DIR/objectdump_symbian.cpp - - LIBS += -lcone - LIBS += -lws32 - - TARGET.CAPABILITY = all -tcb - -} else { - SOURCES += $$OBJECTDUMP_DIR/objectdump_stub.cpp -} - -TARGET.UID3=0x2001E62A diff --git a/src/plugins/phonon/mmf/plugin/plugin.pro b/src/plugins/phonon/mmf/plugin/plugin.pro deleted file mode 100644 index 8a7de98..0000000 --- a/src/plugins/phonon/mmf/plugin/plugin.pro +++ /dev/null @@ -1,91 +0,0 @@ -# MMF Phonon backend - -QT += phonon -TARGET = phonon_mmf -PHONON_MMF_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf - -# Uncomment the following line in order to use the CDrmPlayerUtility client -# API for audio playback, rather than CMdaAudioPlayerUtility. -#CONFIG += phonon_mmf_audio_drm - -phonon_mmf_audio_drm { - LIBS += -lDrmAudioPlayUtility - DEFINES += QT_PHONON_MMF_AUDIO_DRM -} else { - LIBS += -lmediaclientaudio -} - -# This is necessary because both epoc32/include and Phonon contain videoplayer.h. -# By making /epoc32/include the first SYSTEMINCLUDE, we ensure that -# '#include ' picks up the Symbian header, as intended. -PREPEND_INCLUDEPATH = /epoc32/include - -INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - -HEADERS += \ - $$PHONON_MMF_DIR/abstractaudioeffect.h \ - $$PHONON_MMF_DIR/abstractmediaplayer.h \ - $$PHONON_MMF_DIR/abstractplayer.h \ - $$PHONON_MMF_DIR/ancestormovemonitor.h \ - $$PHONON_MMF_DIR/audiooutput.h \ - $$PHONON_MMF_DIR/audioequalizer.h \ - $$PHONON_MMF_DIR/audioplayer.h \ - $$PHONON_MMF_DIR/backend.h \ - $$PHONON_MMF_DIR/bassboost.h \ - $$PHONON_MMF_DIR/defs.h \ - $$PHONON_MMF_DIR/dummyplayer.h \ - $$PHONON_MMF_DIR/effectfactory.h \ - $$PHONON_MMF_DIR/mmf_medianode.h \ - $$PHONON_MMF_DIR/mediaobject.h \ - $$PHONON_MMF_DIR/utils.h \ - $$PHONON_MMF_DIR/videooutput.h \ - $$PHONON_MMF_DIR/videooutputobserver.h \ - $$PHONON_MMF_DIR/mmf_videoplayer.h \ - $$PHONON_MMF_DIR/videowidget.h \ - $$PHONON_MMF_DIR/volumeobserver.h - -SOURCES += \ - $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ - $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ - $$PHONON_MMF_DIR/abstractplayer.cpp \ - $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ - $$PHONON_MMF_DIR/audiooutput.cpp \ - $$PHONON_MMF_DIR/audioequalizer.cpp \ - $$PHONON_MMF_DIR/audioplayer.cpp \ - $$PHONON_MMF_DIR/backend.cpp \ - $$PHONON_MMF_DIR/bassboost.cpp \ - $$PHONON_MMF_DIR/dummyplayer.cpp \ - $$PHONON_MMF_DIR/effectfactory.cpp \ - $$PHONON_MMF_DIR/mmf_medianode.cpp \ - $$PHONON_MMF_DIR/mediaobject.cpp \ - $$PHONON_MMF_DIR/utils.cpp \ - $$PHONON_MMF_DIR/videooutput.cpp \ - $$PHONON_MMF_DIR/mmf_videoplayer.cpp \ - $$PHONON_MMF_DIR/videowidget.cpp - -debug { - INCLUDEPATH += $$PHONON_MMF_DIR/mmfphonondebug - LIBS += -lphonon_mmf_debug.lib - LIBS += -lhal -} - -LIBS += -lmediaclientvideo # For CVideoPlayerUtility -LIBS += -lcone # For CCoeEnv -LIBS += -lws32 # For RWindow -LIBS += -lefsrv # For file server -LIBS += -lapgrfx -lapmime # For recognizer -LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry - -# These are for effects. -LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect - -# This is needed for having the .qtplugin file properly created on Symbian. -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend - -target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend -INSTALLS += target - -include(../../../qpluginbase.pri) - -TARGET.UID3=0x2001E629 - -- cgit v0.12 From 869323e1d6e7524050e2240fdc1bedb7b7639444 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 9 Nov 2009 15:09:07 +0000 Subject: Removed infinite recursion from Phonon::MMF::MediaObject::errorType Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp index de2722d..d679e54 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp @@ -134,7 +134,7 @@ void MMF::AbstractPlayer::setError(Phonon::ErrorType error, Phonon::ErrorType MMF::AbstractPlayer::errorType() const { const Phonon::ErrorType result = (ErrorState == m_state) - ? errorType() : NoError; + ? m_error : NoError; return result; } -- cgit v0.12 From 7c8676c35df44404aa30824ae7856408c3c5a629 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 9 Nov 2009 15:09:58 +0000 Subject: Allowed execution of pause command when backend is in error state When qmediaplayer receives a stateChanged(ErrorState) signal, it first displays a dialog, and then calls pause() on the media object. This change allows that pause command to be executed on the underlying MMF client API. Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index f2efaa0..4d7bc06 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -109,12 +109,12 @@ void MMF::AbstractMediaPlayer::pause() case GroundState: case LoadingState: case PausedState: - case ErrorState: // Do nothing break; case StoppedState: case PlayingState: + case ErrorState: case BufferingState: doPause(); stopTickTimer(); -- cgit v0.12 From dc939f3cf536838ce51620e3450f9be66cb1e32a Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 9 Nov 2009 15:27:20 +0000 Subject: Mediaplayer now pauses playback before displaying error dialog This change improves the user experience - previously, video playback would continue in the background, while the user read the dialog. Then, when the dialog was dismissed, video playback would pause. Reviewed-by: Frans Englich --- demos/qmediaplayer/mediaplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 624bab7..8a5420f 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -355,13 +355,13 @@ void MediaPlayer::stateChanged(Phonon::State newstate, Phonon::State oldstate) switch (newstate) { case Phonon::ErrorState: - QMessageBox::warning(this, "Phonon Mediaplayer", m_MediaObject.errorString(), QMessageBox::Close); if (m_MediaObject.errorType() == Phonon::FatalError) { playButton->setEnabled(false); rewindButton->setEnabled(false); } else { m_MediaObject.pause(); } + QMessageBox::warning(this, "Phonon Mediaplayer", m_MediaObject.errorString(), QMessageBox::Close); break; case Phonon::PausedState: case Phonon::StoppedState: -- cgit v0.12 From b880e4d85caf17e43eb3bd4c9f358ca6f181a790 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 11 Nov 2009 15:39:27 +0100 Subject: Pause playback on small screens when popping up dialogs. Only done for small screens. Patch simplified by Gareth. Task-number: QTBUG-5307 Reviewed-by: Gareth Stockwell --- demos/qmediaplayer/mediaplayer.cpp | 19 +++++++++++++++++++ demos/qmediaplayer/mediaplayer.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 8a5420f..267a225 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -471,6 +471,8 @@ void MediaPlayer::effectChanged() void MediaPlayer::showSettingsDialog() { + playPauseForDialog(); + if (!settingsDialog) initSettingsDialog(); @@ -516,6 +518,8 @@ void MediaPlayer::showSettingsDialog() m_videoWidget->setScaleMode(oldScale); ui->audioEffectsCombo->setCurrentIndex(currentEffect); } + + playPauseForDialog(); } void MediaPlayer::initVideoWindow() @@ -652,10 +656,25 @@ void MediaPlayer::setFile(const QString &fileName) m_MediaObject.play(); } +void MediaPlayer::playPauseForDialog() +{ + // If we're running on a small screen, we want to pause the video + // when popping up dialogs. + if (m_hasSmallScreen && + (Phonon::PlayingState == m_MediaObject.state() || + Phonon::PausedState == m_MediaObject.state())) + playPause(); +} + void MediaPlayer::openFile() { + playPauseForDialog(); + QStringList fileNames = QFileDialog::getOpenFileNames(this, QString(), QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); + + playPauseForDialog(); + m_MediaObject.clearQueue(); if (fileNames.size() > 0) { QString fileName = fileNames[0]; diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index 08db0e5..a1c3d92 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -111,6 +111,8 @@ private slots: void hasVideoChanged(bool); private: + void playPauseForDialog(); + QIcon playIcon; QIcon pauseIcon; QMenu *fileMenu; -- cgit v0.12 From 3328e0ee94b94c83fe9d64f741bede6725f5c952 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 6 Nov 2009 17:00:12 +0000 Subject: Implemented aspect ratio and scale mode handling in Phonon MMF backend - Replaced VolumeObserver and VideoOutputObserver interfaces with signals. - Added signals for propagating changes in aspect ratio and scale mode from VideoOutput to VideoPlayer. - Removed VideoPlayer::getNativeWindowSystemHandles. Interaction with window system is moved into VideoOutput, so that VideoPlayer is better focussed on its main task: interacting with CVideoPlayerUtility. - WId changes, resize and move events received by the VideoOutput widget cause it to emit a videoWindowChanged signal. This is received by the VideoPlayer, which triggers a call to updateVideoRect. The main task of this function is to calculate the scale factors which are provided to the MMF via CVideoPlayerUtility::SetScaleFactorL. Note that: i) This function must be called both before and after the call to SetDisplayWindowL. For changes in aspect ratio or scale mode, setting the scale mode after updating the display window is sufficient. However, testing showed that, when switching in or out of full-screen mode, two calls were necessary in order to preserve the correct aspect ratio. ii) The screen rectangle passed to the MMF is still the full window extent; it is not the region in which video will actually be rendered. The post-processor will fill in the remainder of the window with a background colour (typically black). If, on the other hand, we passed in the actual video display rectangle, we would need to do this background painting in the widget. This in turn would require a change to QtGui: at present, we can only disable blitting on a per-widget basis (by setting QWExtra::disableBlit). If we needed to paint the borders of the video window, disableBlit would need to contain the actual DSA region, rather than just a single boolean flag. Task-number: QTBUG-5585 Reviewed-by: Frans Englich --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 4 - src/3rdparty/phonon/mmf/abstractmediaplayer.h | 2 - src/3rdparty/phonon/mmf/abstractplayer.cpp | 5 - src/3rdparty/phonon/mmf/abstractplayer.h | 4 - src/3rdparty/phonon/mmf/audiooutput.cpp | 20 +- src/3rdparty/phonon/mmf/audiooutput.h | 8 +- src/3rdparty/phonon/mmf/backend.cpp | 4 - src/3rdparty/phonon/mmf/mediaobject.cpp | 5 - src/3rdparty/phonon/mmf/mediaobject.h | 8 +- src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 335 +++++++++++++++--------- src/3rdparty/phonon/mmf/mmf_videoplayer.h | 28 +- src/3rdparty/phonon/mmf/videooutput.cpp | 135 ++++++++-- src/3rdparty/phonon/mmf/videooutput.h | 39 ++- src/3rdparty/phonon/mmf/videooutputobserver.h | 44 ---- src/3rdparty/phonon/mmf/videowidget.cpp | 25 +- src/3rdparty/phonon/mmf/videowidget.h | 7 +- src/3rdparty/phonon/mmf/volumeobserver.h | 44 ---- src/plugins/phonon/mmf/mmf.pro | 4 +- 18 files changed, 381 insertions(+), 340 deletions(-) delete mode 100644 src/3rdparty/phonon/mmf/videooutputobserver.h delete mode 100644 src/3rdparty/phonon/mmf/volumeobserver.h diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 4d7bc06..99e96cd 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -289,10 +289,6 @@ void MMF::AbstractMediaPlayer::setNextSource(const MediaSource &source) } -//----------------------------------------------------------------------------- -// VolumeObserver -//----------------------------------------------------------------------------- - void MMF::AbstractMediaPlayer::volumeChanged(qreal volume) { TRACE_CONTEXT(AbstractMediaPlayer::volumeChanged, EAudioInternal); diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index cff7bab..cb6e437 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -56,8 +56,6 @@ public: virtual MediaSource source() const; virtual void setFileSource(const Phonon::MediaSource&, RFile&); virtual void setNextSource(const MediaSource &source); - - // VolumeObserver virtual void volumeChanged(qreal volume); protected: diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp index d679e54..caf4092 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp @@ -92,11 +92,6 @@ void MMF::AbstractPlayer::setTransitionTime(qint32 time) m_transitionTime = time; } - -//----------------------------------------------------------------------------- -// VolumeObserver -//----------------------------------------------------------------------------- - void MMF::AbstractPlayer::volumeChanged(qreal volume) { m_volume = volume; diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index 66496cc..2e9cfa0 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -24,8 +24,6 @@ along with this library. If not, see . #include -#include "volumeobserver.h" - #include "videooutput.h" class RFile; @@ -49,7 +47,6 @@ class VideoOutput; * - Video, in which case the implementation is VideoPlayer */ class AbstractPlayer : public QObject - , public VolumeObserver { // Required although this class has no signals or slots // Without this, qobject_cast will fail @@ -85,7 +82,6 @@ public: virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0; virtual void setNextSource(const Phonon::MediaSource &) = 0; - // VolumeObserver virtual void volumeChanged(qreal volume); void setVideoOutput(VideoOutput* videoOutput); diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp index 82af9f1..d6e0c13 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.cpp +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -24,7 +24,6 @@ along with this library. If not, see . #include "defs.h" #include "mediaobject.h" #include "utils.h" -#include "volumeobserver.h" QT_BEGIN_NAMESPACE @@ -41,7 +40,6 @@ using namespace Phonon::MMF; MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : MediaNode(parent) , m_volume(InitialVolume) - , m_observer(0) { } @@ -59,12 +57,9 @@ qreal MMF::AudioOutput::volume() const void MMF::AudioOutput::setVolume(qreal volume) { TRACE_CONTEXT(AudioOutput::setVolume, EAudioApi); - TRACE_ENTRY("observer 0x%08x volume %f", m_observer, volume); + TRACE_ENTRY("volume %f", volume); if (volume != m_volume) { - if (m_observer) { - m_observer->volumeChanged(volume); - } m_volume = volume; TRACE("emit volumeChanged(%f)", volume) @@ -86,17 +81,12 @@ bool MMF::AudioOutput::setOutputDevice(int index) return true; } -void MMF::AudioOutput::setVolumeObserver(VolumeObserver* observer) -{ - m_observer = observer; - if (m_observer) { - m_observer->volumeChanged(m_volume); - } -} - bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo) { - setVolumeObserver(mo); + // Ensure that the MediaObject has the correct initial volume + mo->volumeChanged(m_volume); + // Connect MediaObject to receive future volume changes + connect(this, SIGNAL(volumeChanged(qreal)), mo, SLOT(volumeChanged(qreal))); return true; } diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h index d0ba086..1e1e134 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.h +++ b/src/3rdparty/phonon/mmf/audiooutput.h @@ -31,12 +31,11 @@ namespace Phonon namespace MMF { class Backend; -class VolumeObserver; /** * @short AudioOutputInterface implementation for MMF. * - * Forwards volume commands to the VolumeObserver instance, + * Forwards volume commands to the MediaObject instance, * which is provided by the backend when MediaNode objects are * connected. * @@ -82,13 +81,8 @@ Q_SIGNALS: void audioDeviceFailed(); private: - - void setVolumeObserver(VolumeObserver* observer); - qreal m_volume; - // Not owned - VolumeObserver* m_observer; }; } } diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index cac27e3..7e3a67f 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -38,10 +38,6 @@ QT_BEGIN_NAMESPACE using namespace Phonon; using namespace Phonon::MMF; -/*! \class MMF::VolumeObserver - \internal -*/ - /*! \class MMF::Backend \internal */ diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index f004fd7..e42e0fa 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -359,11 +359,6 @@ void MMF::MediaObject::setTransitionTime(qint32 time) m_player->setTransitionTime(time); } - -//----------------------------------------------------------------------------- -// VolumeObserver -//----------------------------------------------------------------------------- - void MMF::MediaObject::volumeChanged(qreal volume) { m_player->volumeChanged(volume); diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 409918d..ee94ea2 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -30,7 +30,6 @@ along with this library. If not, see . #include "abstractplayer.h" #include "mmf_medianode.h" #include "defs.h" -#include "volumeobserver.h" QT_BEGIN_NAMESPACE @@ -46,7 +45,6 @@ class VideoOutput; */ class MediaObject : public MediaNode , public MediaObjectInterface - , public VolumeObserver { Q_OBJECT Q_INTERFACES(Phonon::MediaObjectInterface) @@ -77,9 +75,6 @@ public: virtual qint32 transitionTime() const; virtual void setTransitionTime(qint32); - // VolumeObserver - void volumeChanged(qreal volume); - /** * This class owns the AbstractPlayer, and will delete it upon * destruction. @@ -90,6 +85,9 @@ public: virtual bool activateOnMediaObject(MediaObject *); +public Q_SLOTS: + void volumeChanged(qreal volume); + Q_SIGNALS: void totalTimeChanged(qint64 length); void hasVideoChanged(bool hasVideo); diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index ba7d005..2059fbe 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -49,7 +49,7 @@ MMF::VideoPlayer::VideoPlayer() , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) , m_window(0) , m_totalTime(0) - , m_mmfOutputChangePending(false) + , m_pendingChanges(false) { construct(); } @@ -60,7 +60,7 @@ MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player) , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) , m_window(0) , m_totalTime(0) - , m_mmfOutputChangePending(false) + , m_pendingChanges(false) { construct(); } @@ -70,24 +70,11 @@ void MMF::VideoPlayer::construct() TRACE_CONTEXT(VideoPlayer::VideoPlayer, EVideoApi); TRACE_ENTRY_0(); - if (m_videoOutput) - m_videoOutput->setObserver(this); + getVideoWindow(); const TInt priority = 0; const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone; - // Ignore return value - first call must always return true - getNativeWindowSystemHandles(); - - // TODO: is this the correct way to handle errors which occur when - // creating a Symbian object in the constructor of a Qt object? - - // TODO: check whether videoOutput is visible? If not, then the - // corresponding window will not be active, meaning that the - // clipping region will be set to empty and the video will not be - // visible. If this is the case, we should set m_mmfOutputChangePending - // and respond to future showEvents from the videoOutput widget. - TRAPD(err, m_player.reset(CVideoPlayerUtility::NewL ( @@ -95,7 +82,7 @@ void MMF::VideoPlayer::construct() priority, preference, m_wsSession, m_screenDevice, *m_window, - m_rect, m_rect + m_videoRect, m_videoRect )) ); @@ -110,8 +97,8 @@ MMF::VideoPlayer::~VideoPlayer() TRACE_CONTEXT(VideoPlayer::~VideoPlayer, EVideoApi); TRACE_ENTRY_0(); - if (m_videoOutput) - m_videoOutput->setObserver(0); + // QObject destructor removes all signal-slot connections involving this + // object, so we do not need to disconnect from m_videoOutput here. TRACE_EXIT_0(); } @@ -124,11 +111,7 @@ void MMF::VideoPlayer::doPlay() { TRACE_CONTEXT(VideoPlayer::doPlay, EVideoApi); - // See comment in updateMmfOutput - if (m_mmfOutputChangePending) { - TRACE_0("MMF output change pending - pushing now"); - updateMmfOutput(); - } + applyPendingChanges(); m_player->Play(); } @@ -255,13 +238,10 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError) maxVolumeChanged(m_player->MaxVolume()); if (m_videoOutput) - m_videoOutput->setFrameSize(m_frameSize); + m_videoOutput->setVideoSize(m_videoFrameSize); - // See comment in updateMmfOutput - if (m_mmfOutputChangePending) { - TRACE_0("MMF output change pending - pushing now"); - updateMmfOutput(); - } + updateVideoRect(); + applyPendingChanges(); emit totalTimeChanged(totalTime()); changeState(StoppedState); @@ -279,7 +259,7 @@ void MMF::VideoPlayer::doPrepareCompleteL(TInt aError) // Get frame size TSize size; m_player->VideoFrameSizeL(size); - m_frameSize = QSize(size.iWidth, size.iHeight); + m_videoFrameSize = QSize(size.iWidth, size.iHeight); // Get duration m_totalTime = toMilliSeconds(m_player->DurationL()); @@ -322,27 +302,178 @@ void MMF::VideoPlayer::MvpuoEvent(const TMMFEvent &aEvent) //----------------------------------------------------------------------------- -// VideoOutputObserver +// Video window updates //----------------------------------------------------------------------------- -void MMF::VideoPlayer::videoOutputRegionChanged() +void MMF::VideoPlayer::getVideoWindow() +{ + TRACE_CONTEXT(VideoPlayer::getVideoWindow, EVideoInternal); + TRACE_ENTRY_0(); + + if(m_videoOutput) { + // Dump information to log, only in debug builds + m_videoOutput->dump(); + + initVideoOutput(); + m_window = m_videoOutput->videoWindow(); + updateVideoRect(); + } else + // Top-level window + m_window = QApplication::activeWindow()->effectiveWinId()->DrawableWindow(); + + TRACE_EXIT_0(); +} + +void MMF::VideoPlayer::videoOutputChanged() +{ + TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal); + TRACE_ENTRY_0(); + + if (m_videoOutput) { + initVideoOutput(); + videoWindowChanged(); + } + + TRACE_EXIT_0(); +} + +void MMF::VideoPlayer::initVideoOutput() +{ + m_videoOutput->winId(); + m_videoOutput->setVideoSize(m_videoFrameSize); + + bool connected = connect( + m_videoOutput, SIGNAL(videoWindowChanged()), + this, SLOT(videoWindowChanged()) + ); + Q_ASSERT(connected); + + connected = connect( + m_videoOutput, SIGNAL(aspectRatioChanged()), + this, SLOT(aspectRatioChanged()) + ); + Q_ASSERT(connected); + + connected = connect( + m_videoOutput, SIGNAL(scaleModeChanged()), + this, SLOT(scaleModeChanged()) + ); + Q_ASSERT(connected); + + // Suppress warnings in release builds + Q_UNUSED(connected); +} + +void MMF::VideoPlayer::videoWindowChanged() { TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal); TRACE_ENTRY("state %d", state()); - const bool changed = getNativeWindowSystemHandles(); + m_window = m_videoOutput->videoWindow(); - // See comment in updateMmfOutput - if (changed) { - if (state() == LoadingState) - m_mmfOutputChangePending = true; - else - updateMmfOutput(); + updateVideoRect(); + + TRACE_EXIT_0(); +} + +// Helper function for aspect ratio / scale mode handling +QSize scaleToAspect(const QSize& srcRect, int aspectWidth, int aspectHeight) +{ + const qreal aspectRatio = qreal(aspectWidth) / aspectHeight; + + int width = srcRect.width(); + int height = srcRect.width() / aspectRatio; + if (height > srcRect.height()){ + height = srcRect.height(); + width = srcRect.height() * aspectRatio; } + return QSize(width, height); +} + +void MMF::VideoPlayer::updateVideoRect() +{ + QRect videoRect; + const QRect windowRect = m_videoOutput->videoWindowRect(); + const QSize windowSize = windowRect.size(); + + // Calculate size of smallest rect which contains video frame size + // and conforms to aspect ratio + switch (m_videoOutput->aspectRatio()) { + case Phonon::VideoWidget::AspectRatioAuto: + videoRect.setSize(m_videoFrameSize); + break; + + case Phonon::VideoWidget::AspectRatioWidget: + videoRect.setSize(windowSize); + break; + + case Phonon::VideoWidget::AspectRatio4_3: + videoRect.setSize(scaleToAspect(m_videoFrameSize, 4, 3)); + break; + + case Phonon::VideoWidget::AspectRatio16_9: + videoRect.setSize(scaleToAspect(m_videoFrameSize, 16, 9)); + break; + } + + // Scale to fill the window width + const int windowWidth = windowSize.width(); + const int windowHeight = windowSize.height(); + const qreal windowScaleFactor = qreal(windowWidth) / videoRect.width(); + int videoWidth = windowWidth; + int videoHeight = videoRect.height() * windowScaleFactor; + + const qreal windowToVideoHeightRatio = qreal(windowHeight) / videoHeight; + + switch(m_videoOutput->scaleMode()) { + case Phonon::VideoWidget::ScaleAndCrop: + if(videoHeight < windowHeight) { + videoWidth *= windowToVideoHeightRatio; + videoHeight = windowHeight; + } + break; + case Phonon::VideoWidget::FitInView: + default: + if(videoHeight > windowHeight) { + videoWidth *= windowToVideoHeightRatio; + videoHeight = windowHeight; + } + break; + } + + // Calculate scale factors + m_scaleWidth = 100.0f * videoWidth / m_videoFrameSize.width(); + m_scaleHeight = 100.0f * videoHeight / m_videoFrameSize.height(); + + m_videoRect = qt_QRect2TRect(windowRect); + + if (state() == LoadingState) + m_pendingChanges = true; + else { + applyVideoWindowChange(); + m_pendingChanges = false; + } +} + +void MMF::VideoPlayer::aspectRatioChanged() +{ + TRACE_CONTEXT(VideoPlayer::aspectRatioChanged, EVideoInternal); + TRACE_ENTRY("state %d aspectRatio %d", state()); + + updateVideoRect(); TRACE_EXIT_0(); } +void MMF::VideoPlayer::scaleModeChanged() +{ + TRACE_CONTEXT(VideoPlayer::scaleModeChanged, EVideoInternal); + TRACE_ENTRY("state %d", state()); + + updateVideoRect(); + + TRACE_EXIT_0(); +} #ifndef QT_NO_DEBUG @@ -383,113 +514,61 @@ void getDsaRegion(RWsSession &session, const RWindowBase &window) #endif // _DEBUG -void MMF::VideoPlayer::updateMmfOutput() +void MMF::VideoPlayer::applyPendingChanges() { - TRACE_CONTEXT(VideoPlayer::updateMmfOutput, EVideoInternal); - TRACE_ENTRY_0(); + if(m_pendingChanges) + applyVideoWindowChange(); - // Calling SetDisplayWindowL is a no-op unless the MMF controller has - // been loaded, so we shouldn't do it. Instead, the - // m_mmfOutputChangePending flag is used to record the fact that we - // need to call SetDisplayWindowL, and this is checked in - // MvpuoPrepareComplete, at which point the MMF controller has been - // loaded. + m_pendingChanges = false; +} + +void MMF::VideoPlayer::applyVideoWindowChange() +{ + TRACE_CONTEXT(VideoPlayer::applyVideoWindowChange, EVideoInternal); + TRACE_ENTRY_0(); #ifndef QT_NO_DEBUG getDsaRegion(m_wsSession, *m_window); #endif - TRAPD(err, - m_player->SetDisplayWindowL - ( - m_wsSession, m_screenDevice, - *m_window, - m_rect, m_rect - ) - ); + static const TBool antialias = ETrue; - if (KErrNone != err) { - TRACE("SetDisplayWindowL error %d", err); + TRAPD(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, antialias)); + if(KErrNone != err) { + TRACE("SetScaleFactorL (1) err %d", err); setError(NormalError); } - m_mmfOutputChangePending = false; + if(KErrNone == err) { + TRAP(err, + m_player->SetDisplayWindowL + ( + m_wsSession, m_screenDevice, + *m_window, + m_videoRect, m_videoRect + ) + ); + + if (KErrNone != err) { + TRACE("SetDisplayWindowL err %d", err); + setError(NormalError); + } else { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, antialias)); + if(KErrNone != err) { + TRACE("SetScaleFactorL (2) err %d", err); + setError(NormalError); + } + } + } TRACE_EXIT_0(); } //----------------------------------------------------------------------------- -// Private functions +// Metadata //----------------------------------------------------------------------------- -void MMF::VideoPlayer::videoOutputChanged() -{ - TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal); - TRACE_ENTRY_0(); - - if (m_videoOutput) { - m_videoOutput->setObserver(this); - m_videoOutput->setFrameSize(m_frameSize); - } - - videoOutputRegionChanged(); - - TRACE_EXIT_0(); -} - -bool MMF::VideoPlayer::getNativeWindowSystemHandles() -{ - TRACE_CONTEXT(VideoPlayer::getNativeWindowSystemHandles, EVideoInternal); - TRACE_ENTRY_0(); - - CCoeControl *control = 0; - - if (m_videoOutput) - // Create native window - control = m_videoOutput->winId(); - else - // Get top-level window - control = QApplication::activeWindow()->effectiveWinId(); - -#ifndef QT_NO_DEBUG - if (m_videoOutput) { - QScopedPointer dumper(new ObjectDump::QDumper); - dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs - ObjectDump::addDefaultAnnotators(*dumper); - TRACE_0("Dumping VideoOutput:"); - dumper->dumpObject(*m_videoOutput); - } - else { - TRACE_0("m_videoOutput is null - dumping top-level control info:"); - TRACE("control %08x", control); - TRACE("control.parent %08x", control->Parent()); - TRACE("control.isVisible %d", control->IsVisible()); - TRACE("control.rect %d,%d %dx%d", - control->Position().iX, control->Position().iY, - control->Size().iWidth, control->Size().iHeight); - TRACE("control.ownsWindow %d", control->OwnsWindow()); - } -#endif - - RWindowBase *const window = control->DrawableWindow(); - const TRect rect(window->AbsPosition(), window->Size()); - - TRACE("rect %d %d - %d %d", - rect.iTl.iX, rect.iTl.iY, - rect.iBr.iX, rect.iBr.iY); - - bool changed = false; - - if (window != m_window || rect != m_rect) { - m_window = window; - m_rect = rect; - changed = true; - } - - TRACE_RETURN("changed %d", changed); -} - int MMF::VideoPlayer::numberOfMetaDataEntries() const { int numberOfEntries = 0; diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index fa4e59b..599bb88 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -23,7 +23,6 @@ along with this library. If not, see . #include "abstractmediaplayer.h" #include "videooutput.h" -#include "videooutputobserver.h" QT_BEGIN_NAMESPACE @@ -40,7 +39,6 @@ namespace MMF */ class VideoPlayer : public AbstractMediaPlayer , public MVideoPlayerUtilityObserver - , public VideoOutputObserver { Q_OBJECT @@ -70,8 +68,10 @@ public: virtual void MvpuoPlayComplete(TInt aError); virtual void MvpuoEvent(const TMMFEvent &aEvent); - // VideoOutputObserver - virtual void videoOutputRegionChanged(); +public Q_SLOTS: + void videoWindowChanged(); + void aspectRatioChanged(); + void scaleModeChanged(); private: void construct(); @@ -81,10 +81,13 @@ private: // AbstractPlayer virtual void videoOutputChanged(); - // Returns true if handles have changed - bool getNativeWindowSystemHandles(); + void getVideoWindow(); + void initVideoOutput(); - void updateMmfOutput(); + void updateVideoRect(); + + void applyPendingChanges(); + void applyVideoWindowChange(); // AbstractMediaPlayer virtual int numberOfMetaDataEntries() const; @@ -97,12 +100,17 @@ private: RWsSession& m_wsSession; CWsScreenDevice& m_screenDevice; RWindowBase* m_window; - TRect m_rect; - QSize m_frameSize; + /* Extent of the video display - will be clipped to m_windowRect */ + TRect m_videoRect; + + TReal32 m_scaleWidth; + TReal32 m_scaleHeight; + + QSize m_videoFrameSize; qint64 m_totalTime; - bool m_mmfOutputChangePending; + bool m_pendingChanges; }; diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 5288b4d..6b6f71a 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -19,7 +19,6 @@ along with this library. If not, see . #include "ancestormovemonitor.h" #include "utils.h" #include "videooutput.h" -#include "videooutputobserver.h" #ifndef QT_NO_DEBUG #include "objectdump.h" @@ -30,8 +29,11 @@ along with this library. If not, see . #include #include +#include // for qt_TRect2QRect #include // to access QWExtra +#include + QT_BEGIN_NAMESPACE using namespace Phonon; @@ -42,6 +44,16 @@ using namespace Phonon::MMF; */ //----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio = + Phonon::VideoWidget::AspectRatioAuto; +static const Phonon::VideoWidget::ScaleMode DefaultScaleMode = + Phonon::VideoWidget::FitInView; + + +//----------------------------------------------------------------------------- // Constructor / destructor //----------------------------------------------------------------------------- @@ -49,7 +61,8 @@ MMF::VideoOutput::VideoOutput (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : QWidget(parent) , m_ancestorMoveMonitor(ancestorMoveMonitor) - , m_observer(0) + , m_aspectRatio(DefaultAspectRatio) + , m_scaleMode(DefaultScaleMode) { TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal); TRACE_ENTRY("parent 0x%08x", parent); @@ -66,6 +79,7 @@ MMF::VideoOutput::VideoOutput // to be invisible when running on the target device. qt_widget_private(this)->extraData()->disableBlit = true; + getVideoWindowRect(); registerForAncestorMoved(); dump(); @@ -83,33 +97,35 @@ MMF::VideoOutput::~VideoOutput() TRACE_EXIT_0(); } -void MMF::VideoOutput::setFrameSize(const QSize& frameSize) +void MMF::VideoOutput::setVideoSize(const QSize& frameSize) { - TRACE_CONTEXT(VideoOutput::setFrameSize, EVideoInternal); + TRACE_CONTEXT(VideoOutput::setVideoSize, EVideoInternal); TRACE("oldSize %d %d newSize %d %d", - m_frameSize.width(), m_frameSize.height(), + m_videoFrameSize.width(), m_videoFrameSize.height(), frameSize.width(), frameSize.height()); - if (frameSize != m_frameSize) { - m_frameSize = frameSize; + if (frameSize != m_videoFrameSize) { + m_videoFrameSize = frameSize; updateGeometry(); } } -void MMF::VideoOutput::setObserver(VideoOutputObserver* observer) -{ - TRACE_CONTEXT(VideoOutput::setObserver, EVideoInternal); - TRACE("observer 0x%08x", observer); - - m_observer = observer; -} - void MMF::VideoOutput::ancestorMoved() { TRACE_CONTEXT(VideoOutput::ancestorMoved, EVideoInternal); TRACE_ENTRY_0(); - videoOutputRegionChanged(); + RWindowBase *const window = videoWindow(); + + if(window) { + const TPoint newWindowPosSymbian = window->AbsPosition(); + const QPoint newWindowPos(newWindowPosSymbian.iX, newWindowPosSymbian.iY); + + if(newWindowPos != m_videoWindowRect.topLeft()) { + m_videoWindowRect.moveTo(newWindowPos); + emit videoWindowChanged(); + } + } TRACE_EXIT_0(); } @@ -123,9 +139,8 @@ QSize MMF::VideoOutput::sizeHint() const // TODO: replace this with a more sensible default QSize result(320, 240); - if (!m_frameSize.isNull()) { - result = m_frameSize; - } + if (!m_videoFrameSize.isNull()) + result = m_videoFrameSize; return result; } @@ -149,7 +164,10 @@ void MMF::VideoOutput::resizeEvent(QResizeEvent* event) event->oldSize().width(), event->oldSize().height(), event->size().width(), event->size().height()); - videoOutputRegionChanged(); + if(event->size() != event->oldSize()) { + m_videoWindowRect.setSize(event->size()); + emit videoWindowChanged(); + } } void MMF::VideoOutput::moveEvent(QMoveEvent* event) @@ -159,7 +177,10 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event) event->oldPos().x(), event->oldPos().y(), event->pos().x(), event->pos().y()); - videoOutputRegionChanged(); + if(event->pos() != event->oldPos()) { + m_videoWindowRect.moveTo(event->pos()); + emit videoWindowChanged(); + } } bool MMF::VideoOutput::event(QEvent* event) @@ -168,7 +189,8 @@ bool MMF::VideoOutput::event(QEvent* event) if (event->type() == QEvent::WinIdChange) { TRACE_0("WinIdChange"); - videoOutputRegionChanged(); + getVideoWindowRect(); + emit videoWindowChanged(); return true; } else if (event->type() == QEvent::ParentChange) { // Tell ancestor move monitor to update ancestor list for this widget @@ -180,14 +202,66 @@ bool MMF::VideoOutput::event(QEvent* event) //----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +RWindowBase* MMF::VideoOutput::videoWindow() +{ + CCoeControl *control = internalWinId(); + if(!control) + control = effectiveWinId(); + + RWindowBase *window = 0; + if(control) + window = control->DrawableWindow(); + + return window; +} + +const QRect& MMF::VideoOutput::videoWindowRect() const +{ + return m_videoWindowRect; +} + +Phonon::VideoWidget::AspectRatio MMF::VideoOutput::aspectRatio() const +{ + return m_aspectRatio; +} + +void MMF::VideoOutput::setAspectRatio + (Phonon::VideoWidget::AspectRatio aspectRatio) +{ + if(m_aspectRatio != aspectRatio) { + m_aspectRatio = aspectRatio; + emit aspectRatioChanged(); + } +} + +Phonon::VideoWidget::ScaleMode MMF::VideoOutput::scaleMode() const +{ + return m_scaleMode; +} + +void MMF::VideoOutput::setScaleMode + (Phonon::VideoWidget::ScaleMode scaleMode) +{ + if(m_scaleMode != scaleMode) { + m_scaleMode = scaleMode; + emit scaleModeChanged(); + } +} + + +//----------------------------------------------------------------------------- // Private functions //----------------------------------------------------------------------------- -void MMF::VideoOutput::videoOutputRegionChanged() +void MMF::VideoOutput::getVideoWindowRect() { - dump(); - if (m_observer) - m_observer->videoOutputRegionChanged(); + RWindowBase *const window = videoWindow(); + if(window) + m_videoWindowRect = + qt_TRect2QRect(TRect(window->AbsPosition(), window->Size())); } void MMF::VideoOutput::registerForAncestorMoved() @@ -199,15 +273,20 @@ void MMF::VideoOutput::dump() const { #ifndef QT_NO_DEBUG TRACE_CONTEXT(VideoOutput::dump, EVideoInternal); + QScopedPointer visitor(new ObjectDump::QVisitor); visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs ObjectDump::addDefaultAnnotators(*visitor); TRACE("Dumping tree from leaf 0x%08x:", this); - //ObjectDump::dumpAncestors(*this, *visitor); ObjectDump::dumpTreeFromLeaf(*this, *visitor); + + QScopedPointer dumper(new ObjectDump::QDumper); + dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs + ObjectDump::addDefaultAnnotators(*dumper); + TRACE_0("Dumping VideoOutput:"); + dumper->dumpObject(*this); #endif } - QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index db4d127..6dfe69d 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -24,6 +24,11 @@ along with this library. If not, see . #include #include "defs.h" +#include + +#include +class RWindowBase; + QT_BEGIN_NAMESPACE namespace Phonon @@ -31,7 +36,6 @@ namespace Phonon namespace MMF { class AncestorMoveMonitor; -class VideoOutputObserver; class VideoOutput : public QWidget { @@ -41,11 +45,29 @@ public: VideoOutput(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); ~VideoOutput(); - void setFrameSize(const QSize& size); - void setObserver(VideoOutputObserver* observer); + // Set size of video frame. Called by VideoPlayer. + void setVideoSize(const QSize& size); + + RWindowBase* videoWindow(); + const QRect& videoWindowRect() const; + Phonon::VideoWidget::AspectRatio aspectRatio() const; + void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio); + + Phonon::VideoWidget::ScaleMode scaleMode() const; + void setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode); + + // Called by AncestorMoveMonitor void ancestorMoved(); + // Debugging output + void dump() const; + +Q_SIGNALS: + void videoWindowChanged(); + void aspectRatioChanged(); + void scaleModeChanged(); + protected: // Override QWidget functions QSize sizeHint() const; @@ -55,19 +77,18 @@ protected: bool event(QEvent* event); private: - void dump() const; - void videoOutputRegionChanged(); - + void getVideoWindowRect(); void registerForAncestorMoved(); private: // Not owned AncestorMoveMonitor* m_ancestorMoveMonitor; - // Not owned - VideoOutputObserver* m_observer; + QSize m_videoFrameSize; + QRect m_videoWindowRect; - QSize m_frameSize; + Phonon::VideoWidget::AspectRatio m_aspectRatio; + Phonon::VideoWidget::ScaleMode m_scaleMode; }; } diff --git a/src/3rdparty/phonon/mmf/videooutputobserver.h b/src/3rdparty/phonon/mmf/videooutputobserver.h deleted file mode 100644 index e3ba305..0000000 --- a/src/3rdparty/phonon/mmf/videooutputobserver.h +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 . - -*/ - -#ifndef PHONON_MMF_VIDEOOUTPUTOBSERVER_H -#define PHONON_MMF_VIDEOOUTPUTOBSERVER_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Phonon -{ -namespace MMF -{ -/** - * Interface via which VideoOutput notifies VideoPlayer of changes to the - * video output screen region. - */ -class VideoOutputObserver -{ -public: - virtual void videoOutputRegionChanged() = 0; -}; -} -} - -QT_END_NAMESPACE - -#endif diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 7d7abf1..bd22307 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -35,11 +35,7 @@ using namespace Phonon::MMF; // Constants //----------------------------------------------------------------------------- -static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio = - Phonon::VideoWidget::AspectRatioAuto; static const qreal DefaultBrightness = 1.0; -static const Phonon::VideoWidget::ScaleMode DefaultScaleMode = - Phonon::VideoWidget::FitInView; static const qreal DefaultContrast = 1.0; static const qreal DefaultHue = 1.0; static const qreal DefaultSaturation = 1.0; @@ -52,10 +48,8 @@ static const qreal DefaultSaturation = 1.0; MMF::VideoWidget::VideoWidget (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : MediaNode(parent) - , m_widget(new VideoOutput(ancestorMoveMonitor, parent)) - , m_aspectRatio(DefaultAspectRatio) + , m_videoOutput(new VideoOutput(ancestorMoveMonitor, parent)) , m_brightness(DefaultBrightness) - , m_scaleMode(DefaultScaleMode) , m_contrast(DefaultContrast) , m_hue(DefaultHue) , m_saturation(DefaultSaturation) @@ -81,7 +75,7 @@ MMF::VideoWidget::~VideoWidget() Phonon::VideoWidget::AspectRatio MMF::VideoWidget::aspectRatio() const { - return m_aspectRatio; + return m_videoOutput->aspectRatio(); } void MMF::VideoWidget::setAspectRatio @@ -90,7 +84,7 @@ void MMF::VideoWidget::setAspectRatio TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi); TRACE("aspectRatio %d", aspectRatio); - m_aspectRatio = aspectRatio; + m_videoOutput->setAspectRatio(aspectRatio); } qreal MMF::VideoWidget::brightness() const @@ -108,7 +102,7 @@ void MMF::VideoWidget::setBrightness(qreal brightness) Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const { - return m_scaleMode; + return m_videoOutput->scaleMode(); } void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode) @@ -116,7 +110,7 @@ void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode) TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi); TRACE("setScaleMode %d", setScaleMode); - m_scaleMode = scaleMode; + m_videoOutput->setScaleMode(scaleMode); } qreal MMF::VideoWidget::contrast() const @@ -160,17 +154,12 @@ void MMF::VideoWidget::setSaturation(qreal saturation) QWidget* MMF::VideoWidget::widget() { - return m_widget.data(); -} - -VideoOutput& MMF::VideoWidget::videoOutput() -{ - return *static_cast(widget()); + return m_videoOutput.data(); } bool MMF::VideoWidget::activateOnMediaObject(MediaObject *mo) { - mo->setVideoOutput(&videoOutput()); + mo->setVideoOutput(m_videoOutput.data()); return true; } diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h index 318dfae..2f0978b 100644 --- a/src/3rdparty/phonon/mmf/videowidget.h +++ b/src/3rdparty/phonon/mmf/videowidget.h @@ -20,6 +20,7 @@ along with this library. If not, see . #define PHONON_MMF_VIDEOWIDGET_H #include "mmf_medianode.h" +#include "videooutput.h" #include #include @@ -59,17 +60,13 @@ public: virtual void setSaturation(qreal saturation); virtual QWidget *widget(); - VideoOutput& videoOutput(); - protected: virtual bool activateOnMediaObject(MediaObject *mo); private: - QScopedPointer m_widget; + QScopedPointer m_videoOutput; - Phonon::VideoWidget::AspectRatio m_aspectRatio; qreal m_brightness; - Phonon::VideoWidget::ScaleMode m_scaleMode; qreal m_contrast; qreal m_hue; qreal m_saturation; diff --git a/src/3rdparty/phonon/mmf/volumeobserver.h b/src/3rdparty/phonon/mmf/volumeobserver.h deleted file mode 100644 index bedd3de..0000000 --- a/src/3rdparty/phonon/mmf/volumeobserver.h +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 . - -*/ - -#ifndef PHONON_MMF_VOLUMEOBSERVER_H -#define PHONON_MMF_VOLUMEOBSERVER_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Phonon -{ -namespace MMF -{ -/** - * Interface used by AudioOutput to pass volume control commands - * back along the audio path to the MediaObject. - */ -class VolumeObserver -{ -public: - virtual void volumeChanged(qreal volume) = 0; -}; -} -} - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 8522c06..c070605 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -43,9 +43,7 @@ HEADERS += \ $$PHONON_MMF_DIR/objecttree.h \ $$PHONON_MMF_DIR/utils.h \ $$PHONON_MMF_DIR/videooutput.h \ - $$PHONON_MMF_DIR/videooutputobserver.h \ - $$PHONON_MMF_DIR/videowidget.h \ - $$PHONON_MMF_DIR/volumeobserver.h + $$PHONON_MMF_DIR/videowidget.h SOURCES += \ $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ -- cgit v0.12