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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -127,6 +127,11 @@ QGstreamerPlayerControl::~QGstreamerPlayerControl()
|
||||
}
|
||||
}
|
||||
|
||||
QMediaPlayerResourceSetInterface* QGstreamerPlayerControl::resources() const
|
||||
{
|
||||
return m_resources;
|
||||
}
|
||||
|
||||
qint64 QGstreamerPlayerControl::position() const
|
||||
{
|
||||
return m_seekToStartPending ? 0 : m_session->position();
|
||||
|
||||
@@ -97,6 +97,8 @@ public:
|
||||
bool isMediaDownloadEnabled() const;
|
||||
void setMediaDownloadEnabled(bool enabled);
|
||||
|
||||
QMediaPlayerResourceSetInterface* resources() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setPosition(qint64 pos);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user