summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLing Hu <ling.hu@nokia.com>2012-03-21 15:22:58 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-23 09:53:54 +0100
commit7e877a76db3ae2941b3f4d812bbf7faf24831bf7 (patch)
tree7c330731a0281eb4ab4a7c2821a736a7dfdbd2a8
parent138242fb2dc19438a0ead34b36af848800e27190 (diff)
Implemented availability control for gstreamer player backend
Change-Id: I6d736b90ad59e258eb6f20befea8cfe1afce423a Reviewed-by: Michael Goddard <michael.goddard@nokia.com> Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
-rw-r--r--src/plugins/gstreamer/mediaplayer/mediaplayer.pri6
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp66
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h67
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp5
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h2
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp5
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h2
7 files changed, 151 insertions, 2 deletions
diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.pri b/src/plugins/gstreamer/mediaplayer/mediaplayer.pri
index fcfbd063b..02551f731 100644
--- a/src/plugins/gstreamer/mediaplayer/mediaplayer.pri
+++ b/src/plugins/gstreamer/mediaplayer/mediaplayer.pri
@@ -7,13 +7,15 @@ HEADERS += \
$$PWD/qgstreamerplayerservice.h \
$$PWD/qgstreamerplayersession.h \
$$PWD/qgstreamerstreamscontrol.h \
- $$PWD/qgstreamermetadataprovider.h
+ $$PWD/qgstreamermetadataprovider.h \
+ $$PWD/qgstreameravailabilitycontrol.h
SOURCES += \
$$PWD/qgstreamerplayercontrol.cpp \
$$PWD/qgstreamerplayerservice.cpp \
$$PWD/qgstreamerplayersession.cpp \
$$PWD/qgstreamerstreamscontrol.cpp \
- $$PWD/qgstreamermetadataprovider.cpp
+ $$PWD/qgstreamermetadataprovider.cpp \
+ $$PWD/qgstreameravailabilitycontrol.cpp
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp
new file mode 100644
index 000000000..96cdf0512
--- /dev/null
+++ b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgstreameravailabilitycontrol.h"
+#include <private/qmediaresourceset_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QGStreamerAvailabilityControl::QGStreamerAvailabilityControl(
+ QMediaPlayerResourceSetInterface *resources, QObject *parent)
+ : QMediaAvailabilityControl(parent)
+ , m_resources(resources)
+{
+ Q_ASSERT(m_resources);
+ connect(m_resources, SIGNAL(availabilityChanged(bool)), this, SLOT(handleAvailabilityChanged()));
+}
+
+void QGStreamerAvailabilityControl::handleAvailabilityChanged()
+{
+ emit availabilityChanged(this->availability());
+}
+
+QtMultimedia::AvailabilityError QGStreamerAvailabilityControl::availability() const
+{
+ return m_resources->isAvailable() ? QtMultimedia::NoError : QtMultimedia::BusyError;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h
new file mode 100644
index 000000000..36959559d
--- /dev/null
+++ b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGSTREAMERAVAILABILITYCONTROL_H
+#define QGSTREAMERAVAILABILITYCONTROL_H
+
+#include <QObject>
+#include <qmediaavailabilitycontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class QMediaPlayerResourceSetInterface;
+class QGStreamerAvailabilityControl : public QMediaAvailabilityControl
+{
+ Q_OBJECT
+public:
+ QGStreamerAvailabilityControl(QMediaPlayerResourceSetInterface *resources, QObject *parent = 0);
+ QtMultimedia::AvailabilityError availability() const;
+
+private Q_SLOTS:
+ void handleAvailabilityChanged();
+
+private:
+ QMediaPlayerResourceSetInterface *m_resources;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGSTREAMERAVAILABILITYCONTROL_H
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
index 19476b497..2aee1e387 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
@@ -127,6 +127,11 @@ QGstreamerPlayerControl::~QGstreamerPlayerControl()
}
}
+QMediaPlayerResourceSetInterface* QGstreamerPlayerControl::resources() const
+{
+ return m_resources;
+}
+
qint64 QGstreamerPlayerControl::position() const
{
return m_seekToStartPending ? 0 : m_session->position();
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h
index b575d1d1b..a9b1c8487 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h
@@ -97,6 +97,8 @@ public:
bool isMediaDownloadEnabled() const;
void setMediaDownloadEnabled(bool enabled);
+ QMediaPlayerResourceSetInterface* resources() const;
+
public Q_SLOTS:
void setPosition(qint64 pos);
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
index 01bb0ed60..54dedf472 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
@@ -50,6 +50,7 @@
#include "qgstreamerplayercontrol.h"
#include "qgstreamerplayersession.h"
#include "qgstreamermetadataprovider.h"
+#include "qgstreameravailabilitycontrol.h"
#if defined(HAVE_WIDGETS)
#include "qgstreamervideooverlay.h"
@@ -85,6 +86,7 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent):
m_control = new QGstreamerPlayerControl(m_session, this);
m_metaData = new QGstreamerMetaDataProvider(m_session, this);
m_streamsControl = new QGstreamerStreamsControl(m_session,this);
+ m_availabilityControl = new QGStreamerAvailabilityControl(m_control->resources(), this);
#if defined(Q_WS_MAEMO_6) && defined(__arm__)
m_videoRenderer = new QGstreamerGLTextureRenderer(this);
@@ -117,6 +119,9 @@ QMediaControl *QGstreamerPlayerService::requestControl(const char *name)
if (qstrcmp(name,QMediaStreamsControl_iid) == 0)
return m_streamsControl;
+ if (qstrcmp(name, QMediaAvailabilityControl_iid) == 0)
+ return m_availabilityControl;
+
if (qstrcmp(name,QMediaVideoProbeControl_iid) == 0) {
if (m_session) {
QGstreamerVideoProbeControl *probe = new QGstreamerVideoProbeControl(this);
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
index fa1661026..57e023d14 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
@@ -61,6 +61,7 @@ class QGstreamerStreamsControl;
class QGstreamerVideoRenderer;
class QGstreamerVideoOverlay;
class QGstreamerVideoWidgetControl;
+class QGStreamerAvailabilityControl;
class QGstreamerPlayerService : public QMediaService
{
@@ -77,6 +78,7 @@ private:
QGstreamerPlayerSession *m_session;
QGstreamerMetaDataProvider *m_metaData;
QGstreamerStreamsControl *m_streamsControl;
+ QGStreamerAvailabilityControl *m_availabilityControl;
QMediaControl *m_videoOutput;
QMediaControl *m_videoRenderer;