summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qaudio.cpp22
-rw-r--r--src/multimedia/audio/qaudio.h2
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.cpp48
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.h5
-rw-r--r--src/multimedia/camera/qcamera.h5
-rw-r--r--src/multimedia/doc/qtmultimedia.qdocconf3
-rw-r--r--src/multimedia/gsttools_headers/gstvideoconnector_p.h8
-rw-r--r--src/multimedia/gsttools_headers/qgstappsrc_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstcodecsinfo_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h4
-rw-r--r--src/multimedia/gsttools_headers/qgstreamerbushelper_p.h4
-rw-r--r--src/multimedia/gsttools_headers/qgstreamermessage_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideowidget_p.h5
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideowindow_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgsttools_global_p.h70
-rw-r--r--src/multimedia/gsttools_headers/qgstutils_p.h87
-rw-r--r--src/multimedia/gsttools_headers/qgstvideobuffer_p.h5
-rw-r--r--src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h7
-rw-r--r--src/multimedia/multimedia.pro4
-rw-r--r--src/multimedia/playback/qmedianetworkplaylistprovider.cpp3
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp12
-rw-r--r--src/multimedia/playback/qmediaplaylistnavigator.cpp5
-rw-r--r--src/multimedia/qmediaobject.cpp8
-rw-r--r--src/multimedia/video/qimagevideobuffer.cpp2
30 files changed, 236 insertions, 103 deletions
diff --git a/src/multimedia/audio/qaudio.cpp b/src/multimedia/audio/qaudio.cpp
index d4f89e898..dea9a05a5 100644
--- a/src/multimedia/audio/qaudio.cpp
+++ b/src/multimedia/audio/qaudio.cpp
@@ -79,13 +79,18 @@ Q_CONSTRUCTOR_FUNCTION(qRegisterAudioMetaTypes)
/*!
\enum QAudio::State
- \value ActiveState Audio data is being processed, this state is set after start() is called
- and while audio data is available to be processed.
- \value SuspendedState The audio device is in a suspended state, this state will only be entered
- after suspend() is called.
- \value StoppedState The audio device is closed, and is not processing any audio data
- \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state
- is set after start() is called and while no audio data is available to be processed.
+ \value ActiveState Audio data is being processed, this state is set after start() is called
+ and while audio data is available to be processed.
+ \value SuspendedState The audio stream is in a suspended state. Entered after suspend() is called
+ or when another stream takes control of the audio device. In the later case,
+ a call to resume will return control of the audio device to this stream. This
+ should usually only be done upon user request.
+ \value StoppedState The audio device is closed, and is not processing any audio data
+ \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state
+ is set after start() is called and while no audio data is available to be processed.
+ \value InterruptedState This stream is in a suspended state because another higher priority stream currently
+ has control of the audio device. Playback cannot resume until the higher priority
+ stream relinquishes control of the audio device.
*/
/*!
@@ -285,6 +290,9 @@ QDebug operator<<(QDebug dbg, QAudio::State state)
case QAudio::IdleState:
dbg << "IdleState";
break;
+ case QAudio::InterruptedState:
+ dbg << "InterruptedState";
+ break;
}
return dbg;
}
diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h
index 1c38e9f35..2603d71d1 100644
--- a/src/multimedia/audio/qaudio.h
+++ b/src/multimedia/audio/qaudio.h
@@ -55,7 +55,7 @@ class QString;
namespace QAudio
{
enum Error { NoError, OpenError, IOError, UnderrunError, FatalError };
- enum State { ActiveState, SuspendedState, StoppedState, IdleState };
+ enum State { ActiveState, SuspendedState, StoppedState, IdleState, InterruptedState };
enum Mode { AudioInput, AudioOutput };
enum Role {
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
index a4861d2a9..981d4c01f 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
@@ -73,20 +73,23 @@ inline pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format)
spec.rate = format.sampleRate();
spec.channels = format.channelCount();
-
- if (format.sampleSize() == 8)
- spec.format = PA_SAMPLE_U8;
- else if (format.sampleSize() == 16) {
- switch (format.byteOrder()) {
- case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S16BE; break;
- case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S16LE; break;
- }
- }
- else if (format.sampleSize() == 32) {
- switch (format.byteOrder()) {
- case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S32BE; break;
- case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S32LE; break;
+ spec.format = PA_SAMPLE_INVALID;
+ const bool isBigEndian = (format.byteOrder() == QAudioFormat::BigEndian);
+
+ if (format.sampleType() == QAudioFormat::UnSignedInt) {
+ if (format.sampleSize() == 8)
+ spec.format = PA_SAMPLE_U8;
+ } else if (format.sampleType() == QAudioFormat::SignedInt) {
+ if (format.sampleSize() == 16) {
+ spec.format = isBigEndian ? PA_SAMPLE_S16BE : PA_SAMPLE_S16LE;
+ } else if (format.sampleSize() == 24) {
+ spec.format = isBigEndian ? PA_SAMPLE_S24BE : PA_SAMPLE_S24LE;
+ } else if (format.sampleSize() == 32) {
+ spec.format = isBigEndian ? PA_SAMPLE_S32BE : PA_SAMPLE_S32LE;
}
+ } else if (format.sampleType() == QAudioFormat::Float) {
+ if (format.sampleSize() == 32)
+ spec.format = isBigEndian ? PA_SAMPLE_FLOAT32BE : PA_SAMPLE_FLOAT32LE;
}
return spec;
@@ -190,7 +193,11 @@ private Q_SLOTS:
pa_context_set_state_callback(m_context, context_state_callback, this);
- if (pa_context_connect(m_context, 0, (pa_context_flags_t)0, 0) < 0) {
+ const QByteArray srvStrEnv = qgetenv("QT_PULSE_SERVER_STRING");
+ const char *srvStr = srvStrEnv.isNull() ? 0 : srvStrEnv.constData();
+ pa_context_flags_t flags = qEnvironmentVariableIsSet("QT_PULSE_NOAUTOSPAWN") ? PA_CONTEXT_NOAUTOSPAWN : (pa_context_flags_t)0;
+
+ if (pa_context_connect(m_context, srvStr, flags, 0) < 0) {
qWarning("PulseAudioService: pa_context_connect() failed");
pa_context_unref(m_context);
unlock();
@@ -529,31 +536,34 @@ void QSoundEffectPrivate::setLoopCount(int loopCount)
qreal QSoundEffectPrivate::volume() const
{
- QReadLocker locker(&m_volumeLock);
+ QMutexLocker locker(&m_volumeLock);
return m_volume;
}
void QSoundEffectPrivate::setVolume(qreal volume)
{
- QWriteLocker locker(&m_volumeLock);
+ QMutexLocker locker(&m_volumeLock);
if (qFuzzyCompare(m_volume, volume))
return;
m_volume = qBound(qreal(0), volume, qreal(1));
+ locker.unlock();
emit volumeChanged();
}
bool QSoundEffectPrivate::isMuted() const
{
- QReadLocker locker(&m_volumeLock);
+ QMutexLocker locker(&m_volumeLock);
return m_muted;
}
void QSoundEffectPrivate::setMuted(bool muted)
{
- QWriteLocker locker(&m_volumeLock);
+ m_volumeLock.lock();
m_muted = muted;
+ m_volumeLock.unlock();
+
emit mutedChanged();
}
@@ -878,7 +888,7 @@ int QSoundEffectPrivate::writeToStream(const void *data, int size)
if (size < 1)
return 0;
- m_volumeLock.lockForRead();
+ m_volumeLock.lock();
qreal volume = m_muted ? 0 : m_volume;
m_volumeLock.unlock();
pa_free_cb_t writeDoneCb = stream_write_done_callback;
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h
index 7be88c55a..268a99326 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.h
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.h
@@ -56,7 +56,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qdatetime.h>
-#include <QtCore/qreadwritelock.h>
+#include <QtCore/qmutex.h>
#include <qmediaplayer.h>
#include <pulse/pulseaudio.h>
#include "qsamplecache_p.h"
@@ -175,7 +175,8 @@ private:
bool m_resourcesAvailable;
- mutable QReadWriteLock m_volumeLock;
+ // Protects volume while PuseAudio is accessing it
+ mutable QMutex m_volumeLock;
QMediaPlayerResourceSetInterface *m_resources;
};
diff --git a/src/multimedia/camera/qcamera.h b/src/multimedia/camera/qcamera.h
index 685298905..aebd1c013 100644
--- a/src/multimedia/camera/qcamera.h
+++ b/src/multimedia/camera/qcamera.h
@@ -262,7 +262,10 @@ QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
QT_WARNING_DISABLE_GCC("-Wfloat-equal")
Q_DECL_CONSTEXPR Q_INLINE_TEMPLATE bool operator==(const QCamera::FrameRateRange &r1, const QCamera::FrameRateRange &r2) Q_DECL_NOTHROW
-{ return r1.minimumFrameRate == r2.minimumFrameRate && r1.maximumFrameRate == r2.maximumFrameRate; }
+{
+ return qFuzzyCompare(r1.minimumFrameRate, r2.minimumFrameRate)
+ && qFuzzyCompare(r1.maximumFrameRate, r2.maximumFrameRate);
+}
QT_WARNING_POP
diff --git a/src/multimedia/doc/qtmultimedia.qdocconf b/src/multimedia/doc/qtmultimedia.qdocconf
index e3d3827c5..074fcb75e 100644
--- a/src/multimedia/doc/qtmultimedia.qdocconf
+++ b/src/multimedia/doc/qtmultimedia.qdocconf
@@ -43,6 +43,9 @@ qhp.QtMultimedia.subprojects.examples.sortPages = true
exampledirs += ../../../examples \
snippets
+manifestmeta.highlighted.names = "QtMultimedia/QML Video Shader Effects Example" \
+ "QtMultimedia/Media Player Example"
+
headerdirs += ../..
imagedirs += src/images \
diff --git a/src/multimedia/gsttools_headers/gstvideoconnector_p.h b/src/multimedia/gsttools_headers/gstvideoconnector_p.h
index 4fa1456c8..a38ca2e65 100644
--- a/src/multimedia/gsttools_headers/gstvideoconnector_p.h
+++ b/src/multimedia/gsttools_headers/gstvideoconnector_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
+
#include <gst/gst.h>
G_BEGIN_DECLS
@@ -69,7 +71,7 @@ G_BEGIN_DECLS
typedef struct _GstVideoConnector GstVideoConnector;
typedef struct _GstVideoConnectorClass GstVideoConnectorClass;
-struct _GstVideoConnector {
+struct Q_GSTTOOLS_EXPORT _GstVideoConnector {
GstElement element;
GstPad *srcpad;
@@ -81,14 +83,14 @@ struct _GstVideoConnector {
GstBuffer *latest_buffer;
};
-struct _GstVideoConnectorClass {
+struct Q_GSTTOOLS_EXPORT _GstVideoConnectorClass {
GstElementClass parent_class;
/* action signal to resend new segment */
void (*resend_new_segment) (GstElement * element, gboolean emitFailedSignal);
};
-GType gst_video_connector_get_type (void);
+GType Q_GSTTOOLS_EXPORT gst_video_connector_get_type (void);
G_END_DECLS
diff --git a/src/multimedia/gsttools_headers/qgstappsrc_p.h b/src/multimedia/gsttools_headers/qgstappsrc_p.h
index e50915231..c7e87037d 100644
--- a/src/multimedia/gsttools_headers/qgstappsrc_p.h
+++ b/src/multimedia/gsttools_headers/qgstappsrc_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qiodevice.h>
@@ -63,7 +64,7 @@
QT_BEGIN_NAMESPACE
-class QGstAppSrc : public QObject
+class Q_GSTTOOLS_EXPORT QGstAppSrc : public QObject
{
Q_OBJECT
public:
diff --git a/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
index e03da1ab5..45e573262 100644
--- a/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
+++ b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qabstractvideobuffer.h>
#include <qvideosurfaceformat.h>
#include <QtCore/qobject.h>
@@ -65,7 +66,7 @@ const QLatin1String QGstBufferPoolPluginKey("bufferpool");
/*!
Abstract interface for video buffers allocation.
*/
-class QGstBufferPoolInterface
+class Q_GSTTOOLS_EXPORT QGstBufferPoolInterface
{
public:
virtual ~QGstBufferPoolInterface() {}
diff --git a/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
index af1a4486f..33ab3de4b 100644
--- a/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
+++ b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QtCore/qmap.h>
#include <QtCore/qstringlist.h>
@@ -58,7 +59,7 @@
QT_BEGIN_NAMESPACE
-class QGstCodecsInfo
+class Q_GSTTOOLS_EXPORT QGstCodecsInfo
{
public:
enum ElementType { AudioEncoder, VideoEncoder, Muxer };
diff --git a/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h b/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
index 1a961c6d9..0c193fda9 100644
--- a/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
+++ b/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
@@ -51,12 +51,13 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qaudioinputselectorcontrol.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
-class QGstreamerAudioInputSelector : public QAudioInputSelectorControl
+class Q_GSTTOOLS_EXPORT QGstreamerAudioInputSelector : public QAudioInputSelectorControl
{
Q_OBJECT
public:
diff --git a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
index bacf8c71d..4fc5c7704 100644
--- a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <gst/gst.h>
#include <qmediaaudioprobecontrol.h>
#include <QtCore/qmutex.h>
@@ -61,7 +62,7 @@
QT_BEGIN_NAMESPACE
-class QGstreamerAudioProbeControl
+class Q_GSTTOOLS_EXPORT QGstreamerAudioProbeControl
: public QMediaAudioProbeControl
, public QGstreamerBufferProbe
, public QSharedData
diff --git a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
index f7ba2bbd9..35644f934 100644
--- a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
@@ -51,13 +51,15 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <gst/gst.h>
#include <QtCore/qglobal.h>
+
QT_BEGIN_NAMESPACE
-class QGstreamerBufferProbe
+class Q_GSTTOOLS_EXPORT QGstreamerBufferProbe
{
public:
enum Flags
diff --git a/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h b/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
index 3216c07da..c7d06faf8 100644
--- a/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
@@ -51,9 +51,11 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QObject>
#include "qgstreamermessage_p.h"
+
#include <gst/gst.h>
QT_BEGIN_NAMESPACE
@@ -78,7 +80,7 @@ Q_DECLARE_INTERFACE(QGstreamerBusMessageFilter, QGstreamerBusMessageFilter_iid)
class QGstreamerBusHelperPrivate;
-class QGstreamerBusHelper : public QObject
+class Q_GSTTOOLS_EXPORT QGstreamerBusHelper : public QObject
{
Q_OBJECT
friend class QGstreamerBusHelperPrivate;
diff --git a/src/multimedia/gsttools_headers/qgstreamermessage_p.h b/src/multimedia/gsttools_headers/qgstreamermessage_p.h
index 5d832ccfa..2f9d1745c 100644
--- a/src/multimedia/gsttools_headers/qgstreamermessage_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamermessage_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QMetaType>
#include <gst/gst.h>
@@ -60,7 +61,7 @@ QT_BEGIN_NAMESPACE
// Required for QDoc workaround
class QString;
-class QGstreamerMessage
+class Q_GSTTOOLS_EXPORT QGstreamerMessage
{
public:
QGstreamerMessage();
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
index e1ac453c7..b660cc7b3 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qvideodeviceselectorcontrol.h>
#include <QtCore/qstringlist.h>
@@ -59,7 +60,7 @@
QT_BEGIN_NAMESPACE
-class QGstreamerVideoInputDeviceControl : public QVideoDeviceSelectorControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoInputDeviceControl : public QVideoDeviceSelectorControl
{
Q_OBJECT
public:
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
index b599b0e78..b15b6099c 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <qmediavideoprobecontrol.h>
@@ -62,7 +63,7 @@
QT_BEGIN_NAMESPACE
-class QGstreamerVideoProbeControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoProbeControl
: public QMediaVideoProbeControl
, public QGstreamerBufferProbe
, public QSharedData
diff --git a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
index 1d22e1125..2f0b80d45 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qvideorenderercontrol.h>
#include <private/qvideosurfacegstsink_p.h>
#include <qabstractvideosurface.h>
@@ -59,7 +60,7 @@
QT_BEGIN_NAMESPACE
-class QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface
{
Q_OBJECT
Q_INTERFACES(QGstreamerVideoRendererInterface)
diff --git a/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
index b2dfece60..3e3240725 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qvideowidgetcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
@@ -59,9 +60,9 @@
QT_BEGIN_NAMESPACE
-class QGstreamerVideoWidget;
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWidget;
-class QGstreamerVideoWidgetControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWidgetControl
: public QVideoWidgetControl
, public QGstreamerVideoRendererInterface
, public QGstreamerSyncMessageFilter
diff --git a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
index b489650f9..5f893f10e 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qvideowindowcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
@@ -61,7 +62,7 @@
QT_BEGIN_NAMESPACE
class QAbstractVideoSurface;
-class QGstreamerVideoWindow :
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWindow :
public QVideoWindowControl,
public QGstreamerVideoRendererInterface,
public QGstreamerSyncMessageFilter,
diff --git a/src/multimedia/gsttools_headers/qgsttools_global_p.h b/src/multimedia/gsttools_headers/qgsttools_global_p.h
new file mode 100644
index 000000000..babcd3aaf
--- /dev/null
+++ b/src/multimedia/gsttools_headers/qgsttools_global_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** 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 The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGSTTOOLS_GLOBAL_H
+#define QGSTTOOLS_GLOBAL_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_MULTIMEDIAGSTTOOLS_LIB)
+# define Q_GSTTOOLS_EXPORT Q_DECL_EXPORT
+# else
+# define Q_GSTTOOLS_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_GSTTOOLS_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QGSTTOOLS_GLOBAL_H
diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h
index 8b7de3661..24d3e889d 100644
--- a/src/multimedia/gsttools_headers/qgstutils_p.h
+++ b/src/multimedia/gsttools_headers/qgstutils_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QtCore/qmap.h>
#include <QtCore/qset.h>
#include <QtCore/qvector.h>
@@ -85,7 +86,7 @@ class QImage;
class QVideoSurfaceFormat;
namespace QGstUtils {
- struct CameraInfo
+ struct Q_GSTTOOLS_EXPORT CameraInfo
{
QString name;
QString description;
@@ -94,74 +95,74 @@ namespace QGstUtils {
QByteArray driver;
};
- QMap<QByteArray, QVariant> gstTagListToMap(const GstTagList *list);
+ Q_GSTTOOLS_EXPORT QMap<QByteArray, QVariant> gstTagListToMap(const GstTagList *list);
- QSize capsResolution(const GstCaps *caps);
- QSize capsCorrectedResolution(const GstCaps *caps);
- QAudioFormat audioFormatForCaps(const GstCaps *caps);
+ Q_GSTTOOLS_EXPORT QSize capsResolution(const GstCaps *caps);
+ Q_GSTTOOLS_EXPORT QSize capsCorrectedResolution(const GstCaps *caps);
+ Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForCaps(const GstCaps *caps);
#if GST_CHECK_VERSION(1,0,0)
- QAudioFormat audioFormatForSample(GstSample *sample);
+ Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForSample(GstSample *sample);
#else
- QAudioFormat audioFormatForBuffer(GstBuffer *buffer);
+ Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForBuffer(GstBuffer *buffer);
#endif
- GstCaps *capsForAudioFormat(const QAudioFormat &format);
- void initializeGst();
- QMultimedia::SupportEstimate hasSupport(const QString &mimeType,
+ Q_GSTTOOLS_EXPORT GstCaps *capsForAudioFormat(const QAudioFormat &format);
+ Q_GSTTOOLS_EXPORT void initializeGst();
+ Q_GSTTOOLS_EXPORT QMultimedia::SupportEstimate hasSupport(const QString &mimeType,
const QStringList &codecs,
const QSet<QString> &supportedMimeTypeSet);
- QVector<CameraInfo> enumerateCameras(GstElementFactory *factory = 0);
- QList<QByteArray> cameraDevices(GstElementFactory * factory = 0);
- QString cameraDescription(const QString &device, GstElementFactory * factory = 0);
- QCamera::Position cameraPosition(const QString &device, GstElementFactory * factory = 0);
- int cameraOrientation(const QString &device, GstElementFactory * factory = 0);
- QByteArray cameraDriver(const QString &device, GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT QVector<CameraInfo> enumerateCameras(GstElementFactory *factory = 0);
+ Q_GSTTOOLS_EXPORT QList<QByteArray> cameraDevices(GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT QString cameraDescription(const QString &device, GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT QCamera::Position cameraPosition(const QString &device, GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT int cameraOrientation(const QString &device, GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT QByteArray cameraDriver(const QString &device, GstElementFactory * factory = 0);
- QSet<QString> supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory));
+ Q_GSTTOOLS_EXPORT QSet<QString> supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory));
#if GST_CHECK_VERSION(1,0,0)
- QImage bufferToImage(GstBuffer *buffer, const GstVideoInfo &info);
- QVideoSurfaceFormat formatForCaps(
+ Q_GSTTOOLS_EXPORT QImage bufferToImage(GstBuffer *buffer, const GstVideoInfo &info);
+ Q_GSTTOOLS_EXPORT QVideoSurfaceFormat formatForCaps(
GstCaps *caps,
GstVideoInfo *info = 0,
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
#else
- QImage bufferToImage(GstBuffer *buffer);
- QVideoSurfaceFormat formatForCaps(
+ Q_GSTTOOLS_EXPORT QImage bufferToImage(GstBuffer *buffer);
+ Q_GSTTOOLS_EXPORT QVideoSurfaceFormat formatForCaps(
GstCaps *caps,
int *bytesPerLine = 0,
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
#endif
- GstCaps *capsForFormats(const QList<QVideoFrame::PixelFormat> &formats);
+ Q_GSTTOOLS_EXPORT GstCaps *capsForFormats(const QList<QVideoFrame::PixelFormat> &formats);
void setFrameTimeStamps(QVideoFrame *frame, GstBuffer *buffer);
- void setMetaData(GstElement *element, const QMap<QByteArray, QVariant> &data);
- void setMetaData(GstBin *bin, const QMap<QByteArray, QVariant> &data);
+ Q_GSTTOOLS_EXPORT void setMetaData(GstElement *element, const QMap<QByteArray, QVariant> &data);
+ Q_GSTTOOLS_EXPORT void setMetaData(GstBin *bin, const QMap<QByteArray, QVariant> &data);
- GstCaps *videoFilterCaps();
+ Q_GSTTOOLS_EXPORT GstCaps *videoFilterCaps();
- QSize structureResolution(const GstStructure *s);
- QVideoFrame::PixelFormat structurePixelFormat(const GstStructure *s, int *bpp = 0);
- QSize structurePixelAspectRatio(const GstStructure *s);
- QPair<qreal, qreal> structureFrameRateRange(const GstStructure *s);
+ Q_GSTTOOLS_EXPORT QSize structureResolution(const GstStructure *s);
+ Q_GSTTOOLS_EXPORT QVideoFrame::PixelFormat structurePixelFormat(const GstStructure *s, int *bpp = 0);
+ Q_GSTTOOLS_EXPORT QSize structurePixelAspectRatio(const GstStructure *s);
+ Q_GSTTOOLS_EXPORT QPair<qreal, qreal> structureFrameRateRange(const GstStructure *s);
- QString fileExtensionForMimeType(const QString &mimeType);
+ Q_GSTTOOLS_EXPORT QString fileExtensionForMimeType(const QString &mimeType);
}
-void qt_gst_object_ref_sink(gpointer object);
-GstCaps *qt_gst_pad_get_current_caps(GstPad *pad);
-GstCaps *qt_gst_pad_get_caps(GstPad *pad);
-GstStructure *qt_gst_structure_new_empty(const char *name);
-gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
-gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
-GstCaps *qt_gst_caps_normalize(GstCaps *caps);
-const gchar *qt_gst_element_get_factory_name(GstElement *element);
-gboolean qt_gst_caps_can_intersect(const GstCaps * caps1, const GstCaps * caps2);
-GList *qt_gst_video_sinks();
-void qt_gst_util_double_to_fraction(gdouble src, gint *dest_n, gint *dest_d);
-
-QDebug operator <<(QDebug debug, GstCaps *caps);
+Q_GSTTOOLS_EXPORT void qt_gst_object_ref_sink(gpointer object);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_pad_get_current_caps(GstPad *pad);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_pad_get_caps(GstPad *pad);
+Q_GSTTOOLS_EXPORT GstStructure *qt_gst_structure_new_empty(const char *name);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_caps_normalize(GstCaps *caps);
+Q_GSTTOOLS_EXPORT const gchar *qt_gst_element_get_factory_name(GstElement *element);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_caps_can_intersect(const GstCaps * caps1, const GstCaps * caps2);
+Q_GSTTOOLS_EXPORT GList *qt_gst_video_sinks();
+Q_GSTTOOLS_EXPORT void qt_gst_util_double_to_fraction(gdouble src, gint *dest_n, gint *dest_d);
+
+Q_GSTTOOLS_EXPORT QDebug operator <<(QDebug debug, GstCaps *caps);
QT_END_NAMESPACE
diff --git a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
index d2802d9a2..c67c57021 100644
--- a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
+++ b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qabstractvideobuffer.h>
#include <QtCore/qvariant.h>
@@ -60,14 +61,14 @@
QT_BEGIN_NAMESPACE
#if GST_CHECK_VERSION(1,0,0)
-class QGstVideoBuffer : public QAbstractPlanarVideoBuffer
+class Q_GSTTOOLS_EXPORT QGstVideoBuffer : public QAbstractPlanarVideoBuffer
{
public:
QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info);
QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info,
HandleType handleType, const QVariant &handle);
#else
-class QGstVideoBuffer : public QAbstractVideoBuffer
+class Q_GSTTOOLS_EXPORT QGstVideoBuffer : public QAbstractVideoBuffer
{
public:
QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine);
diff --git a/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h b/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
index 6a0c4c6bd..df36dbe09 100644
--- a/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
+++ b/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qabstractvideobuffer.h>
#include <qvideosurfaceformat.h>
#include <QtCore/qobject.h>
@@ -64,7 +65,7 @@ class QAbstractVideoSurface;
const QLatin1String QGstVideoRendererPluginKey("gstvideorenderer");
-class QGstVideoRenderer
+class Q_GSTTOOLS_EXPORT QGstVideoRenderer
{
public:
virtual ~QGstVideoRenderer() {}
@@ -81,7 +82,7 @@ public:
/*
Abstract interface for video buffers allocation.
*/
-class QGstVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstVideoRendererInterface
{
public:
virtual ~QGstVideoRendererInterface() {}
@@ -92,7 +93,7 @@ public:
#define QGstVideoRendererInterface_iid "org.qt-project.qt.gstvideorenderer/5.4"
Q_DECLARE_INTERFACE(QGstVideoRendererInterface, QGstVideoRendererInterface_iid)
-class QGstVideoRendererPlugin : public QObject, public QGstVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstVideoRendererPlugin : public QObject, public QGstVideoRendererInterface
{
Q_OBJECT
Q_INTERFACES(QGstVideoRendererInterface)
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 0f3f3ff6b..d5d8b40d3 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -72,9 +72,9 @@ ANDROID_JAR_DEPENDENCIES = \
jar/QtMultimedia.jar:org.qtproject.qt5.android.multimedia.QtMultimediaUtils
ANDROID_LIB_DEPENDENCIES = \
plugins/mediaservice/libqtmedia_android.so \
- lib/libQt5MultimediaQuick_p.so:Qt5Quick
+ lib/libQt5MultimediaQuick.so:Qt5Quick
ANDROID_BUNDLED_FILES += \
- lib/libQt5MultimediaQuick_p.so
+ lib/libQt5MultimediaQuick.so
ANDROID_PERMISSIONS += \
android.permission.CAMERA \
android.permission.RECORD_AUDIO
diff --git a/src/multimedia/playback/qmedianetworkplaylistprovider.cpp b/src/multimedia/playback/qmedianetworkplaylistprovider.cpp
index a4ad97251..3f24d0f55 100644
--- a/src/multimedia/playback/qmedianetworkplaylistprovider.cpp
+++ b/src/multimedia/playback/qmedianetworkplaylistprovider.cpp
@@ -42,6 +42,7 @@
#include "qmediacontent.h"
#include "qmediaobject_p.h"
#include "qplaylistfileparser_p.h"
+#include "qrandom.h"
QT_BEGIN_NAMESPACE
@@ -266,7 +267,7 @@ void QMediaNetworkPlaylistProvider::shuffle()
QList<QMediaContent> resources;
while (!d->resources.isEmpty()) {
- resources.append(d->resources.takeAt(qrand() % d->resources.size()));
+ resources.append(d->resources.takeAt(QRandomGenerator::global()->bounded(d->resources.size())));
}
d->resources = resources;
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 16fdec8ea..a3484a6ff 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -718,7 +718,17 @@ void QMediaPlayer::setNetworkConfigurations(const QList<QNetworkConfiguration> &
QMediaPlayer::State QMediaPlayer::state() const
{
- return d_func()->state;
+ Q_D(const QMediaPlayer);
+
+ // In case if EndOfMedia status is already received
+ // but state is not.
+ if (d->control != 0
+ && d->status == QMediaPlayer::EndOfMedia
+ && d->state != d->control->state()) {
+ return d->control->state();
+ }
+
+ return d->state;
}
QMediaPlayer::MediaStatus QMediaPlayer::mediaStatus() const
diff --git a/src/multimedia/playback/qmediaplaylistnavigator.cpp b/src/multimedia/playback/qmediaplaylistnavigator.cpp
index 192fd463c..0966c9396 100644
--- a/src/multimedia/playback/qmediaplaylistnavigator.cpp
+++ b/src/multimedia/playback/qmediaplaylistnavigator.cpp
@@ -43,6 +43,7 @@
#include "qmediaobject_p.h"
#include <QtCore/qdebug.h>
+#include <QtCore/qrandom.h>
QT_BEGIN_NAMESPACE
@@ -124,7 +125,7 @@ int QMediaPlaylistNavigatorPrivate::nextItemPos(int steps) const
randomModePositions.append(-1);
int res = randomModePositions[randomPositionsOffset+steps];
if (res<0 || res >= playlist->mediaCount()) {
- res = qrand() % playlist->mediaCount();
+ res = QRandomGenerator::global()->bounded(playlist->mediaCount());
randomModePositions[randomPositionsOffset+steps] = res;
}
@@ -177,7 +178,7 @@ int QMediaPlaylistNavigatorPrivate::previousItemPos(int steps) const
int res = randomModePositions[randomPositionsOffset-steps];
if (res<0 || res >= playlist->mediaCount()) {
- res = qrand() % playlist->mediaCount();
+ res = QRandomGenerator::global()->bounded(playlist->mediaCount());
randomModePositions[randomPositionsOffset-steps] = res;
}
diff --git a/src/multimedia/qmediaobject.cpp b/src/multimedia/qmediaobject.cpp
index a2f0d58aa..71b2d148c 100644
--- a/src/multimedia/qmediaobject.cpp
+++ b/src/multimedia/qmediaobject.cpp
@@ -55,7 +55,13 @@ void QMediaObjectPrivate::_q_notify()
const QMetaObject* m = q->metaObject();
- for (int pi : qAsConst(notifyProperties)) {
+ // QTBUG-57045
+ // we create a copy of notifyProperties container to ensure that if a property is removed
+ // from the original container as a result of invoking propertyChanged signal, the iterator
+ // won't become invalidated
+ QSet<int> properties = notifyProperties;
+
+ for (int pi : qAsConst(properties)) {
QMetaProperty p = m->property(pi);
p.notifySignal().invoke(
q, QGenericArgument(QMetaType::typeName(p.userType()), p.read(q).data()));
diff --git a/src/multimedia/video/qimagevideobuffer.cpp b/src/multimedia/video/qimagevideobuffer.cpp
index 59f708fed..f407e02d0 100644
--- a/src/multimedia/video/qimagevideobuffer.cpp
+++ b/src/multimedia/video/qimagevideobuffer.cpp
@@ -89,7 +89,7 @@ uchar *QImageVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine)
d->mapMode = mode;
if (numBytes)
- *numBytes = d->image.byteCount();
+ *numBytes = int(d->image.sizeInBytes());
if (bytesPerLine)
*bytesPerLine = d->image.bytesPerLine();