summaryrefslogtreecommitdiff
path: root/src/multimedia
diff options
context:
space:
mode:
authorSergio Ahumada <sahumada@blackberry.com>2014-06-14 21:59:24 +0200
committerSergio Ahumada <sahumada@blackberry.com>2014-06-14 21:59:24 +0200
commitd691f5ca2b6749006673e199b1d668a6daa9b990 (patch)
treeeacad24192e1e0c492320e14bdfd7c3c203a01e0 /src/multimedia
parentd415d3256d055ef6fd7dad5c0497ecfaa56ee64d (diff)
parent150ff6662de1312e3ba9d000895d80dd5805ea5b (diff)
downloadqtmultimedia-d691f5ca2b6749006673e199b1d668a6daa9b990.tar.gz
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: .qmake.conf Change-Id: Iecd8d7b94e52a8981526b12cffa40e99870ba62f
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qaudio.cpp20
-rw-r--r--src/multimedia/audio/qaudiobuffer.cpp14
-rw-r--r--src/multimedia/audio/qaudiodecoder.cpp15
-rw-r--r--src/multimedia/audio/qaudiodevicefactory.cpp27
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.cpp13
-rw-r--r--src/multimedia/audio/qaudioformat.cpp16
-rw-r--r--src/multimedia/camera/qcamera.cpp29
-rw-r--r--src/multimedia/camera/qcameraexposure.cpp16
-rw-r--r--src/multimedia/camera/qcamerafocus.cpp16
-rw-r--r--src/multimedia/camera/qcameraimagecapture.cpp17
-rw-r--r--src/multimedia/camera/qcameraimageprocessing.cpp13
-rw-r--r--src/multimedia/controls/qcameraimageprocessingcontrol.cpp13
-rw-r--r--src/multimedia/controls/qmediastreamscontrol.cpp14
-rw-r--r--src/multimedia/doc/src/audiooverview.qdoc10
-rw-r--r--src/multimedia/multimedia.pro4
-rw-r--r--src/multimedia/playback/playlistfileparser.cpp6
-rw-r--r--src/multimedia/playback/qmediacontent.cpp13
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp26
-rw-r--r--src/multimedia/playback/qmediaplaylist.cpp17
-rw-r--r--src/multimedia/playback/qmediaresource.cpp18
-rw-r--r--src/multimedia/qmediastoragelocation.cpp146
-rw-r--r--src/multimedia/qmediastoragelocation_p.h80
-rw-r--r--src/multimedia/qmultimedia.cpp20
-rw-r--r--src/multimedia/radio/qradiodata.cpp17
-rw-r--r--src/multimedia/radio/qradiotuner.cpp23
-rw-r--r--src/multimedia/recording/qmediaencodersettings.cpp18
-rw-r--r--src/multimedia/recording/qmediarecorder.cpp18
-rw-r--r--src/multimedia/video/qabstractvideobuffer.cpp16
-rw-r--r--src/multimedia/video/qabstractvideosurface.cpp13
-rw-r--r--src/multimedia/video/qvideoframe.cpp17
-rw-r--r--src/multimedia/video/qvideosurfaceformat.cpp17
31 files changed, 411 insertions, 291 deletions
diff --git a/src/multimedia/audio/qaudio.cpp b/src/multimedia/audio/qaudio.cpp
index 13cc2947f..5039729be 100644
--- a/src/multimedia/audio/qaudio.cpp
+++ b/src/multimedia/audio/qaudio.cpp
@@ -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.
diff --git a/src/multimedia/audio/qaudiobuffer.cpp b/src/multimedia/audio/qaudiobuffer.cpp
index 586ab4490..3d7346a97 100644
--- a/src/multimedia/audio/qaudiobuffer.cpp
+++ b/src/multimedia/audio/qaudiobuffer.cpp
@@ -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
{
diff --git a/src/multimedia/audio/qaudiodecoder.cpp b/src/multimedia/audio/qaudiodecoder.cpp
index 3f0fcd4dd..9397d7419 100644
--- a/src/multimedia/audio/qaudiodecoder.cpp
+++ b/src/multimedia/audio/qaudiodecoder.cpp
@@ -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)
diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp
index a36ab3932..50f4a7676 100644
--- a/src/multimedia/audio/qaudiodevicefactory.cpp
+++ b/src/multimedia/audio/qaudiodevicefactory.cpp
@@ -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();
diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp
index ff31f3534..ca42373e2 100644
--- a/src/multimedia/audio/qaudiodeviceinfo.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo.cpp
@@ -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:
diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp
index b83256a10..6992bf992 100644
--- a/src/multimedia/audio/qaudioformat.cpp
+++ b/src/multimedia/audio/qaudioformat.cpp
@@ -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
{
diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp
index 32bab0019..84833c6a3 100644
--- a/src/multimedia/camera/qcamera.cpp
+++ b/src/multimedia/camera/qcamera.cpp
@@ -56,26 +56,21 @@
#include <QDebug>
-namespace
-{
-class CameraRegisterMetaTypes
+QT_BEGIN_NAMESPACE
+
+static void qRegisterCameraMetaTypes()
{
-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
diff --git a/src/multimedia/camera/qcameraexposure.cpp b/src/multimedia/camera/qcameraexposure.cpp
index 4385cd4a4..7f1ef842a 100644
--- a/src/multimedia/camera/qcameraexposure.cpp
+++ b/src/multimedia/camera/qcameraexposure.cpp
@@ -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
diff --git a/src/multimedia/camera/qcamerafocus.cpp b/src/multimedia/camera/qcamerafocus.cpp
index cae285167..0b6d331b4 100644
--- a/src/multimedia/camera/qcamerafocus.cpp
+++ b/src/multimedia/camera/qcamerafocus.cpp
@@ -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:
diff --git a/src/multimedia/camera/qcameraimagecapture.cpp b/src/multimedia/camera/qcameraimagecapture.cpp
index 409db4947..400c2b925 100644
--- a/src/multimedia/camera/qcameraimagecapture.cpp
+++ b/src/multimedia/camera/qcameraimagecapture.cpp
@@ -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
{
diff --git a/src/multimedia/camera/qcameraimageprocessing.cpp b/src/multimedia/camera/qcameraimageprocessing.cpp
index 7df222458..6f08b7860 100644
--- a/src/multimedia/camera/qcameraimageprocessing.cpp
+++ b/src/multimedia/camera/qcameraimageprocessing.cpp
@@ -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
diff --git a/src/multimedia/controls/qcameraimageprocessingcontrol.cpp b/src/multimedia/controls/qcameraimageprocessingcontrol.cpp
index f9cb8c86f..944b09643 100644
--- a/src/multimedia/controls/qcameraimageprocessingcontrol.cpp
+++ b/src/multimedia/controls/qcameraimageprocessingcontrol.cpp
@@ -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
diff --git a/src/multimedia/controls/qmediastreamscontrol.cpp b/src/multimedia/controls/qmediastreamscontrol.cpp
index a054289f7..11d31599d 100644
--- a/src/multimedia/controls/qmediastreamscontrol.cpp
+++ b/src/multimedia/controls/qmediastreamscontrol.cpp
@@ -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
diff --git a/src/multimedia/doc/src/audiooverview.qdoc b/src/multimedia/doc/src/audiooverview.qdoc
index 54735da6c..32556543b 100644
--- a/src/multimedia/doc/src/audiooverview.qdoc
+++ b/src/multimedia/doc/src/audiooverview.qdoc
@@ -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.
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 23cca2537..0f3ced913 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -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)
diff --git a/src/multimedia/playback/playlistfileparser.cpp b/src/multimedia/playback/playlistfileparser.cpp
index ae14d2159..1254d6131 100644
--- a/src/multimedia/playback/playlistfileparser.cpp
+++ b/src/multimedia/playback/playlistfileparser.cpp
@@ -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;
}
diff --git a/src/multimedia/playback/qmediacontent.cpp b/src/multimedia/playback/qmediacontent.cpp
index 4c32128f5..ff3ed28d3 100644
--- a/src/multimedia/playback/qmediacontent.cpp
+++ b/src/multimedia/playback/qmediacontent.cpp
@@ -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
{
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index bf6294a1e..e8899ddff 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -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()
*/
diff --git a/src/multimedia/playback/qmediaplaylist.cpp b/src/multimedia/playback/qmediaplaylist.cpp
index 68a8917f5..a81681079 100644
--- a/src/multimedia/playback/qmediaplaylist.cpp
+++ b/src/multimedia/playback/qmediaplaylist.cpp
@@ -61,19 +61,14 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, playlistIOLoader,
(QMediaPlaylistIOInterface_iid, QLatin1String("playlistformats"), Qt::CaseInsensitive))
-namespace
-{
- class QMediaPlaylistPrivateRegisterMetaTypes
- {
- public:
- QMediaPlaylistPrivateRegisterMetaTypes()
- {
- qRegisterMetaType<QMediaPlaylist::Error>();
- qRegisterMetaType<QMediaPlaylist::PlaybackMode>();
- }
- } _registerMetaTypes;
+static void qRegisterMediaPlaylistMetaTypes()
+{
+ qRegisterMetaType<QMediaPlaylist::Error>();
+ qRegisterMetaType<QMediaPlaylist::PlaybackMode>();
}
+Q_CONSTRUCTOR_FUNCTION(qRegisterMediaPlaylistMetaTypes)
+
/*!
\class QMediaPlaylist
diff --git a/src/multimedia/playback/qmediaresource.cpp b/src/multimedia/playback/qmediaresource.cpp
index 62c982ca7..4997620a9 100644
--- a/src/multimedia/playback/qmediaresource.cpp
+++ b/src/multimedia/playback/qmediaresource.cpp
@@ -47,19 +47,15 @@
QT_BEGIN_NAMESPACE
-namespace
-{
- class QMediaResourcePrivateRegisterMetaTypes
- {
- public:
- QMediaResourcePrivateRegisterMetaTypes()
- {
- qRegisterMetaType<QMediaResource>();
- qRegisterMetaType<QMediaResourceList>();
- }
- } _registerMetaTypes;
+static void qRegisterMediaResourceMetaTypes()
+{
+ qRegisterMetaType<QMediaResource>();
+ qRegisterMetaType<QMediaResourceList>();
}
+Q_CONSTRUCTOR_FUNCTION(qRegisterMediaResourceMetaTypes)
+
+
/*!
\class QMediaResource
diff --git a/src/multimedia/qmediastoragelocation.cpp b/src/multimedia/qmediastoragelocation.cpp
new file mode 100644
index 000000000..877c12138
--- /dev/null
+++ b/src/multimedia/qmediastoragelocation.cpp
@@ -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
diff --git a/src/multimedia/qmediastoragelocation_p.h b/src/multimedia/qmediastoragelocation_p.h
new file mode 100644
index 000000000..600fb63ff
--- /dev/null
+++ b/src/multimedia/qmediastoragelocation_p.h
@@ -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
diff --git a/src/multimedia/qmultimedia.cpp b/src/multimedia/qmultimedia.cpp
index 0f4d98f7f..140d4a348 100644
--- a/src/multimedia/qmultimedia.cpp
+++ b/src/multimedia/qmultimedia.cpp
@@ -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
diff --git a/src/multimedia/radio/qradiodata.cpp b/src/multimedia/radio/qradiodata.cpp
index 66b051a47..d6bde35ba 100644
--- a/src/multimedia/radio/qradiodata.cpp
+++ b/src/multimedia/radio/qradiodata.cpp
@@ -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.
diff --git a/src/multimedia/radio/qradiotuner.cpp b/src/multimedia/radio/qradiotuner.cpp
index 9255783d0..29a0d6d37 100644
--- a/src/multimedia/radio/qradiotuner.cpp
+++ b/src/multimedia/radio/qradiotuner.cpp
@@ -52,22 +52,17 @@
QT_BEGIN_NAMESPACE
-namespace
-{
- class QRadioTunerPrivateRegisterMetaTypes
- {
- public:
- QRadioTunerPrivateRegisterMetaTypes()
- {
- qRegisterMetaType<QRadioTuner::Band>();
- qRegisterMetaType<QRadioTuner::Error>();
- qRegisterMetaType<QRadioTuner::SearchMode>();
- qRegisterMetaType<QRadioTuner::State>();
- qRegisterMetaType<QRadioTuner::StereoMode>();
- }
- } _registerMetaTypes;
+static void qRegisterRadioTunerMetaTypes()
+{
+ qRegisterMetaType<QRadioTuner::Band>();
+ qRegisterMetaType<QRadioTuner::Error>();
+ qRegisterMetaType<QRadioTuner::SearchMode>();
+ qRegisterMetaType<QRadioTuner::State>();
+ qRegisterMetaType<QRadioTuner::StereoMode>();
}
+Q_CONSTRUCTOR_FUNCTION(qRegisterRadioTunerMetaTypes)
+
/*!
\class QRadioTuner
diff --git a/src/multimedia/recording/qmediaencodersettings.cpp b/src/multimedia/recording/qmediaencodersettings.cpp
index 731692643..e75115116 100644
--- a/src/multimedia/recording/qmediaencodersettings.cpp
+++ b/src/multimedia/recording/qmediaencodersettings.cpp
@@ -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:
diff --git a/src/multimedia/recording/qmediarecorder.cpp b/src/multimedia/recording/qmediarecorder.cpp
index f38de025c..7c28caf98 100644
--- a/src/multimedia/recording/qmediarecorder.cpp
+++ b/src/multimedia/recording/qmediarecorder.cpp
@@ -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),
diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp
index 5f69382e3..79da6f9b7 100644
--- a/src/multimedia/video/qabstractvideobuffer.cpp
+++ b/src/multimedia/video/qabstractvideobuffer.cpp
@@ -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.
diff --git a/src/multimedia/video/qabstractvideosurface.cpp b/src/multimedia/video/qabstractvideosurface.cpp
index e62c514d7..ff9356122 100644
--- a/src/multimedia/video/qabstractvideosurface.cpp
+++ b/src/multimedia/video/qabstractvideosurface.cpp
@@ -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:
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index e4ce21361..4a32bc557 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -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
{
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp
index 5806f3b9b..56814f478 100644
--- a/src/multimedia/video/qvideosurfaceformat.cpp
+++ b/src/multimedia/video/qvideosurfaceformat.cpp
@@ -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
{