Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: .qmake.conf Change-Id: Iecd8d7b94e52a8981526b12cffa40e99870ba62f
This commit is contained in:
@@ -45,23 +45,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QAudio
|
||||
static void qRegisterAudioMetaTypes()
|
||||
{
|
||||
|
||||
class RegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
RegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QAudio::Error>();
|
||||
qRegisterMetaType<QAudio::State>();
|
||||
qRegisterMetaType<QAudio::Mode>();
|
||||
}
|
||||
|
||||
} _register;
|
||||
|
||||
qRegisterMetaType<QAudio::Error>();
|
||||
qRegisterMetaType<QAudio::State>();
|
||||
qRegisterMetaType<QAudio::Mode>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterAudioMetaTypes)
|
||||
|
||||
/*!
|
||||
\namespace QAudio
|
||||
\brief The QAudio namespace contains enums used by the audio classes.
|
||||
|
||||
@@ -47,18 +47,14 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
|
||||
static void qRegisterAudioBufferMetaTypes()
|
||||
{
|
||||
class QAudioBufferPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QAudioBufferPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QAudioBuffer>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QAudioBuffer>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterAudioBufferMetaTypes)
|
||||
|
||||
|
||||
class QAudioBufferPrivate : public QSharedData
|
||||
{
|
||||
|
||||
@@ -72,19 +72,14 @@ QT_BEGIN_NAMESPACE
|
||||
\sa QAudioBuffer
|
||||
*/
|
||||
|
||||
namespace
|
||||
static void qRegisterAudioDecoderMetaTypes()
|
||||
{
|
||||
class AudioDecoderRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
AudioDecoderRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QAudioDecoder::State>("QAudioDecoder::State");
|
||||
qRegisterMetaType<QAudioDecoder::Error>("QAudioDecoder::Error");
|
||||
}
|
||||
} _registerPlayerMetaTypes;
|
||||
qRegisterMetaType<QAudioDecoder::State>("QAudioDecoder::State");
|
||||
qRegisterMetaType<QAudioDecoder::Error>("QAudioDecoder::Error");
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterAudioDecoderMetaTypes)
|
||||
|
||||
class QAudioDecoderPrivate : public QMediaObjectPrivate
|
||||
{
|
||||
Q_DECLARE_NON_CONST_PUBLIC(QAudioDecoder)
|
||||
|
||||
@@ -49,6 +49,11 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QString defaultKey()
|
||||
{
|
||||
return QStringLiteral("default");
|
||||
}
|
||||
|
||||
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, audioLoader,
|
||||
(QAudioSystemFactoryInterface_iid, QLatin1String("audio"), Qt::CaseInsensitive))
|
||||
@@ -137,13 +142,18 @@ QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode)
|
||||
QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice()
|
||||
{
|
||||
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
|
||||
QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(QLatin1String("default")));
|
||||
|
||||
QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(defaultKey()));
|
||||
if (plugin) {
|
||||
QList<QByteArray> list = plugin->availableDevices(QAudio::AudioInput);
|
||||
if (list.size() > 0)
|
||||
return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput);
|
||||
return QAudioDeviceInfo(defaultKey(), list.at(0), QAudio::AudioInput);
|
||||
}
|
||||
|
||||
// if no plugin is marked as default or if the default plugin doesn't have any input device,
|
||||
// return the first input available from other plugins.
|
||||
QList<QAudioDeviceInfo> inputDevices = availableDevices(QAudio::AudioInput);
|
||||
if (!inputDevices.isEmpty())
|
||||
return inputDevices.first();
|
||||
#endif
|
||||
|
||||
return QAudioDeviceInfo();
|
||||
@@ -152,13 +162,18 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice()
|
||||
QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice()
|
||||
{
|
||||
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
|
||||
QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(QLatin1String("default")));
|
||||
|
||||
QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(defaultKey()));
|
||||
if (plugin) {
|
||||
QList<QByteArray> list = plugin->availableDevices(QAudio::AudioOutput);
|
||||
if (list.size() > 0)
|
||||
return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput);
|
||||
return QAudioDeviceInfo(defaultKey(), list.at(0), QAudio::AudioOutput);
|
||||
}
|
||||
|
||||
// if no plugin is marked as default or if the default plugin doesn't have any output device,
|
||||
// return the first output available from other plugins.
|
||||
QList<QAudioDeviceInfo> outputDevices = availableDevices(QAudio::AudioOutput);
|
||||
if (!outputDevices.isEmpty())
|
||||
return outputDevices.first();
|
||||
#endif
|
||||
|
||||
return QAudioDeviceInfo();
|
||||
|
||||
@@ -47,18 +47,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterAudioDeviceInfoMetaTypes()
|
||||
{
|
||||
class QAudioInfoPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QAudioInfoPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QAudioDeviceInfo>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QAudioDeviceInfo>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterAudioDeviceInfoMetaTypes)
|
||||
|
||||
class QAudioDeviceInfoPrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -44,20 +44,14 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterAudioFormatMetaTypes()
|
||||
{
|
||||
class QAudioFormatPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QAudioFormatPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QAudioFormat>();
|
||||
qRegisterMetaType<QAudioFormat::SampleType>();
|
||||
qRegisterMetaType<QAudioFormat::Endian>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QAudioFormat>();
|
||||
qRegisterMetaType<QAudioFormat::SampleType>();
|
||||
qRegisterMetaType<QAudioFormat::Endian>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterAudioFormatMetaTypes)
|
||||
|
||||
class QAudioFormatPrivate : public QSharedData
|
||||
{
|
||||
|
||||
@@ -56,26 +56,21 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static void qRegisterCameraMetaTypes()
|
||||
{
|
||||
class CameraRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
CameraRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QCamera::Error>("QCamera::Error");
|
||||
qRegisterMetaType<QCamera::State>("QCamera::State");
|
||||
qRegisterMetaType<QCamera::Status>("QCamera::Status");
|
||||
qRegisterMetaType<QCamera::CaptureModes>("QCamera::CaptureModes");
|
||||
qRegisterMetaType<QCamera::LockType>("QCamera::LockType");
|
||||
qRegisterMetaType<QCamera::LockStatus>("QCamera::LockStatus");
|
||||
qRegisterMetaType<QCamera::LockChangeReason>("QCamera::LockChangeReason");
|
||||
qRegisterMetaType<QCamera::Position>("QCamera::Position");
|
||||
}
|
||||
} _registerCameraMetaTypes;
|
||||
qRegisterMetaType<QCamera::Error>("QCamera::Error");
|
||||
qRegisterMetaType<QCamera::State>("QCamera::State");
|
||||
qRegisterMetaType<QCamera::Status>("QCamera::Status");
|
||||
qRegisterMetaType<QCamera::CaptureModes>("QCamera::CaptureModes");
|
||||
qRegisterMetaType<QCamera::LockType>("QCamera::LockType");
|
||||
qRegisterMetaType<QCamera::LockStatus>("QCamera::LockStatus");
|
||||
qRegisterMetaType<QCamera::LockChangeReason>("QCamera::LockChangeReason");
|
||||
qRegisterMetaType<QCamera::Position>("QCamera::Position");
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterCameraMetaTypes)
|
||||
|
||||
/*!
|
||||
\class QCamera
|
||||
|
||||
@@ -65,20 +65,14 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
//#define DEBUG_EXPOSURE_CHANGES 1
|
||||
|
||||
namespace
|
||||
static void qRegisterCameraExposureMetaTypes()
|
||||
{
|
||||
class CameraExposureRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
CameraExposureRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QCameraExposure::ExposureMode>("QCameraExposure::ExposureMode");
|
||||
qRegisterMetaType<QCameraExposure::FlashModes>("QCameraExposure::FlashModes");
|
||||
qRegisterMetaType<QCameraExposure::MeteringMode>("QCameraExposure::MeteringMode");
|
||||
}
|
||||
} _registerCameraExposureMetaTypes;
|
||||
qRegisterMetaType<QCameraExposure::ExposureMode>("QCameraExposure::ExposureMode");
|
||||
qRegisterMetaType<QCameraExposure::FlashModes>("QCameraExposure::FlashModes");
|
||||
qRegisterMetaType<QCameraExposure::MeteringMode>("QCameraExposure::MeteringMode");
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterCameraExposureMetaTypes)
|
||||
|
||||
|
||||
class QCameraExposurePrivate
|
||||
|
||||
@@ -55,19 +55,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterCameraFocusMetaTypes()
|
||||
{
|
||||
class CameraFocusRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
CameraFocusRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QCameraFocus::FocusModes>("QCameraFocus::FocusModes");
|
||||
qRegisterMetaType<QCameraFocus::FocusPointMode>("QCameraFocus::FocusPointMode");
|
||||
}
|
||||
} _registerCameraFocusMetaTypes;
|
||||
qRegisterMetaType<QCameraFocus::FocusModes>("QCameraFocus::FocusModes");
|
||||
qRegisterMetaType<QCameraFocus::FocusPointMode>("QCameraFocus::FocusPointMode");
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterCameraFocusMetaTypes)
|
||||
|
||||
|
||||
class QCameraFocusFakeZoomControl : public QCameraZoomControl
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -83,20 +83,15 @@ QT_BEGIN_NAMESPACE
|
||||
\value CaptureToBuffer Capture the image to a buffer for further processing.
|
||||
*/
|
||||
|
||||
namespace
|
||||
static void qRegisterCameraImageCaptureMetaTypes()
|
||||
{
|
||||
class MediaRecorderRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
MediaRecorderRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QCameraImageCapture::Error>("QCameraImageCapture::Error");
|
||||
qRegisterMetaType<QCameraImageCapture::CaptureDestination>("QCameraImageCapture::CaptureDestination");
|
||||
qRegisterMetaType<QCameraImageCapture::CaptureDestinations>("QCameraImageCapture::CaptureDestinations");
|
||||
}
|
||||
} _registerRecorderMetaTypes;
|
||||
qRegisterMetaType<QCameraImageCapture::Error>("QCameraImageCapture::Error");
|
||||
qRegisterMetaType<QCameraImageCapture::CaptureDestination>("QCameraImageCapture::CaptureDestination");
|
||||
qRegisterMetaType<QCameraImageCapture::CaptureDestinations>("QCameraImageCapture::CaptureDestinations");
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterCameraImageCaptureMetaTypes)
|
||||
|
||||
|
||||
class QCameraImageCapturePrivate
|
||||
{
|
||||
|
||||
@@ -52,20 +52,15 @@
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
namespace
|
||||
{
|
||||
class QCameraImageProcessingPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QCameraImageProcessingPrivateRegisterMetaTypes()
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static void qRegisterCameraImageProcessingMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QCameraImageProcessing::WhiteBalanceMode>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterCameraImageProcessingMetaTypes)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class QCameraImageProcessing
|
||||
|
||||
@@ -44,18 +44,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterCameraImageProcessingControlMetaTypes()
|
||||
{
|
||||
class QCameraImageProcessingControlPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QCameraImageProcessingControlPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QCameraImageProcessingControl::ProcessingParameter>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QCameraImageProcessingControl::ProcessingParameter>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterCameraImageProcessingControlMetaTypes)
|
||||
|
||||
/*!
|
||||
\class QCameraImageProcessingControl
|
||||
\inmodule QtMultimedia
|
||||
|
||||
@@ -44,18 +44,14 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterMediaStreamControlMetaTypes()
|
||||
{
|
||||
class QMediaStreamsControlPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QMediaStreamsControlPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QMediaStreamsControl::StreamType>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QMediaStreamsControl::StreamType>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterMediaStreamControlMetaTypes)
|
||||
|
||||
|
||||
/*!
|
||||
\class QMediaStreamsControl
|
||||
\inmodule QtMultimedia
|
||||
|
||||
@@ -116,18 +116,14 @@ code but more buffering, which may affect latency.
|
||||
|
||||
\section2 Decoding Compressed Audio to Memory
|
||||
In some cases you may want to decode a compressed audio file and do further
|
||||
processing yourself (like mix multiple samples, or some custom digital signal
|
||||
processing algorithms). Qt Multimedia 5.0 offers a preliminary API for this
|
||||
case - the \l QAudioDecoder class. QAudioDecoder supports decoding local files
|
||||
or from a QIODevice instances.
|
||||
processing yourself (for example, mixing multiple samples or using custom
|
||||
digital signal processing algorithms). QAudioDecoder supports decoding local
|
||||
files or data streams from QIODevice instances.
|
||||
|
||||
Here's an example of decoding a local file:
|
||||
|
||||
\snippet multimedia-snippets/audio.cpp Local audio decoding
|
||||
|
||||
Note: This API is preliminary at this time - the API may change or be
|
||||
removed before the final 5.0 release.
|
||||
|
||||
\section1 Examples
|
||||
|
||||
There are both C++ and QML examples available.
|
||||
|
||||
@@ -21,7 +21,8 @@ PRIVATE_HEADERS += \
|
||||
qmediaserviceprovider_p.h \
|
||||
qmediaresourcepolicyplugin_p.h \
|
||||
qmediaresourcepolicy_p.h \
|
||||
qmediaresourceset_p.h
|
||||
qmediaresourceset_p.h \
|
||||
qmediastoragelocation_p.h
|
||||
|
||||
PUBLIC_HEADERS += \
|
||||
qmediabindableinterface.h \
|
||||
@@ -47,6 +48,7 @@ SOURCES += \
|
||||
qmediaresourcepolicyplugin_p.cpp \
|
||||
qmediaresourcepolicy_p.cpp \
|
||||
qmediaresourceset_p.cpp \
|
||||
qmediastoragelocation.cpp \
|
||||
qmultimedia.cpp
|
||||
|
||||
include(audio/audio.pri)
|
||||
|
||||
@@ -307,9 +307,9 @@ Version=2
|
||||
|
||||
void setCount(int count) {
|
||||
m_count = count;
|
||||
m_fileName = QString(tr("File%1")).arg(count);
|
||||
m_titleName = QString(tr("Title%1")).arg(count);
|
||||
m_lengthName = QString(tr("Length%1")).arg(count);
|
||||
m_fileName = QStringLiteral("File%1").arg(count);
|
||||
m_titleName = QStringLiteral("Title%1").arg(count);
|
||||
m_lengthName = QStringLiteral("Length%1").arg(count);
|
||||
m_item.clear();
|
||||
m_readFlags = 0;
|
||||
}
|
||||
|
||||
@@ -48,18 +48,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterMediaContentMetaTypes()
|
||||
{
|
||||
class QMediaContentPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QMediaContentPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QMediaContent>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QMediaContent>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterMediaContentMetaTypes)
|
||||
|
||||
|
||||
class QMediaContentPrivate : public QSharedData
|
||||
{
|
||||
|
||||
@@ -90,20 +90,16 @@ QT_BEGIN_NAMESPACE
|
||||
\sa QMediaObject, QMediaService, QVideoWidget, QMediaPlaylist
|
||||
*/
|
||||
|
||||
namespace
|
||||
static void qRegisterMediaPlayerMetaTypes()
|
||||
{
|
||||
class MediaPlayerRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
MediaPlayerRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QMediaPlayer::State>("QMediaPlayer::State");
|
||||
qRegisterMetaType<QMediaPlayer::MediaStatus>("QMediaPlayer::MediaStatus");
|
||||
qRegisterMetaType<QMediaPlayer::Error>("QMediaPlayer::Error");
|
||||
}
|
||||
} _registerPlayerMetaTypes;
|
||||
qRegisterMetaType<QMediaPlayer::State>("QMediaPlayer::State");
|
||||
qRegisterMetaType<QMediaPlayer::MediaStatus>("QMediaPlayer::MediaStatus");
|
||||
qRegisterMetaType<QMediaPlayer::Error>("QMediaPlayer::Error");
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterMediaPlayerMetaTypes)
|
||||
|
||||
|
||||
#define MAX_NESTED_PLAYLISTS 16
|
||||
|
||||
class QMediaPlayerPrivate : public QMediaObjectPrivate
|
||||
@@ -1238,12 +1234,14 @@ QMultimedia::AvailabilityStatus QMediaPlayer::availability() const
|
||||
|
||||
/*!
|
||||
\property QMediaPlayer::bufferStatus
|
||||
\brief the percentage of the temporary buffer filled before playback begins.
|
||||
\brief the percentage of the temporary buffer filled before playback begins or resumes, from
|
||||
\c 0 (empty) to \c 100 (full).
|
||||
|
||||
When the player object is buffering; this property holds the percentage of
|
||||
the temporary buffer that is filled. The buffer will need to reach 100%
|
||||
filled before playback can resume, at which time the MediaStatus will be
|
||||
BufferedMedia.
|
||||
filled before playback can start or resume, at which time mediaStatus() will return
|
||||
BufferedMedia or BufferingMedia. If the value is anything lower than \c 100, mediaStatus() will
|
||||
return StalledMedia.
|
||||
|
||||
\sa mediaStatus()
|
||||
*/
|
||||
|
||||
@@ -61,19 +61,14 @@ QT_BEGIN_NAMESPACE
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, playlistIOLoader,
|
||||
(QMediaPlaylistIOInterface_iid, QLatin1String("playlistformats"), Qt::CaseInsensitive))
|
||||
|
||||
namespace
|
||||
static void qRegisterMediaPlaylistMetaTypes()
|
||||
{
|
||||
class QMediaPlaylistPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QMediaPlaylistPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QMediaPlaylist::Error>();
|
||||
qRegisterMetaType<QMediaPlaylist::PlaybackMode>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QMediaPlaylist::Error>();
|
||||
qRegisterMetaType<QMediaPlaylist::PlaybackMode>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterMediaPlaylistMetaTypes)
|
||||
|
||||
|
||||
/*!
|
||||
\class QMediaPlaylist
|
||||
|
||||
@@ -47,19 +47,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterMediaResourceMetaTypes()
|
||||
{
|
||||
class QMediaResourcePrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QMediaResourcePrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QMediaResource>();
|
||||
qRegisterMetaType<QMediaResourceList>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QMediaResource>();
|
||||
qRegisterMetaType<QMediaResourceList>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterMediaResourceMetaTypes)
|
||||
|
||||
|
||||
/*!
|
||||
\class QMediaResource
|
||||
|
||||
|
||||
146
src/multimedia/qmediastoragelocation.cpp
Normal file
146
src/multimedia/qmediastoragelocation.cpp
Normal file
@@ -0,0 +1,146 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** 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 "qmediastoragelocation_p.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QMediaStorageLocation::QMediaStorageLocation()
|
||||
{
|
||||
}
|
||||
|
||||
void QMediaStorageLocation::addStorageLocation(MediaType type, const QString &location)
|
||||
{
|
||||
m_customLocations[type].append(location);
|
||||
}
|
||||
|
||||
QDir QMediaStorageLocation::defaultLocation(MediaType type) const
|
||||
{
|
||||
QStringList dirCandidates;
|
||||
|
||||
dirCandidates << m_customLocations.value(type);
|
||||
|
||||
switch (type) {
|
||||
case Movies:
|
||||
dirCandidates << QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
|
||||
break;
|
||||
case Music:
|
||||
dirCandidates << QStandardPaths::writableLocation(QStandardPaths::MusicLocation);
|
||||
break;
|
||||
case Pictures:
|
||||
dirCandidates << QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
dirCandidates << QDir::homePath();
|
||||
dirCandidates << QDir::currentPath();
|
||||
dirCandidates << QDir::tempPath();
|
||||
|
||||
Q_FOREACH (const QString &path, dirCandidates) {
|
||||
if (QFileInfo(path).isWritable())
|
||||
return QDir(path);
|
||||
}
|
||||
|
||||
return QDir();
|
||||
}
|
||||
|
||||
QString QMediaStorageLocation::generateFileName(const QString &requestedName,
|
||||
MediaType type,
|
||||
const QString &prefix,
|
||||
const QString &extension) const
|
||||
{
|
||||
if (requestedName.isEmpty())
|
||||
return generateFileName(prefix, defaultLocation(type), extension);
|
||||
|
||||
QString path = requestedName;
|
||||
|
||||
if (QFileInfo(path).isRelative())
|
||||
path = defaultLocation(type).absoluteFilePath(path);
|
||||
|
||||
if (QFileInfo(path).isDir())
|
||||
return generateFileName(prefix, QDir(path), extension);
|
||||
|
||||
if (!path.endsWith(extension))
|
||||
path.append(QString(QLatin1String(".%1")).arg(extension));
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
QString QMediaStorageLocation::generateFileName(const QString &prefix,
|
||||
const QDir &dir,
|
||||
const QString &extension) const
|
||||
{
|
||||
QMutexLocker lock(&m_mutex);
|
||||
|
||||
const QString lastMediaKey = dir.absolutePath() + QLatin1Char(' ') + prefix + QLatin1Char(' ') + extension;
|
||||
qint64 lastMediaIndex = m_lastUsedIndex.value(lastMediaKey, 0);
|
||||
|
||||
if (lastMediaIndex == 0) {
|
||||
// first run, find the maximum media number during the fist capture
|
||||
Q_FOREACH (const QString &fileName, dir.entryList(QStringList() << QString(QLatin1String("%1*.%2")).arg(prefix).arg(extension))) {
|
||||
const qint64 mediaIndex = fileName.midRef(prefix.length(), fileName.size() - prefix.length() - extension.length() - 1).toInt();
|
||||
lastMediaIndex = qMax(lastMediaIndex, mediaIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// don't just rely on cached lastMediaIndex value,
|
||||
// someone else may create a file after camera started
|
||||
while (true) {
|
||||
const QString name = QString(QLatin1String("%1%2.%3")).arg(prefix)
|
||||
.arg(lastMediaIndex + 1, 8, 10, QLatin1Char('0'))
|
||||
.arg(extension);
|
||||
|
||||
const QString path = dir.absoluteFilePath(name);
|
||||
if (!QFileInfo(path).exists()) {
|
||||
m_lastUsedIndex[lastMediaKey] = lastMediaIndex + 1;
|
||||
return path;
|
||||
}
|
||||
|
||||
lastMediaIndex++;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
80
src/multimedia/qmediastoragelocation_p.h
Normal file
80
src/multimedia/qmediastoragelocation_p.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** 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 QMEDIASTORAGELOCATION_H
|
||||
#define QMEDIASTORAGELOCATION_H
|
||||
|
||||
#include <qtmultimediadefs.h>
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QHash>
|
||||
#include <QMutex>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_MULTIMEDIA_EXPORT QMediaStorageLocation
|
||||
{
|
||||
public:
|
||||
enum MediaType {
|
||||
Movies,
|
||||
Music,
|
||||
Pictures,
|
||||
Sounds
|
||||
};
|
||||
|
||||
QMediaStorageLocation();
|
||||
|
||||
void addStorageLocation(MediaType type, const QString &location);
|
||||
|
||||
QDir defaultLocation(MediaType type) const;
|
||||
|
||||
QString generateFileName(const QString &requestedName, MediaType type, const QString &prefix, const QString &extension) const;
|
||||
QString generateFileName(const QString &prefix, const QDir &dir, const QString &extension) const;
|
||||
|
||||
private:
|
||||
mutable QMutex m_mutex;
|
||||
mutable QHash<QString, qint64> m_lastUsedIndex;
|
||||
QMap<MediaType, QStringList> m_customLocations;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMEDIASTORAGELOCATION_H
|
||||
@@ -41,21 +41,17 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
*/
|
||||
|
||||
namespace
|
||||
static void qRegisterMultimediaMetaTypes()
|
||||
{
|
||||
class QMultimediaNamespacePrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QMultimediaNamespacePrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QMultimedia::AvailabilityStatus>();
|
||||
qRegisterMetaType<QMultimedia::SupportEstimate>();
|
||||
qRegisterMetaType<QMultimedia::EncodingMode>();
|
||||
qRegisterMetaType<QMultimedia::EncodingQuality>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QMultimedia::AvailabilityStatus>();
|
||||
qRegisterMetaType<QMultimedia::SupportEstimate>();
|
||||
qRegisterMetaType<QMultimedia::EncodingMode>();
|
||||
qRegisterMetaType<QMultimedia::EncodingQuality>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterMultimediaMetaTypes)
|
||||
|
||||
|
||||
/*!
|
||||
\enum QMultimedia::SupportEstimate
|
||||
|
||||
|
||||
@@ -50,20 +50,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
namespace
|
||||
static void qRegisterRadioDataMetaTypes()
|
||||
{
|
||||
class QRadioDataPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QRadioDataPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QRadioData::Error>();
|
||||
qRegisterMetaType<QRadioData::ProgramType>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QRadioData::Error>();
|
||||
qRegisterMetaType<QRadioData::ProgramType>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterRadioDataMetaTypes)
|
||||
|
||||
|
||||
/*!
|
||||
\class QRadioData
|
||||
\brief The QRadioData class provides interfaces to the RDS functionality of the system radio.
|
||||
|
||||
@@ -52,22 +52,17 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
namespace
|
||||
static void qRegisterRadioTunerMetaTypes()
|
||||
{
|
||||
class QRadioTunerPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QRadioTunerPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QRadioTuner::Band>();
|
||||
qRegisterMetaType<QRadioTuner::Error>();
|
||||
qRegisterMetaType<QRadioTuner::SearchMode>();
|
||||
qRegisterMetaType<QRadioTuner::State>();
|
||||
qRegisterMetaType<QRadioTuner::StereoMode>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QRadioTuner::Band>();
|
||||
qRegisterMetaType<QRadioTuner::Error>();
|
||||
qRegisterMetaType<QRadioTuner::SearchMode>();
|
||||
qRegisterMetaType<QRadioTuner::State>();
|
||||
qRegisterMetaType<QRadioTuner::StereoMode>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterRadioTunerMetaTypes)
|
||||
|
||||
|
||||
/*!
|
||||
\class QRadioTuner
|
||||
|
||||
@@ -43,20 +43,16 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterEncoderSettingsMetaTypes()
|
||||
{
|
||||
class QMediaEncoderSettingsPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QMediaEncoderSettingsPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QAudioEncoderSettings>();
|
||||
qRegisterMetaType<QVideoEncoderSettings>();
|
||||
qRegisterMetaType<QImageEncoderSettings>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QAudioEncoderSettings>();
|
||||
qRegisterMetaType<QVideoEncoderSettings>();
|
||||
qRegisterMetaType<QImageEncoderSettings>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterEncoderSettingsMetaTypes)
|
||||
|
||||
|
||||
class QAudioEncoderSettingsPrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -80,20 +80,16 @@ QT_BEGIN_NAMESPACE
|
||||
\sa QAudioRecorder
|
||||
*/
|
||||
|
||||
namespace
|
||||
static void qRegisterMediaRecorderMetaTypes()
|
||||
{
|
||||
class MediaRecorderRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
MediaRecorderRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QMediaRecorder::State>("QMediaRecorder::State");
|
||||
qRegisterMetaType<QMediaRecorder::Status>("QMediaRecorder::Status");
|
||||
qRegisterMetaType<QMediaRecorder::Error>("QMediaRecorder::Error");
|
||||
}
|
||||
} _registerRecorderMetaTypes;
|
||||
qRegisterMetaType<QMediaRecorder::State>("QMediaRecorder::State");
|
||||
qRegisterMetaType<QMediaRecorder::Status>("QMediaRecorder::Status");
|
||||
qRegisterMetaType<QMediaRecorder::Error>("QMediaRecorder::Error");
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterMediaRecorderMetaTypes)
|
||||
|
||||
|
||||
QMediaRecorderPrivate::QMediaRecorderPrivate():
|
||||
mediaObject(0),
|
||||
control(0),
|
||||
|
||||
@@ -48,19 +48,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterAbstractVideoBufferMetaTypes()
|
||||
{
|
||||
class QAbstractVideoBufferPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QAbstractVideoBufferPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QAbstractVideoBuffer::HandleType>();
|
||||
qRegisterMetaType<QAbstractVideoBuffer::MapMode>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QAbstractVideoBuffer::HandleType>();
|
||||
qRegisterMetaType<QAbstractVideoBuffer::MapMode>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterAbstractVideoBufferMetaTypes)
|
||||
|
||||
|
||||
/*!
|
||||
\class QAbstractVideoBuffer
|
||||
\brief The QAbstractVideoBuffer class is an abstraction for video data.
|
||||
|
||||
@@ -50,18 +50,13 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterAbstractVideoSurfaceMetaTypes()
|
||||
{
|
||||
class QAbstractVideoSurfacePrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QAbstractVideoSurfacePrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QAbstractVideoSurface::Error>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QAbstractVideoSurface::Error>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterAbstractVideoSurfaceMetaTypes)
|
||||
|
||||
|
||||
class QAbstractVideoSurfacePrivate {
|
||||
public:
|
||||
|
||||
@@ -55,20 +55,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterVideoFrameMetaTypes()
|
||||
{
|
||||
class QVideoFramePrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QVideoFramePrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QVideoFrame>();
|
||||
qRegisterMetaType<QVideoFrame::FieldType>();
|
||||
qRegisterMetaType<QVideoFrame::PixelFormat>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QVideoFrame>();
|
||||
qRegisterMetaType<QVideoFrame::FieldType>();
|
||||
qRegisterMetaType<QVideoFrame::PixelFormat>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterVideoFrameMetaTypes)
|
||||
|
||||
|
||||
class QVideoFramePrivate : public QSharedData
|
||||
{
|
||||
|
||||
@@ -49,20 +49,15 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace
|
||||
static void qRegisterVideoSurfaceFormatMetaTypes()
|
||||
{
|
||||
class QVideoSurfaceFormatPrivateRegisterMetaTypes
|
||||
{
|
||||
public:
|
||||
QVideoSurfaceFormatPrivateRegisterMetaTypes()
|
||||
{
|
||||
qRegisterMetaType<QVideoSurfaceFormat>();
|
||||
qRegisterMetaType<QVideoSurfaceFormat::Direction>();
|
||||
qRegisterMetaType<QVideoSurfaceFormat::YCbCrColorSpace>();
|
||||
}
|
||||
} _registerMetaTypes;
|
||||
qRegisterMetaType<QVideoSurfaceFormat>();
|
||||
qRegisterMetaType<QVideoSurfaceFormat::Direction>();
|
||||
qRegisterMetaType<QVideoSurfaceFormat::YCbCrColorSpace>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterVideoSurfaceFormatMetaTypes)
|
||||
|
||||
|
||||
class QVideoSurfaceFormatPrivate : public QSharedData
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user