Blackberry: Add support for reading meta data in QMediaPlayer
Provide an implementation of QMetaDataReaderControl for the QMediaPlayer. Change-Id: I58c04e40ae3f07013450997410d0a379273c7bde Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
This commit is contained in:
committed by
The Qt Project
parent
01436abd3d
commit
0ce2cb3ebe
@@ -39,6 +39,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "bbmediaplayercontrol.h"
|
#include "bbmediaplayercontrol.h"
|
||||||
|
#include "bbmetadatareadercontrol.h"
|
||||||
#include "bbvideowindowcontrol.h"
|
#include "bbvideowindowcontrol.h"
|
||||||
#include "bbutil.h"
|
#include "bbutil.h"
|
||||||
#include <QtCore/qabstracteventdispatcher.h>
|
#include <QtCore/qabstracteventdispatcher.h>
|
||||||
@@ -515,6 +516,11 @@ void BbMediaPlayerControl::setVideoControl(BbVideoWindowControl *videoControl)
|
|||||||
m_videoControl = videoControl;
|
m_videoControl = videoControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BbMediaPlayerControl::setMetaDataReaderControl(BbMetaDataReaderControl *metaDataReaderControl)
|
||||||
|
{
|
||||||
|
m_metaDataReaderControl = metaDataReaderControl;
|
||||||
|
}
|
||||||
|
|
||||||
bool BbMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
|
bool BbMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
|
||||||
{
|
{
|
||||||
Q_UNUSED(eventType);
|
Q_UNUSED(eventType);
|
||||||
@@ -592,6 +598,9 @@ void BbMediaPlayerControl::updateMetaData()
|
|||||||
if (m_videoControl)
|
if (m_videoControl)
|
||||||
m_videoControl->setMetaData(m_metaData);
|
m_videoControl->setMetaData(m_metaData);
|
||||||
|
|
||||||
|
if (m_metaDataReaderControl)
|
||||||
|
m_metaDataReaderControl->setMetaData(m_metaData);
|
||||||
|
|
||||||
emit durationChanged(m_metaData.duration());
|
emit durationChanged(m_metaData.duration());
|
||||||
emit audioAvailableChanged(m_metaData.hasAudio());
|
emit audioAvailableChanged(m_metaData.hasAudio());
|
||||||
emit videoAvailableChanged(m_metaData.hasVideo());
|
emit videoAvailableChanged(m_metaData.hasVideo());
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ typedef struct mmrenderer_monitor mmrenderer_monitor_t;
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class BbMetaDataReaderControl;
|
||||||
class BbVideoWindowControl;
|
class BbVideoWindowControl;
|
||||||
|
|
||||||
class BbMediaPlayerControl : public QMediaPlayerControl, public QAbstractNativeEventFilter
|
class BbMediaPlayerControl : public QMediaPlayerControl, public QAbstractNativeEventFilter
|
||||||
@@ -99,6 +100,7 @@ public:
|
|||||||
void stop() Q_DECL_OVERRIDE;
|
void stop() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void setVideoControl(BbVideoWindowControl *videoControl);
|
void setVideoControl(BbVideoWindowControl *videoControl);
|
||||||
|
void setMetaDataReaderControl(BbMetaDataReaderControl *metaDataReaderControl);
|
||||||
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
|
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
@@ -137,6 +139,7 @@ private:
|
|||||||
bool m_muted;
|
bool m_muted;
|
||||||
qreal m_rate;
|
qreal m_rate;
|
||||||
QPointer<BbVideoWindowControl> m_videoControl;
|
QPointer<BbVideoWindowControl> m_videoControl;
|
||||||
|
QPointer<BbMetaDataReaderControl> m_metaDataReaderControl;
|
||||||
BbMetaData m_metaData;
|
BbMetaData m_metaData;
|
||||||
int m_id;
|
int m_id;
|
||||||
mmrenderer_monitor_t *m_eventMonitor;
|
mmrenderer_monitor_t *m_eventMonitor;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "bbmediaplayerservice.h"
|
#include "bbmediaplayerservice.h"
|
||||||
|
|
||||||
#include "bbmediaplayercontrol.h"
|
#include "bbmediaplayercontrol.h"
|
||||||
|
#include "bbmetadatareadercontrol.h"
|
||||||
#include "bbvideowindowcontrol.h"
|
#include "bbvideowindowcontrol.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -48,7 +49,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
BbMediaPlayerService::BbMediaPlayerService(QObject *parent)
|
BbMediaPlayerService::BbMediaPlayerService(QObject *parent)
|
||||||
: QMediaService(parent),
|
: QMediaService(parent),
|
||||||
m_videoWindowControl(0),
|
m_videoWindowControl(0),
|
||||||
m_mediaPlayerControl(0)
|
m_mediaPlayerControl(0),
|
||||||
|
m_metaDataReaderControl(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +70,13 @@ QMediaControl *BbMediaPlayerService::requestControl(const char *name)
|
|||||||
}
|
}
|
||||||
return m_mediaPlayerControl;
|
return m_mediaPlayerControl;
|
||||||
}
|
}
|
||||||
|
else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
|
||||||
|
if (!m_metaDataReaderControl) {
|
||||||
|
m_metaDataReaderControl = new BbMetaDataReaderControl();
|
||||||
|
updateControls();
|
||||||
|
}
|
||||||
|
return m_metaDataReaderControl;
|
||||||
|
}
|
||||||
else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
|
else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
|
||||||
if (!m_videoWindowControl) {
|
if (!m_videoWindowControl) {
|
||||||
m_videoWindowControl = new BbVideoWindowControl();
|
m_videoWindowControl = new BbVideoWindowControl();
|
||||||
@@ -84,6 +93,8 @@ void BbMediaPlayerService::releaseControl(QMediaControl *control)
|
|||||||
m_videoWindowControl = 0;
|
m_videoWindowControl = 0;
|
||||||
if (control == m_mediaPlayerControl)
|
if (control == m_mediaPlayerControl)
|
||||||
m_mediaPlayerControl = 0;
|
m_mediaPlayerControl = 0;
|
||||||
|
if (control == m_metaDataReaderControl)
|
||||||
|
m_metaDataReaderControl = 0;
|
||||||
delete control;
|
delete control;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +102,9 @@ void BbMediaPlayerService::updateControls()
|
|||||||
{
|
{
|
||||||
if (m_videoWindowControl && m_mediaPlayerControl)
|
if (m_videoWindowControl && m_mediaPlayerControl)
|
||||||
m_mediaPlayerControl->setVideoControl(m_videoWindowControl);
|
m_mediaPlayerControl->setVideoControl(m_videoWindowControl);
|
||||||
|
|
||||||
|
if (m_metaDataReaderControl && m_mediaPlayerControl)
|
||||||
|
m_mediaPlayerControl->setMetaDataReaderControl(m_metaDataReaderControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class BbMediaPlayerControl;
|
class BbMediaPlayerControl;
|
||||||
|
class BbMetaDataReaderControl;
|
||||||
class BbVideoWindowControl;
|
class BbVideoWindowControl;
|
||||||
|
|
||||||
class BbMediaPlayerService : public QMediaService
|
class BbMediaPlayerService : public QMediaService
|
||||||
@@ -64,6 +65,7 @@ private:
|
|||||||
|
|
||||||
QPointer<BbVideoWindowControl> m_videoWindowControl;
|
QPointer<BbVideoWindowControl> m_videoWindowControl;
|
||||||
QPointer<BbMediaPlayerControl> m_mediaPlayerControl;
|
QPointer<BbMediaPlayerControl> m_mediaPlayerControl;
|
||||||
|
QPointer<BbMetaDataReaderControl> m_metaDataReaderControl;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
@@ -51,7 +51,16 @@ BbMetaData::BbMetaData()
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char * titleKey = "md_title_name";
|
||||||
|
static const char * artistKey = "md_title_artist";
|
||||||
|
static const char * commentKey = "md_title_comment";
|
||||||
|
static const char * genreKey = "md_title_genre";
|
||||||
|
static const char * yearKey = "md_title_year";
|
||||||
static const char * durationKey = "md_title_duration";
|
static const char * durationKey = "md_title_duration";
|
||||||
|
static const char * bitRateKey = "md_title_bitrate";
|
||||||
|
static const char * sampleKey = "md_title_samplerate";
|
||||||
|
static const char * albumKey = "md_title_album";
|
||||||
|
static const char * trackKey = "md_title_track";
|
||||||
static const char * widthKey = "md_video_width";
|
static const char * widthKey = "md_video_width";
|
||||||
static const char * heightKey = "md_video_height";
|
static const char * heightKey = "md_video_height";
|
||||||
static const char * mediaTypeKey = "md_title_mediatype";
|
static const char * mediaTypeKey = "md_title_mediatype";
|
||||||
@@ -102,6 +111,24 @@ bool BbMetaData::parse(const QString &contextName)
|
|||||||
m_pixelWidth = value.toFloat();
|
m_pixelWidth = value.toFloat();
|
||||||
else if (key == pixelHeightKey)
|
else if (key == pixelHeightKey)
|
||||||
m_pixelHeight = value.toFloat();
|
m_pixelHeight = value.toFloat();
|
||||||
|
else if (key == titleKey)
|
||||||
|
m_title = value;
|
||||||
|
else if (key == artistKey)
|
||||||
|
m_artist = value;
|
||||||
|
else if (key == commentKey)
|
||||||
|
m_comment = value;
|
||||||
|
else if (key == genreKey)
|
||||||
|
m_genre = value;
|
||||||
|
else if (key == yearKey)
|
||||||
|
m_year = value.toInt();
|
||||||
|
else if (key == bitRateKey)
|
||||||
|
m_audioBitRate = value.toInt();
|
||||||
|
else if (key == sampleKey)
|
||||||
|
m_sampleRate = value.toInt();
|
||||||
|
else if (key == albumKey)
|
||||||
|
m_album = value;
|
||||||
|
else if (key == trackKey)
|
||||||
|
m_track = value.toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +143,16 @@ void BbMetaData::clear()
|
|||||||
m_mediaType = -1;
|
m_mediaType = -1;
|
||||||
m_pixelWidth = 1;
|
m_pixelWidth = 1;
|
||||||
m_pixelHeight = 1;
|
m_pixelHeight = 1;
|
||||||
|
|
||||||
|
m_title.clear();
|
||||||
|
m_artist.clear();
|
||||||
|
m_comment.clear();
|
||||||
|
m_genre.clear();
|
||||||
|
m_year = 0;
|
||||||
|
m_audioBitRate = 0;
|
||||||
|
m_sampleRate = 0;
|
||||||
|
m_album.clear();
|
||||||
|
m_track = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
qlonglong BbMetaData::duration() const
|
qlonglong BbMetaData::duration() const
|
||||||
@@ -161,4 +198,64 @@ bool BbMetaData::hasAudio() const
|
|||||||
return (m_mediaType & mediaTypeAudioFlag);
|
return (m_mediaType & mediaTypeAudioFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString BbMetaData::title() const
|
||||||
|
{
|
||||||
|
return m_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BbMetaData::artist() const
|
||||||
|
{
|
||||||
|
return m_artist;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BbMetaData::comment() const
|
||||||
|
{
|
||||||
|
return m_comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BbMetaData::genre() const
|
||||||
|
{
|
||||||
|
return m_genre;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BbMetaData::year() const
|
||||||
|
{
|
||||||
|
return m_year;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BbMetaData::mediaType() const
|
||||||
|
{
|
||||||
|
if (hasVideo())
|
||||||
|
return QLatin1String("video");
|
||||||
|
else if (hasAudio())
|
||||||
|
return QLatin1String("audio");
|
||||||
|
else
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
int BbMetaData::audioBitRate() const
|
||||||
|
{
|
||||||
|
return m_audioBitRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BbMetaData::sampleRate() const
|
||||||
|
{
|
||||||
|
return m_sampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BbMetaData::album() const
|
||||||
|
{
|
||||||
|
return m_album;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BbMetaData::track() const
|
||||||
|
{
|
||||||
|
return m_track;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize BbMetaData::resolution() const
|
||||||
|
{
|
||||||
|
return QSize(width(), height());
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
#define BBMETADATA_H
|
#define BBMETADATA_H
|
||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
|
#include <QtCore/QSize>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@@ -60,6 +62,18 @@ public:
|
|||||||
bool hasVideo() const;
|
bool hasVideo() const;
|
||||||
bool hasAudio() const;
|
bool hasAudio() const;
|
||||||
|
|
||||||
|
QString title() const;
|
||||||
|
QString artist() const;
|
||||||
|
QString comment() const;
|
||||||
|
QString genre() const;
|
||||||
|
int year() const;
|
||||||
|
QString mediaType() const;
|
||||||
|
int audioBitRate() const;
|
||||||
|
int sampleRate() const;
|
||||||
|
QString album() const;
|
||||||
|
int track() const;
|
||||||
|
QSize resolution() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qlonglong m_duration;
|
qlonglong m_duration;
|
||||||
int m_height;
|
int m_height;
|
||||||
@@ -67,6 +81,16 @@ private:
|
|||||||
int m_mediaType;
|
int m_mediaType;
|
||||||
float m_pixelWidth;
|
float m_pixelWidth;
|
||||||
float m_pixelHeight;
|
float m_pixelHeight;
|
||||||
|
|
||||||
|
QString m_title;
|
||||||
|
QString m_artist;
|
||||||
|
QString m_comment;
|
||||||
|
QString m_genre;
|
||||||
|
int m_year;
|
||||||
|
int m_audioBitRate;
|
||||||
|
int m_sampleRate;
|
||||||
|
QString m_album;
|
||||||
|
int m_track;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
169
src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp
Normal file
169
src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Research In Motion
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, 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, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia 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.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
#include "bbmetadatareadercontrol.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
BbMetaDataReaderControl::BbMetaDataReaderControl(QObject *parent)
|
||||||
|
: QMetaDataReaderControl(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BbMetaDataReaderControl::isMetaDataAvailable() const
|
||||||
|
{
|
||||||
|
return !availableMetaData().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant BbMetaDataReaderControl::metaData(const QString &key) const
|
||||||
|
{
|
||||||
|
if (key == QMediaMetaData::Title)
|
||||||
|
return m_metaData.title();
|
||||||
|
else if (key == QMediaMetaData::Author)
|
||||||
|
return m_metaData.artist();
|
||||||
|
else if (key == QMediaMetaData::Comment)
|
||||||
|
return m_metaData.comment();
|
||||||
|
else if (key == QMediaMetaData::Genre)
|
||||||
|
return m_metaData.genre();
|
||||||
|
else if (key == QMediaMetaData::Year)
|
||||||
|
return m_metaData.year();
|
||||||
|
else if (key == QMediaMetaData::MediaType)
|
||||||
|
return m_metaData.mediaType();
|
||||||
|
else if (key == QMediaMetaData::Duration)
|
||||||
|
return m_metaData.duration();
|
||||||
|
else if (key == QMediaMetaData::AudioBitRate)
|
||||||
|
return m_metaData.audioBitRate();
|
||||||
|
else if (key == QMediaMetaData::SampleRate)
|
||||||
|
return m_metaData.sampleRate();
|
||||||
|
else if (key == QMediaMetaData::AlbumTitle)
|
||||||
|
return m_metaData.album();
|
||||||
|
else if (key == QMediaMetaData::TrackNumber)
|
||||||
|
return m_metaData.track();
|
||||||
|
else if (key == QMediaMetaData::Resolution)
|
||||||
|
return m_metaData.resolution();
|
||||||
|
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList BbMetaDataReaderControl::availableMetaData() const
|
||||||
|
{
|
||||||
|
QStringList metaData;
|
||||||
|
|
||||||
|
if (!m_metaData.title().isEmpty())
|
||||||
|
metaData << QMediaMetaData::Title;
|
||||||
|
if (!m_metaData.artist().isEmpty())
|
||||||
|
metaData << QMediaMetaData::Author;
|
||||||
|
if (!m_metaData.comment().isEmpty())
|
||||||
|
metaData << QMediaMetaData::Comment;
|
||||||
|
if (!m_metaData.genre().isEmpty())
|
||||||
|
metaData << QMediaMetaData::Genre;
|
||||||
|
if (m_metaData.year() != 0)
|
||||||
|
metaData << QMediaMetaData::Year;
|
||||||
|
if (!m_metaData.mediaType().isEmpty())
|
||||||
|
metaData << QMediaMetaData::MediaType;
|
||||||
|
if (m_metaData.duration() != 0)
|
||||||
|
metaData << QMediaMetaData::Duration;
|
||||||
|
if (m_metaData.audioBitRate() != 0)
|
||||||
|
metaData << QMediaMetaData::AudioBitRate;
|
||||||
|
if (m_metaData.sampleRate() != 0)
|
||||||
|
metaData << QMediaMetaData::SampleRate;
|
||||||
|
if (!m_metaData.album().isEmpty())
|
||||||
|
metaData << QMediaMetaData::AlbumTitle;
|
||||||
|
if (m_metaData.track() != 0)
|
||||||
|
metaData << QMediaMetaData::TrackNumber;
|
||||||
|
if (m_metaData.resolution().isValid())
|
||||||
|
metaData << QMediaMetaData::Resolution;
|
||||||
|
|
||||||
|
return metaData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BbMetaDataReaderControl::setMetaData(const BbMetaData &data)
|
||||||
|
{
|
||||||
|
const BbMetaData oldMetaData = m_metaData;
|
||||||
|
const bool oldMetaDataAvailable = isMetaDataAvailable();
|
||||||
|
|
||||||
|
m_metaData = data;
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
|
if (m_metaData.title() != oldMetaData.title()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::Title, m_metaData.title());
|
||||||
|
} else if (m_metaData.artist() != oldMetaData.artist()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::Author, m_metaData.artist());
|
||||||
|
} else if (m_metaData.comment() != oldMetaData.comment()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::Comment, m_metaData.comment());
|
||||||
|
} else if (m_metaData.genre() != oldMetaData.genre()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::Genre, m_metaData.genre());
|
||||||
|
} else if (m_metaData.year() != oldMetaData.year()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::Year, m_metaData.year());
|
||||||
|
} else if (m_metaData.mediaType() != oldMetaData.mediaType()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::MediaType, m_metaData.mediaType());
|
||||||
|
} else if (m_metaData.duration() != oldMetaData.duration()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::Duration, m_metaData.duration());
|
||||||
|
} else if (m_metaData.audioBitRate() != oldMetaData.audioBitRate()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::AudioBitRate, m_metaData.audioBitRate());
|
||||||
|
} else if (m_metaData.sampleRate() != oldMetaData.sampleRate()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::SampleRate, m_metaData.sampleRate());
|
||||||
|
} else if (m_metaData.album() != oldMetaData.album()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::AlbumTitle, m_metaData.album());
|
||||||
|
} else if (m_metaData.track() != oldMetaData.track()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::TrackNumber, m_metaData.track());
|
||||||
|
} else if (m_metaData.resolution() != oldMetaData.resolution()) {
|
||||||
|
changed = true;
|
||||||
|
emit metaDataChanged(QMediaMetaData::Resolution, m_metaData.resolution());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
emit metaDataChanged();
|
||||||
|
|
||||||
|
const bool metaDataAvailable = isMetaDataAvailable();
|
||||||
|
if (metaDataAvailable != oldMetaDataAvailable)
|
||||||
|
emit metaDataAvailableChanged(metaDataAvailable);
|
||||||
|
}
|
||||||
68
src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h
Normal file
68
src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Research In Motion
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, 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, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia 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.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef BBMETADATAREADERCONTROL_H
|
||||||
|
#define BBMETADATAREADERCONTROL_H
|
||||||
|
|
||||||
|
#include "bbmetadata.h"
|
||||||
|
#include <qmetadatareadercontrol.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class BbMetaDataReaderControl : public QMetaDataReaderControl
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit BbMetaDataReaderControl(QObject *parent = 0);
|
||||||
|
|
||||||
|
bool isMetaDataAvailable() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
QVariant metaData(const QString &key) const Q_DECL_OVERRIDE;
|
||||||
|
QStringList availableMetaData() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
void setMetaData(const BbMetaData &data);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BbMetaData m_metaData;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -4,6 +4,7 @@ HEADERS += \
|
|||||||
$$PWD/bbmediaplayercontrol.h \
|
$$PWD/bbmediaplayercontrol.h \
|
||||||
$$PWD/bbmediaplayerservice.h \
|
$$PWD/bbmediaplayerservice.h \
|
||||||
$$PWD/bbmetadata.h \
|
$$PWD/bbmetadata.h \
|
||||||
|
$$PWD/bbmetadatareadercontrol.h \
|
||||||
$$PWD/bbutil.h \
|
$$PWD/bbutil.h \
|
||||||
$$PWD/bbvideowindowcontrol.h
|
$$PWD/bbvideowindowcontrol.h
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ SOURCES += \
|
|||||||
$$PWD/bbmediaplayercontrol.cpp \
|
$$PWD/bbmediaplayercontrol.cpp \
|
||||||
$$PWD/bbmediaplayerservice.cpp \
|
$$PWD/bbmediaplayerservice.cpp \
|
||||||
$$PWD/bbmetadata.cpp \
|
$$PWD/bbmetadata.cpp \
|
||||||
|
$$PWD/bbmetadatareadercontrol.cpp \
|
||||||
$$PWD/bbutil.cpp \
|
$$PWD/bbutil.cpp \
|
||||||
$$PWD/bbvideowindowcontrol.cpp
|
$$PWD/bbvideowindowcontrol.cpp
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user