summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qaudio.cpp61
-rw-r--r--src/multimedia/audio/qaudio.h15
-rw-r--r--src/multimedia/audio/qaudiobuffer_p.h11
-rw-r--r--src/multimedia/camera/qcamera.cpp2
-rw-r--r--src/multimedia/controls/controls.pri6
-rw-r--r--src/multimedia/controls/qaudiorolecontrol.cpp111
-rw-r--r--src/multimedia/controls/qaudiorolecontrol.h69
-rw-r--r--src/multimedia/controls/qmediaplayercontrol.cpp1
-rw-r--r--src/multimedia/doc/qtmultimedia-dita.qdocconf32
-rw-r--r--src/multimedia/doc/qtmultimedia.qdocconf16
-rw-r--r--src/multimedia/doc/src/multimediabackend.qdoc5
-rw-r--r--src/multimedia/doc/src/qtmultimedia-cpp.qdoc19
-rw-r--r--src/multimedia/doc/src/qtmultimedia-index.qdoc23
-rw-r--r--src/multimedia/gsttools_headers/gstvideoconnector_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstappsrc_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstcodecsinfo_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamermirtexturerenderer_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideorendererinterface_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideowidget_p.h11
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideowindow_p.h11
-rw-r--r--src/multimedia/multimedia.pro5
-rw-r--r--src/multimedia/playback/playlistfileparser.cpp7
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp67
-rw-r--r--src/multimedia/playback/qmediaplayer.h8
-rw-r--r--src/multimedia/playback/qmediaplaylist.cpp72
-rw-r--r--src/multimedia/playback/qmediaplaylist_p.h4
-rw-r--r--src/multimedia/qmediametadata.cpp1
-rw-r--r--src/multimedia/qmediaresourcepolicy_p.h11
-rw-r--r--src/multimedia/qmediaresourcepolicyplugin_p.h11
-rw-r--r--src/multimedia/qmediaresourceset_p.h11
-rw-r--r--src/multimedia/qmediaserviceprovider_p.h11
-rw-r--r--src/multimedia/qmediastoragelocation_p.h11
-rw-r--r--src/multimedia/qmultimedia.cpp1
-rw-r--r--src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_backend_p.h11
-rw-r--r--src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_p.h11
-rw-r--r--src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h13
-rw-r--r--src/multimedia/recording/qmediarecorder_p.h11
-rw-r--r--src/multimedia/video/qvideoframe.cpp126
-rw-r--r--src/multimedia/video/qvideoframe.h3
-rw-r--r--src/multimedia/video/qvideoframe_p.h57
-rw-r--r--src/multimedia/video/qvideoframeconversionhelper.cpp348
-rw-r--r--src/multimedia/video/qvideoframeconversionhelper_avx2.cpp83
-rw-r--r--src/multimedia/video/qvideoframeconversionhelper_p.h117
-rw-r--r--src/multimedia/video/qvideoframeconversionhelper_sse2.cpp83
-rw-r--r--src/multimedia/video/qvideoframeconversionhelper_ssse3.cpp82
-rw-r--r--src/multimedia/video/qvideooutputorientationhandler_p.h11
-rw-r--r--src/multimedia/video/qvideosurfaceoutput_p.h11
-rw-r--r--src/multimedia/video/video.pri11
56 files changed, 1672 insertions, 62 deletions
diff --git a/src/multimedia/audio/qaudio.cpp b/src/multimedia/audio/qaudio.cpp
index 8b452a118..45540a2b9 100644
--- a/src/multimedia/audio/qaudio.cpp
+++ b/src/multimedia/audio/qaudio.cpp
@@ -42,12 +42,14 @@ static void qRegisterAudioMetaTypes()
qRegisterMetaType<QAudio::Error>();
qRegisterMetaType<QAudio::State>();
qRegisterMetaType<QAudio::Mode>();
+ qRegisterMetaType<QAudio::Role>();
}
Q_CONSTRUCTOR_FUNCTION(qRegisterAudioMetaTypes)
/*!
\namespace QAudio
+ \ingroup multimedia-namespaces
\brief The QAudio namespace contains enums used by the audio classes.
\inmodule QtMultimedia
\ingroup multimedia
@@ -83,6 +85,26 @@ Q_CONSTRUCTOR_FUNCTION(qRegisterAudioMetaTypes)
\value AudioInput audio input device
*/
+/*!
+ \enum QAudio::Role
+
+ This enum describes the role of an audio stream.
+
+ \value UnknownRole The role is unknown or undefined
+ \value MusicRole Music
+ \value VideoRole Soundtrack from a movie or a video
+ \value VoiceCommunicationRole Voice communications, such as telephony
+ \value AlarmRole Alarm
+ \value NotificationRole Notification, such as an incoming e-mail or a chat request
+ \value RingtoneRole Ringtone
+ \value AccessibilityRole For accessibility, such as with a screen reader
+ \value SonificationRole Sonification, such as with user interface sounds
+ \value GameRole Game audio
+
+ \since 5.6
+ \sa QMediaPlayer::setAudioRole()
+*/
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, QAudio::Error error)
{
@@ -143,6 +165,45 @@ QDebug operator<<(QDebug dbg, QAudio::Mode mode)
}
return dbg;
}
+
+QDebug operator<<(QDebug dbg, QAudio::Role role)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace();
+ switch (role) {
+ case QAudio::UnknownRole:
+ dbg << "UnknownRole";
+ break;
+ case QAudio::AccessibilityRole:
+ dbg << "AccessibilityRole";
+ break;
+ case QAudio::AlarmRole:
+ dbg << "AlarmRole";
+ break;
+ case QAudio::GameRole:
+ dbg << "GameRole";
+ break;
+ case QAudio::MusicRole:
+ dbg << "MusicRole";
+ break;
+ case QAudio::NotificationRole:
+ dbg << "NotificationRole";
+ break;
+ case QAudio::RingtoneRole:
+ dbg << "RingtoneRole";
+ break;
+ case QAudio::SonificationRole:
+ dbg << "SonificationRole";
+ break;
+ case QAudio::VideoRole:
+ dbg << "VideoRole";
+ break;
+ case QAudio::VoiceCommunicationRole:
+ dbg << "VoiceCommunicationRole";
+ break;
+ }
+ return dbg;
+}
#endif
diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h
index 63953145c..2ee66bcc1 100644
--- a/src/multimedia/audio/qaudio.h
+++ b/src/multimedia/audio/qaudio.h
@@ -51,12 +51,26 @@ namespace QAudio
enum Error { NoError, OpenError, IOError, UnderrunError, FatalError };
enum State { ActiveState, SuspendedState, StoppedState, IdleState };
enum Mode { AudioInput, AudioOutput };
+
+ enum Role {
+ UnknownRole,
+ MusicRole,
+ VideoRole,
+ VoiceCommunicationRole,
+ AlarmRole,
+ NotificationRole,
+ RingtoneRole,
+ AccessibilityRole,
+ SonificationRole,
+ GameRole
+ };
}
#ifndef QT_NO_DEBUG_STREAM
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Error error);
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::State state);
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Mode mode);
+Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Role role);
#endif
QT_END_NAMESPACE
@@ -64,5 +78,6 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QAudio::Error)
Q_DECLARE_METATYPE(QAudio::State)
Q_DECLARE_METATYPE(QAudio::Mode)
+Q_DECLARE_METATYPE(QAudio::Role)
#endif // QAUDIO_H
diff --git a/src/multimedia/audio/qaudiobuffer_p.h b/src/multimedia/audio/qaudiobuffer_p.h
index 98e2a1868..a98d6d3bf 100644
--- a/src/multimedia/audio/qaudiobuffer_p.h
+++ b/src/multimedia/audio/qaudiobuffer_p.h
@@ -34,6 +34,17 @@
#ifndef QAUDIOBUFFER_P_H
#define QAUDIOBUFFER_P_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 <qtmultimediadefs.h>
#include <qmultimedia.h>
diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp
index ea1b6beb6..bec894b75 100644
--- a/src/multimedia/camera/qcamera.cpp
+++ b/src/multimedia/camera/qcamera.cpp
@@ -931,7 +931,7 @@ QCamera::LockStatus QCamera::lockStatus() const
}
/*!
- Returns the status of camera settings \a lock.
+ Returns the lock status for a given \a lockType.
*/
QCamera::LockStatus QCamera::lockStatus(QCamera::LockType lockType) const
{
diff --git a/src/multimedia/controls/controls.pri b/src/multimedia/controls/controls.pri
index b19532fdc..7ab2e51c4 100644
--- a/src/multimedia/controls/controls.pri
+++ b/src/multimedia/controls/controls.pri
@@ -36,7 +36,8 @@ PUBLIC_HEADERS += \
controls/qvideowindowcontrol.h \
controls/qmediaaudioprobecontrol.h \
controls/qmediavideoprobecontrol.h \
- controls/qmediaavailabilitycontrol.h
+ controls/qmediaavailabilitycontrol.h \
+ controls/qaudiorolecontrol.h
PRIVATE_HEADERS += \
controls/qmediaplaylistcontrol_p.h \
@@ -79,5 +80,6 @@ SOURCES += \
controls/qaudioencodersettingscontrol.cpp \
controls/qaudioinputselectorcontrol.cpp \
controls/qaudiooutputselectorcontrol.cpp \
- controls/qvideodeviceselectorcontrol.cpp
+ controls/qvideodeviceselectorcontrol.cpp \
+ controls/qaudiorolecontrol.cpp
diff --git a/src/multimedia/controls/qaudiorolecontrol.cpp b/src/multimedia/controls/qaudiorolecontrol.cpp
new file mode 100644
index 000000000..62696f013
--- /dev/null
+++ b/src/multimedia/controls/qaudiorolecontrol.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmediacontrol_p.h"
+#include "qaudiorolecontrol.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QAudioRoleControl
+ \inmodule QtMultimedia
+ \ingroup multimedia_control
+ \since 5.6
+
+ \brief The QAudioRoleControl class provides control over the audio role of a media object.
+
+ If a QMediaService supports audio roles it will implement QAudioRoleControl.
+
+ The functionality provided by this control is exposed to application code through the
+ QMediaPlayer class.
+
+ The interface name of QAudioRoleControl is \c org.qt-project.qt.audiorolecontrol/5.6 as
+ defined in QAudioRoleControl_iid.
+
+ \sa QMediaService::requestControl(), QMediaPlayer
+*/
+
+/*!
+ \macro QAudioRoleControl_iid
+
+ \c org.qt-project.qt.audiorolecontrol/5.6
+
+ Defines the interface name of the QAudioRoleControl class.
+
+ \relates QAudioRoleControl
+*/
+
+/*!
+ Construct a QAudioRoleControl with the given \a parent.
+*/
+QAudioRoleControl::QAudioRoleControl(QObject *parent)
+ : QMediaControl(*new QMediaControlPrivate, parent)
+{
+
+}
+
+/*!
+ Destroys the audio role control.
+*/
+QAudioRoleControl::~QAudioRoleControl()
+{
+
+}
+
+/*!
+ \fn QAudio::Role QAudioRoleControl::audioRole() const
+
+ Returns the audio role of the media played by the media service.
+*/
+
+/*!
+ \fn void QAudioRoleControl::setAudioRole(QAudio::Role role)
+
+ Sets the audio \a role of the media played by the media service.
+*/
+
+/*!
+ \fn QList<QAudio::Role> QAudioRoleControl::supportedAudioRoles() const
+
+ Returns a list of audio roles that the media service supports.
+*/
+
+/*!
+ \fn void QAudioRoleControl::audioRoleChanged(QAudio::Role role)
+
+ Signal emitted when the audio \a role has changed.
+ */
+
+
+#include "moc_qaudiorolecontrol.cpp"
+QT_END_NAMESPACE
diff --git a/src/multimedia/controls/qaudiorolecontrol.h b/src/multimedia/controls/qaudiorolecontrol.h
new file mode 100644
index 000000000..983b2aed0
--- /dev/null
+++ b/src/multimedia/controls/qaudiorolecontrol.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QAUDIOROLECONTROL_H
+#define QAUDIOROLECONTROL_H
+
+#include <QtMultimedia/qmediacontrol.h>
+#include <QtMultimedia/qaudio.h>
+
+QT_BEGIN_NAMESPACE
+
+// Class forward declaration required for QDoc bug
+class QString;
+
+class Q_MULTIMEDIA_EXPORT QAudioRoleControl : public QMediaControl
+{
+ Q_OBJECT
+
+public:
+ virtual ~QAudioRoleControl();
+
+ virtual QAudio::Role audioRole() const = 0;
+ virtual void setAudioRole(QAudio::Role role) = 0;
+
+ virtual QList<QAudio::Role> supportedAudioRoles() const = 0;
+
+Q_SIGNALS:
+ void audioRoleChanged(QAudio::Role role);
+
+protected:
+ explicit QAudioRoleControl(QObject *parent = 0);
+};
+
+#define QAudioRoleControl_iid "org.qt-project.qt.audiorolecontrol/5.6"
+Q_MEDIA_DECLARE_CONTROL(QAudioRoleControl, QAudioRoleControl_iid)
+
+QT_END_NAMESPACE
+
+#endif // QAUDIOROLECONTROL_H
diff --git a/src/multimedia/controls/qmediaplayercontrol.cpp b/src/multimedia/controls/qmediaplayercontrol.cpp
index 9ea6fde82..0c891a1d4 100644
--- a/src/multimedia/controls/qmediaplayercontrol.cpp
+++ b/src/multimedia/controls/qmediaplayercontrol.cpp
@@ -111,6 +111,7 @@ QMediaPlayerControl::QMediaPlayerControl(QObject *parent):
Returns the status of the current media.
*/
+
/*!
\fn QMediaPlayerControl::mediaStatusChanged(QMediaPlayer::MediaStatus status)
diff --git a/src/multimedia/doc/qtmultimedia-dita.qdocconf b/src/multimedia/doc/qtmultimedia-dita.qdocconf
deleted file mode 100644
index cb8a73c4f..000000000
--- a/src/multimedia/doc/qtmultimedia-dita.qdocconf
+++ /dev/null
@@ -1,32 +0,0 @@
-# Name of the project.
-project = Qt Multimedia
-
-# Directories in which to search for files to document and images.
-# By default set to the root directory of the project for sources
-# and headers and qdoc will therefore generate output for each file.
-# Images should be placed in <rootdir>/dic/images and examples in
-# <rootdir>/examples.
-# Paths are relative to the location of this file.
-exampledirs += ../src/examples \
- ../.. \
- ../../examples
-
-headerdirs += ../src \
- ../../src
-
-imagedirs += ../src/images \
-
-sourcedirs += ../src \
- ../../src
-
-excludedirs +=
-
-#Do not change the variables after this line unless you know what you are doing.
-
-outputdir = ../ditaxml
-outputformats = DITAXML
-
-examples.fileextensions = "*.cpp *.h *.js *.svg *.xml *.ui *.qml"
-examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng"
-headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
-sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
diff --git a/src/multimedia/doc/qtmultimedia.qdocconf b/src/multimedia/doc/qtmultimedia.qdocconf
index d917062a2..cd16a3f5d 100644
--- a/src/multimedia/doc/qtmultimedia.qdocconf
+++ b/src/multimedia/doc/qtmultimedia.qdocconf
@@ -18,21 +18,27 @@ qhp.QtMultimedia.indexTitle = Qt Multimedia
qhp.QtMultimedia.virtualFolder = qtmultimedia
# For listing child nodes in Qt Creator or Assistant.
-qhp.QtMultimedia.subprojects = classes qmltypes
+qhp.QtMultimedia.subprojects = classes qmltypes examples
qhp.QtMultimedia.subprojects.classes.title = C++ Classes
qhp.QtMultimedia.subprojects.classes.indexTitle = Qt Multimedia C++ Classes
qhp.QtMultimedia.subprojects.classes.selectors = class fake:headerfile
qhp.QtMultimedia.subprojects.classes.sortPages = true
+
qhp.QtMultimedia.subprojects.qmltypes.title = QML Types
qhp.QtMultimedia.subprojects.qmltypes.indexTitle = Qt Multimedia QML Types
qhp.QtMultimedia.subprojects.qmltypes.selectors = qmlclass
qhp.QtMultimedia.subprojects.qmltypes.sortPages = true
-exampledirs += ../../../examples/multimedia \
+qhp.QtMultimedia.subprojects.examples.title = Examples
+qhp.QtMultimedia.subprojects.examples.indexTitle = Qt Multimedia Examples
+qhp.QtMultimedia.subprojects.examples.selectors = doc:example
+qhp.QtMultimedia.subprojects.examples.sortPages = true
+
+exampledirs += ../../../examples \
snippets
# Specify example install dir under QT_INSTALL_EXAMPLES
-examplesinstallpath = multimedia
+examplesinstallpath = qtmultimedia/multimedia
headerdirs += ../..
@@ -40,9 +46,9 @@ imagedirs += src/images \
sourcedirs += ../..
-excludedirs += ../../multimediawidgets
+#excludedirs += ../../multimediawidgets
-depends += qtcore qtdoc qtgui qtquick qtqml qtmultimediawidgets qtwidgets
+depends += qtcore qtdoc qtgui qtquick qtqml qtwidgets
navigation.landingpage = "Qt Multimedia"
navigation.cppclassespage = "Qt Multimedia C++ Classes"
diff --git a/src/multimedia/doc/src/multimediabackend.qdoc b/src/multimedia/doc/src/multimediabackend.qdoc
index b56f1040d..0622f5f09 100644
--- a/src/multimedia/doc/src/multimediabackend.qdoc
+++ b/src/multimedia/doc/src/multimediabackend.qdoc
@@ -37,14 +37,14 @@
\section1 Overview
-A multimedia backend provides the glue between platform specific libraries, and
+A multimedia backend provides the glue between platform-specific libraries, and
Qt Multimedia. In some cases the available cross-platform Multimedia APIs or
implementations are not sufficient, or not immediately available on a certain
platform. Alternatively, the multimedia implementation on a platform might expose
certain extra properties or functionality that other platforms do not, or a finer
degree of control might be possible. For these cases, it is possible to use
extended controls directly.
-
+\omit
In addition, if you plan to port the Qt Multimedia APIs to a new platform, you do
this by implementing certain control and service classes, as detailed below.
@@ -94,7 +94,6 @@ In general, adding a new media service provider is outside the scope of this doc
For best results, consult the existing provider source code, and seek assistance on the relevant
mailing lists and IRC channels.
-\omit
The base class for creating new service providers is \l{QMediaServiceProvider}.
The user must implement the \l{QMediaServiceProvider::requestService()}{requestService()}
function
diff --git a/src/multimedia/doc/src/qtmultimedia-cpp.qdoc b/src/multimedia/doc/src/qtmultimedia-cpp.qdoc
index 8460238e7..44623beca 100644
--- a/src/multimedia/doc/src/qtmultimedia-cpp.qdoc
+++ b/src/multimedia/doc/src/qtmultimedia-cpp.qdoc
@@ -27,16 +27,33 @@
/*!
\module QtMultimedia
- \title Qt Multimedia C++ Classes
+ \title Qt Multimedia Module C++ Classes
\ingroup modules
\qtvariable multimedia
\brief The \l {Qt Multimedia} module provides audio, video, radio and camera
functionality.
+*/
+
+/*!
+ \page qtmultimedia-modules.html
+ \title Qt Multimedia C++ Classes
+ \brief Provides C++ class for multimedia use cases.
The C++ classes provide more control over the multimedia content than the
QML alternatives. If your application is serving complex use cases such as
decoding media files, accessing video or audio buffers, use the C++
alternative. For more details about the complex audio, video, and camera use
cases supported by the C++ classes, refer to \l {Multimedia}{Multimedia Overview}.
+
+ \section1 Namespaces
+ \annotatedlist multimedia-namespaces
+
+ \section1 Classes
+
+ \section2 Qt Multimedia Module
+ \generatelist {classesbymodule QtMultimedia}
+
+ \section2 Qt Multimedia Widgets Module
+ \generatelist {classesbymodule QtMultimediaWidgets}
*/
diff --git a/src/multimedia/doc/src/qtmultimedia-index.qdoc b/src/multimedia/doc/src/qtmultimedia-index.qdoc
index 65fcb210b..e51ec97e0 100644
--- a/src/multimedia/doc/src/qtmultimedia-index.qdoc
+++ b/src/multimedia/doc/src/qtmultimedia-index.qdoc
@@ -35,10 +35,18 @@
and C++ classes to handle multimedia content. It also provides necessary
APIs to access the camera and radio functionality. The included
\l{Qt Audio Engine QML Types}{Qt Audio Engine} provides types for
- 3D positional audio playback and management.
+ 3D positional audio playback and content management.
- The \l{Qt Multimedia Widgets} module provides widget based multimedia
- classes.
+ The functionality of this module is divided into the following submodules:
+
+ \table
+ \row
+ \li \l{QtMultimedia}{Qt Multimedia}
+ \li Provides API for multimedia-specific use cases.
+ \row
+ \li \l{QtMultimediaWidgets}{Qt Multimedia Widgets}
+ \li Provides the widget-based multimedia API.
+ \endtable
\section1 Getting Started
@@ -54,6 +62,7 @@
\code
#include <QtMultimedia>
+ #include <QtMultimediaWidgets>
\endcode
\note If you are using a few classes from this module, we recommend
@@ -63,7 +72,7 @@
\c {qmake} project file:
\code
- QT += multimedia
+ QT += multimedia multimediawidgets
\endcode
\section1 QML Types and C++ Classes
@@ -79,6 +88,9 @@
\li \l {QtMultimedia::Audio}{Audio}
\li Add audio playback functionality to a scene
\row
+ \li \l {QtMultimedia::Playlist}{Playlist}
+ \li For specifying a list of media to be played.
+ \row
\li \l {QtMultimedia::Camera}{Camera}
\li Access camera viewfinder frames
\row
@@ -117,6 +129,9 @@
\li QMediaPlayer
\li Playback media from a source.
\row
+ \li QMediaPlaylist
+ \li List of media to be played.
+ \row
\li QRadioTuner
\li Access radio device.
\row
diff --git a/src/multimedia/gsttools_headers/gstvideoconnector_p.h b/src/multimedia/gsttools_headers/gstvideoconnector_p.h
index 43a56f5d8..1407dcd17 100644
--- a/src/multimedia/gsttools_headers/gstvideoconnector_p.h
+++ b/src/multimedia/gsttools_headers/gstvideoconnector_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTVIDEOCONNECTOR_H
#define QGSTVIDEOCONNECTOR_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 <gst/gst.h>
G_BEGIN_DECLS
diff --git a/src/multimedia/gsttools_headers/qgstappsrc_p.h b/src/multimedia/gsttools_headers/qgstappsrc_p.h
index ec54af0d1..5b32911e4 100644
--- a/src/multimedia/gsttools_headers/qgstappsrc_p.h
+++ b/src/multimedia/gsttools_headers/qgstappsrc_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTAPPSRC_H
#define QGSTAPPSRC_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/qobject.h>
#include <QtCore/qiodevice.h>
diff --git a/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
index 8e5867c16..183768a66 100644
--- a/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
+++ b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTCODECSINFO_H
#define QGSTCODECSINFO_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/qmap.h>
#include <QtCore/qstringlist.h>
diff --git a/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h b/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
index 20259f411..75ce9f5ea 100644
--- a/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
+++ b/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERAUDIOINPUTSELECTOR_H
#define QGSTREAMERAUDIOINPUTSELECTOR_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 <qaudioinputselectorcontrol.h>
#include <QtCore/qstringlist.h>
diff --git a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
index 3246ac2f6..9c25a53a4 100644
--- a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERAUDIOPROBECONTROL_H
#define QGSTREAMERAUDIOPROBECONTROL_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 <gst/gst.h>
#include <qmediaaudioprobecontrol.h>
#include <QtCore/qmutex.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
index ca1547a87..307d68ea7 100644
--- a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERBUFFERPROBE_H
#define QGSTREAMERBUFFERPROBE_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 <gst/gst.h>
#include <QtCore/qglobal.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h b/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h
index 5c90fc588..64aaed909 100644
--- a/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamergltexturerenderer_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERGLTEXTURERENDERER_H
#define QGSTREAMERGLTEXTURERENDERER_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 <qvideorenderercontrol.h>
#include <private/qvideosurfacegstsink_p.h>
#include <private/qgstreamerbushelper_p.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamermirtexturerenderer_p.h b/src/multimedia/gsttools_headers/qgstreamermirtexturerenderer_p.h
index e1be653cc..a794258c7 100644
--- a/src/multimedia/gsttools_headers/qgstreamermirtexturerenderer_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamermirtexturerenderer_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERMIRTEXTURERENDERER_H
#define QGSTREAMERMIRTEXTURERENDERER_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 <qmediaplayer.h>
#include <qvideorenderercontrol.h>
#include <private/qvideosurfacegstsink_p.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
index cd03d3257..597567c52 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERVIDEOINPUTDEVICECONTROL_H
#define QGSTREAMERVIDEOINPUTDEVICECONTROL_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 <qvideodeviceselectorcontrol.h>
#include <QtCore/qstringlist.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h b/src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h
index e18a1b5ca..cad04510f 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERVIDEOOVERLAY_P_H
#define QGSTREAMERVIDEOOVERLAY_P_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 <private/qgstreamerbushelper_p.h>
#include <private/qgstreamerbufferprobe_p.h>
#include <QtGui/qwindowdefs.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
index c77dae7a2..4b399f59d 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERVIDEOPROBECONTROL_H
#define QGSTREAMERVIDEOPROBECONTROL_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 <gst/gst.h>
#include <gst/video/video.h>
#include <qmediavideoprobecontrol.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
index a4cf72a56..f828e14a6 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERVIDEORENDERER_H
#define QGSTREAMERVIDEORENDERER_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 <qvideorenderercontrol.h>
#include <private/qvideosurfacegstsink_p.h>
#include <qabstractvideosurface.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamervideorendererinterface_p.h b/src/multimedia/gsttools_headers/qgstreamervideorendererinterface_p.h
index cb6ccb15f..3f68fb7d3 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideorendererinterface_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideorendererinterface_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERVIDEOOUTPUTCONTROL_H
#define QGSTREAMERVIDEOOUTPUTCONTROL_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 <gst/gst.h>
#include <QtCore/qobject.h>
diff --git a/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
index 4526a8ac9..724c88d16 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERVIDEOWIDGET_H
#define QGSTREAMERVIDEOWIDGET_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 <qvideowidgetcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
diff --git a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
index 8884aa2c0..bf115f48f 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
@@ -34,6 +34,17 @@
#ifndef QGSTREAMERVIDEOWINDOW_H
#define QGSTREAMERVIDEOWINDOW_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 <qvideowindowcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 524952470..b16a792fb 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -7,7 +7,8 @@ MODULE_PLUGIN_TYPES = \
video/bufferpool \
video/gstvideorenderer \
video/videonode \
- playlistformats
+ playlistformats \
+ resourcepolicy
QMAKE_DOCS = $$PWD/doc/qtmultimedia.qdocconf
@@ -56,6 +57,8 @@ SOURCES += \
qmultimedia.cpp \
qmultimediautils.cpp
+CONFIG += simd optimize_full
+
include(audio/audio.pri)
include(camera/camera.pri)
include(controls/controls.pri)
diff --git a/src/multimedia/playback/playlistfileparser.cpp b/src/multimedia/playback/playlistfileparser.cpp
index edaf98c52..c7553e16b 100644
--- a/src/multimedia/playback/playlistfileparser.cpp
+++ b/src/multimedia/playback/playlistfileparser.cpp
@@ -290,7 +290,8 @@ void QPlaylistFileParserPrivate::processLine(int startIndex, int length)
switch (m_type) {
case QPlaylistFileParser::UNKNOWN:
- emit q->error(QPlaylistFileParser::FormatError, QString(QObject::tr("%1 playlist type is unknown")).arg(m_root.toString()));
+ emit q->error(QPlaylistFileParser::FormatError,
+ QPlaylistFileParser::tr("%1 playlist type is unknown").arg(m_root.toString()));
q->stop();
return;
case QPlaylistFileParser::M3U:
@@ -350,7 +351,7 @@ void QPlaylistFileParserPrivate::_q_handleData()
if (m_buffer.length() - processedBytes >= LINE_LIMIT) {
qWarning() << "error parsing playlist["<< m_root << "] with line content >= 4096 bytes.";
- emit q->error(QPlaylistFileParser::FormatError, QObject::tr("invalid line in playlist file"));
+ emit q->error(QPlaylistFileParser::FormatError, QPlaylistFileParser::tr("invalid line in playlist file"));
q->stop();
return;
}
@@ -398,7 +399,7 @@ void QPlaylistFileParserPrivate::_q_handleParserFinished()
Q_Q(QPlaylistFileParser);
bool isParserValid = (m_currentParser != 0);
if (!isParserValid)
- emit q->error(QPlaylistFileParser::FormatNotSupportedError, QObject::tr("Empty file provided"));
+ emit q->error(QPlaylistFileParser::FormatNotSupportedError, QPlaylistFileParser::tr("Empty file provided"));
q->stop();
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 51be94c43..c1636e8e8 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -42,6 +42,7 @@
#include <qmediaplaylistcontrol_p.h>
#include <qmediaplaylistsourcecontrol_p.h>
#include <qmedianetworkaccesscontrol.h>
+#include <qaudiorolecontrol.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qmetaobject.h>
@@ -104,6 +105,7 @@ public:
QMediaPlayerPrivate()
: provider(0)
, control(0)
+ , audioRoleControl(0)
, state(QMediaPlayer::StoppedState)
, status(QMediaPlayer::UnknownMediaStatus)
, error(QMediaPlayer::NoError)
@@ -116,6 +118,7 @@ public:
QMediaServiceProvider *provider;
QMediaPlayerControl* control;
+ QAudioRoleControl *audioRoleControl;
QMediaPlayer::State state;
QMediaPlayer::MediaStatus status;
QMediaPlayer::Error error;
@@ -598,6 +601,12 @@ QMediaPlayer::QMediaPlayer(QObject *parent, QMediaPlayer::Flags flags):
addPropertyWatch("bufferStatus");
d->hasStreamPlaybackFeature = d->provider->supportedFeatures(d->service).testFlag(QMediaServiceProviderHint::StreamPlayback);
+
+ d->audioRoleControl = qobject_cast<QAudioRoleControl*>(d->service->requestControl(QAudioRoleControl_iid));
+ if (d->audioRoleControl) {
+ connect(d->audioRoleControl, &QAudioRoleControl::audioRoleChanged,
+ this, &QMediaPlayer::audioRoleChanged);
+ }
}
if (d->networkAccessControl != 0) {
connect(d->networkAccessControl, SIGNAL(configurationChanged(QNetworkConfiguration)),
@@ -620,6 +629,8 @@ QMediaPlayer::~QMediaPlayer()
if (d->service) {
if (d->control)
d->service->releaseControl(d->control);
+ if (d->audioRoleControl)
+ d->service->releaseControl(d->audioRoleControl);
d->provider->releaseService(d->service);
}
@@ -1113,6 +1124,41 @@ QMultimedia::AvailabilityStatus QMediaPlayer::availability() const
return QMediaObject::availability();
}
+QAudio::Role QMediaPlayer::audioRole() const
+{
+ Q_D(const QMediaPlayer);
+
+ if (d->audioRoleControl != NULL)
+ return d->audioRoleControl->audioRole();
+
+ return QAudio::UnknownRole;
+}
+
+void QMediaPlayer::setAudioRole(QAudio::Role audioRole)
+{
+ Q_D(QMediaPlayer);
+
+ if (d->audioRoleControl)
+ d->audioRoleControl->setAudioRole(audioRole);
+}
+
+/*!
+ Returns a list of supported audio roles.
+
+ If setting the audio role is not supported, an empty list is returned.
+
+ \since 5.6
+ \sa audioRole
+*/
+QList<QAudio::Role> QMediaPlayer::supportedAudioRoles() const
+{
+ Q_D(const QMediaPlayer);
+
+ if (d->audioRoleControl)
+ return d->audioRoleControl->supportedAudioRoles();
+
+ return QList<QAudio::Role>();
+}
// Enums
/*!
@@ -1213,6 +1259,14 @@ QMultimedia::AvailabilityStatus QMediaPlayer::availability() const
Signals the \a seekable status of the player object has changed.
*/
+/*!
+ \fn void QMediaPlayer::audioRoleChanged(QAudio::Role role)
+
+ Signals that the audio \a role of the media player has changed.
+
+ \since 5.6
+*/
+
// Properties
/*!
\property QMediaPlayer::state
@@ -1381,6 +1435,19 @@ QMultimedia::AvailabilityStatus QMediaPlayer::availability() const
*/
/*!
+ \property QMediaPlayer::audioRole
+ \brief the role of the audio stream played by the media player.
+
+ It can be set to specify the type of audio being played, allowing the system to make
+ appropriate decisions when it comes to volume, routing or post-processing.
+
+ The audio role must be set before calling setMedia().
+
+ \since 5.6
+ \sa supportedAudioRoles()
+*/
+
+/*!
\fn void QMediaPlayer::durationChanged(qint64 duration)
Signal the duration of the content has changed to \a duration, expressed in milliseconds.
diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h
index 735f11130..437bf58ad 100644
--- a/src/multimedia/playback/qmediaplayer.h
+++ b/src/multimedia/playback/qmediaplayer.h
@@ -37,6 +37,7 @@
#include <QtMultimedia/qmediaobject.h>
#include <QtMultimedia/qmediacontent.h>
#include <QtMultimedia/qmediaenumdebug.h>
+#include <QtMultimedia/qaudio.h>
#include <QtNetwork/qnetworkconfiguration.h>
@@ -66,6 +67,7 @@ class Q_MULTIMEDIA_EXPORT QMediaPlayer : public QMediaObject
Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
Q_PROPERTY(State state READ state NOTIFY stateChanged)
Q_PROPERTY(MediaStatus mediaStatus READ mediaStatus NOTIFY mediaStatusChanged)
+ Q_PROPERTY(QAudio::Role audioRole READ audioRole WRITE setAudioRole)
Q_PROPERTY(QString error READ errorString)
Q_ENUMS(State)
Q_ENUMS(MediaStatus)
@@ -151,6 +153,10 @@ public:
QMultimedia::AvailabilityStatus availability() const;
+ QAudio::Role audioRole() const;
+ void setAudioRole(QAudio::Role audioRole);
+ QList<QAudio::Role> supportedAudioRoles() const;
+
public Q_SLOTS:
void play();
void pause();
@@ -187,6 +193,8 @@ Q_SIGNALS:
void seekableChanged(bool seekable);
void playbackRateChanged(qreal rate);
+ void audioRoleChanged(QAudio::Role role);
+
void error(QMediaPlayer::Error error);
void networkConfigurationChanged(const QNetworkConfiguration &configuration);
diff --git a/src/multimedia/playback/qmediaplaylist.cpp b/src/multimedia/playback/qmediaplaylist.cpp
index 06813592e..c63340637 100644
--- a/src/multimedia/playback/qmediaplaylist.cpp
+++ b/src/multimedia/playback/qmediaplaylist.cpp
@@ -168,10 +168,13 @@ bool QMediaPlaylist::setMediaObject(QMediaObject *mediaObject)
newControl = d->networkPlaylistControl;
if (d->control != newControl) {
- int oldSize = 0;
+ int removedStart = -1;
+ int removedEnd = -1;
+ int insertedStart = -1;
+ int insertedEnd = -1;
+
if (d->control) {
QMediaPlaylistProvider *playlist = d->control->playlistProvider();
- oldSize = playlist->mediaCount();
disconnect(playlist, SIGNAL(loadFailed(QMediaPlaylist::Error,QString)),
this, SLOT(_q_loadFailed(QMediaPlaylist::Error,QString)));
@@ -190,6 +193,12 @@ bool QMediaPlaylist::setMediaObject(QMediaObject *mediaObject)
disconnect(d->control, SIGNAL(currentMediaChanged(QMediaContent)),
this, SIGNAL(currentMediaChanged(QMediaContent)));
+ // Copy playlist items, sync playback mode and sync current index between
+ // old control and new control
+ d->syncControls(d->control, newControl,
+ &removedStart, &removedEnd,
+ &insertedStart, &insertedEnd);
+
if (d->mediaObject)
d->mediaObject->service()->releaseControl(d->control);
}
@@ -214,14 +223,14 @@ bool QMediaPlaylist::setMediaObject(QMediaObject *mediaObject)
connect(d->control, SIGNAL(currentMediaChanged(QMediaContent)),
this, SIGNAL(currentMediaChanged(QMediaContent)));
- if (oldSize) {
- emit mediaAboutToBeRemoved(0, oldSize-1);
- emit mediaRemoved(0, oldSize-1);
+ if (removedStart != -1 && removedEnd != -1) {
+ emit mediaAboutToBeRemoved(removedStart, removedEnd);
+ emit mediaRemoved(removedStart, removedEnd);
}
- if (playlist->mediaCount()) {
- emit mediaAboutToBeInserted(0,playlist->mediaCount()-1);
- emit mediaInserted(0,playlist->mediaCount()-1);
+ if (insertedStart != -1 && insertedEnd != -1) {
+ emit mediaAboutToBeInserted(insertedStart, insertedEnd);
+ emit mediaInserted(insertedStart, insertedEnd);
}
}
@@ -436,6 +445,53 @@ bool QMediaPlaylistPrivate::writeItems(QMediaPlaylistWriter *writer)
}
/*!
+ * \internal
+ * Copy playlist items, sync playback mode and sync current index between old control and new control
+*/
+void QMediaPlaylistPrivate::syncControls(QMediaPlaylistControl *oldControl, QMediaPlaylistControl *newControl,
+ int *removedStart, int *removedEnd,
+ int *insertedStart, int *insertedEnd)
+{
+ Q_ASSERT(oldControl != NULL && newControl != NULL);
+ Q_ASSERT(removedStart != NULL && removedEnd != NULL
+ && insertedStart != NULL && insertedEnd != NULL);
+
+ QMediaPlaylistProvider *oldPlaylist = oldControl->playlistProvider();
+ QMediaPlaylistProvider *newPlaylist = newControl->playlistProvider();
+
+ Q_ASSERT(oldPlaylist != NULL && newPlaylist != NULL);
+
+ *removedStart = -1;
+ *removedEnd = -1;
+ *insertedStart = -1;
+ *insertedEnd = -1;
+
+ if (newPlaylist->isReadOnly()) {
+ // we can't transfer the items from the old control.
+ // Report these items as removed.
+ if (oldPlaylist->mediaCount() > 0) {
+ *removedStart = 0;
+ *removedEnd = oldPlaylist->mediaCount() - 1;
+ }
+ // The new control might have some items that can't be cleared.
+ // Report these as inserted.
+ if (newPlaylist->mediaCount() > 0) {
+ *insertedStart = 0;
+ *insertedEnd = newPlaylist->mediaCount() - 1;
+ }
+ } else {
+ const int oldPlaylistSize = oldPlaylist->mediaCount();
+
+ newPlaylist->clear();
+ for (int i = 0; i < oldPlaylistSize; ++i)
+ newPlaylist->addMedia(oldPlaylist->media(i));
+ }
+
+ newControl->setPlaybackMode(oldControl->playbackMode());
+ newControl->setCurrentIndex(oldControl->currentIndex());
+}
+
+/*!
Load playlist using network \a request. If \a format is specified, it is used,
otherwise format is guessed from playlist name and data.
diff --git a/src/multimedia/playback/qmediaplaylist_p.h b/src/multimedia/playback/qmediaplaylist_p.h
index 25571378f..1440362df 100644
--- a/src/multimedia/playback/qmediaplaylist_p.h
+++ b/src/multimedia/playback/qmediaplaylist_p.h
@@ -108,6 +108,10 @@ public:
bool readItems(QMediaPlaylistReader *reader);
bool writeItems(QMediaPlaylistWriter *writer);
+ void syncControls(QMediaPlaylistControl *oldControl, QMediaPlaylistControl *newControl,
+ int *removedStart, int *removedEnd,
+ int *insertedStart, int *insertedEnd);
+
QMediaPlaylist::Error error;
QString errorString;
diff --git a/src/multimedia/qmediametadata.cpp b/src/multimedia/qmediametadata.cpp
index f07c0936b..9ffd2a727 100644
--- a/src/multimedia/qmediametadata.cpp
+++ b/src/multimedia/qmediametadata.cpp
@@ -160,6 +160,7 @@ Q_DEFINE_METADATA(ThumbnailImage);
/*!
\namespace QMediaMetaData
+ \ingroup multimedia-namespaces
\ingroup multimedia
\inmodule QtMultimedia
diff --git a/src/multimedia/qmediaresourcepolicy_p.h b/src/multimedia/qmediaresourcepolicy_p.h
index ee07c87e3..9877a628e 100644
--- a/src/multimedia/qmediaresourcepolicy_p.h
+++ b/src/multimedia/qmediaresourcepolicy_p.h
@@ -34,6 +34,17 @@
#ifndef QMEDIARESOURCEPOLICY_H
#define QMEDIARESOURCEPOLICY_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 <QObject>
#include "qtmultimediadefs.h"
diff --git a/src/multimedia/qmediaresourcepolicyplugin_p.h b/src/multimedia/qmediaresourcepolicyplugin_p.h
index 938ea9d5d..47596352c 100644
--- a/src/multimedia/qmediaresourcepolicyplugin_p.h
+++ b/src/multimedia/qmediaresourcepolicyplugin_p.h
@@ -34,6 +34,17 @@
#ifndef QRESOURCEPOLICYPLUGIN_P_H
#define QRESOURCEPOLICYPLUGIN_P_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 <QObject>
#include <qtmultimediadefs.h>
diff --git a/src/multimedia/qmediaresourceset_p.h b/src/multimedia/qmediaresourceset_p.h
index cddb380da..ccfa55954 100644
--- a/src/multimedia/qmediaresourceset_p.h
+++ b/src/multimedia/qmediaresourceset_p.h
@@ -33,6 +33,17 @@
#ifndef QMEDIARESOURCESET_P_H
#define QMEDIARESOURCESET_P_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 <QObject>
#include <qtmultimediadefs.h>
diff --git a/src/multimedia/qmediaserviceprovider_p.h b/src/multimedia/qmediaserviceprovider_p.h
index 4230c427d..e2b02c8b9 100644
--- a/src/multimedia/qmediaserviceprovider_p.h
+++ b/src/multimedia/qmediaserviceprovider_p.h
@@ -34,6 +34,17 @@
#ifndef QMEDIASERVICEPROVIDER_H
#define QMEDIASERVICEPROVIDER_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/qobject.h>
#include <QtCore/qshareddata.h>
#include <qtmultimediadefs.h>
diff --git a/src/multimedia/qmediastoragelocation_p.h b/src/multimedia/qmediastoragelocation_p.h
index c934089d6..56995026a 100644
--- a/src/multimedia/qmediastoragelocation_p.h
+++ b/src/multimedia/qmediastoragelocation_p.h
@@ -34,6 +34,17 @@
#ifndef QMEDIASTORAGELOCATION_H
#define QMEDIASTORAGELOCATION_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 <qtmultimediadefs.h>
#include <QDir>
#include <QMap>
diff --git a/src/multimedia/qmultimedia.cpp b/src/multimedia/qmultimedia.cpp
index 2641cae44..f1673871f 100644
--- a/src/multimedia/qmultimedia.cpp
+++ b/src/multimedia/qmultimedia.cpp
@@ -31,6 +31,7 @@ QT_BEGIN_NAMESPACE
/*!
\namespace QMultimedia
+ \ingroup multimedia-namespaces
\ingroup multimedia
\inmodule QtMultimedia
diff --git a/src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_backend_p.h b/src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_backend_p.h
index 450c0cff5..94d7d15cd 100644
--- a/src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_backend_p.h
+++ b/src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_backend_p.h
@@ -35,6 +35,17 @@
#ifndef QDECLARATIVEVIDEOOUTPUT_BACKEND_P_H
#define QDECLARATIVEVIDEOOUTPUT_BACKEND_P_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/qpointer.h>
#include <QtCore/qsize.h>
#include <QtQuick/qquickitem.h>
diff --git a/src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_p.h b/src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_p.h
index 87565b91b..0f34cc036 100644
--- a/src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_p.h
+++ b/src/multimedia/qtmultimediaquicktools_headers/qdeclarativevideooutput_p.h
@@ -35,6 +35,17 @@
#ifndef QDECLARATIVEVIDEOOUTPUT_P_H
#define QDECLARATIVEVIDEOOUTPUT_P_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/qrect.h>
#include <QtCore/qsharedpointer.h>
#include <QtQuick/qquickitem.h>
diff --git a/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h b/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h
index 11d76f6b4..3024d1316 100644
--- a/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h
+++ b/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h
@@ -34,6 +34,17 @@
#ifndef QSGVIDEONODE_P_H
#define QSGVIDEONODE_P_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 <QtQuick/qsgnode.h>
#include <private/qtmultimediaquickdefs_p.h>
@@ -70,6 +81,8 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QSGVideoNode::FrameFlags)
class Q_MULTIMEDIAQUICK_EXPORT QSGVideoNodeFactoryInterface
{
public:
+ virtual ~QSGVideoNodeFactoryInterface();
+
virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const = 0;
virtual QSGVideoNode *createNode(const QVideoSurfaceFormat &format) = 0;
};
diff --git a/src/multimedia/recording/qmediarecorder_p.h b/src/multimedia/recording/qmediarecorder_p.h
index 9510d2406..598e833ad 100644
--- a/src/multimedia/recording/qmediarecorder_p.h
+++ b/src/multimedia/recording/qmediarecorder_p.h
@@ -34,6 +34,17 @@
#ifndef QMEDIARECORDER_P_H
#define QMEDIARECORDER_P_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 "qmediarecorder.h"
#include "qmediaobject_p.h"
#include <QtCore/qurl.h>
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
index 4e9e28a4d..f0495577c 100644
--- a/src/multimedia/video/qvideoframe.cpp
+++ b/src/multimedia/video/qvideoframe.cpp
@@ -33,8 +33,10 @@
#include "qvideoframe.h"
+#include "qvideoframe_p.h"
#include "qimagevideobuffer_p.h"
#include "qmemoryvideobuffer_p.h"
+#include "qvideoframeconversionhelper_p.h"
#include <qimage.h>
#include <qpair.h>
@@ -654,6 +656,8 @@ bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode)
d->data[2] = d->data[1] + (d->bytesPerLine[1] * d->size.height() / 2);
break;
}
+ default:
+ break;
}
d->mappedCount++;
@@ -994,11 +998,133 @@ QImage::Format QVideoFrame::imageFormatFromPixelFormat(PixelFormat format)
case Format_AdobeDng:
return QImage::Format_Invalid;
case Format_User:
+ default:
return QImage::Format_Invalid;
}
return QImage::Format_Invalid;
}
+
+extern void QT_FASTCALL qt_convert_BGRA32_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_BGR24_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_BGR565_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_BGR555_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_AYUV444_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_YUV444_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_YUV420P_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_YV12_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_UYVY_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_YUYV_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_NV12_to_ARGB32(const QVideoFrame&, uchar*);
+extern void QT_FASTCALL qt_convert_NV21_to_ARGB32(const QVideoFrame&, uchar*);
+
+static VideoFrameConvertFunc qConvertFuncs[QVideoFrame::NPixelFormats] = {
+ /* Format_Invalid */ Q_NULLPTR, // Not needed
+ /* Format_ARGB32 */ Q_NULLPTR, // Not needed
+ /* Format_ARGB32_Premultiplied */ Q_NULLPTR, // Not needed
+ /* Format_RGB32 */ Q_NULLPTR, // Not needed
+ /* Format_RGB24 */ Q_NULLPTR, // Not needed
+ /* Format_RGB565 */ Q_NULLPTR, // Not needed
+ /* Format_RGB555 */ Q_NULLPTR, // Not needed
+ /* Format_ARGB8565_Premultiplied */ Q_NULLPTR, // Not needed
+ /* Format_BGRA32 */ qt_convert_BGRA32_to_ARGB32,
+ /* Format_BGRA32_Premultiplied */ qt_convert_BGRA32_to_ARGB32,
+ /* Format_BGR32 */ qt_convert_BGRA32_to_ARGB32,
+ /* Format_BGR24 */ qt_convert_BGR24_to_ARGB32,
+ /* Format_BGR565 */ qt_convert_BGR565_to_ARGB32,
+ /* Format_BGR555 */ qt_convert_BGR555_to_ARGB32,
+ /* Format_BGRA5658_Premultiplied */ Q_NULLPTR,
+ /* Format_AYUV444 */ qt_convert_AYUV444_to_ARGB32,
+ /* Format_AYUV444_Premultiplied */ Q_NULLPTR,
+ /* Format_YUV444 */ qt_convert_YUV444_to_ARGB32,
+ /* Format_YUV420P */ qt_convert_YUV420P_to_ARGB32,
+ /* Format_YV12 */ qt_convert_YV12_to_ARGB32,
+ /* Format_UYVY */ qt_convert_UYVY_to_ARGB32,
+ /* Format_YUYV */ qt_convert_YUYV_to_ARGB32,
+ /* Format_NV12 */ qt_convert_NV12_to_ARGB32,
+ /* Format_NV21 */ qt_convert_NV21_to_ARGB32,
+ /* Format_IMC1 */ Q_NULLPTR,
+ /* Format_IMC2 */ Q_NULLPTR,
+ /* Format_IMC3 */ Q_NULLPTR,
+ /* Format_IMC4 */ Q_NULLPTR,
+ /* Format_Y8 */ Q_NULLPTR,
+ /* Format_Y16 */ Q_NULLPTR,
+ /* Format_Jpeg */ Q_NULLPTR, // Not needed
+ /* Format_CameraRaw */ Q_NULLPTR,
+ /* Format_AdobeDng */ Q_NULLPTR
+};
+
+static void qInitConvertFuncsAsm()
+{
+#ifdef QT_COMPILER_SUPPORTS_SSE2
+ extern void QT_FASTCALL qt_convert_BGRA32_to_ARGB32_sse2(const QVideoFrame&, uchar*);
+ if (qCpuHasFeature(SSE2)){
+ qConvertFuncs[QVideoFrame::Format_BGRA32] = qt_convert_BGRA32_to_ARGB32_sse2;
+ qConvertFuncs[QVideoFrame::Format_BGRA32_Premultiplied] = qt_convert_BGRA32_to_ARGB32_sse2;
+ qConvertFuncs[QVideoFrame::Format_BGR32] = qt_convert_BGRA32_to_ARGB32_sse2;
+ }
+#endif
+#ifdef QT_COMPILER_SUPPORTS_SSSE3
+ extern void QT_FASTCALL qt_convert_BGRA32_to_ARGB32_ssse3(const QVideoFrame&, uchar*);
+ if (qCpuHasFeature(SSSE3)){
+ qConvertFuncs[QVideoFrame::Format_BGRA32] = qt_convert_BGRA32_to_ARGB32_ssse3;
+ qConvertFuncs[QVideoFrame::Format_BGRA32_Premultiplied] = qt_convert_BGRA32_to_ARGB32_ssse3;
+ qConvertFuncs[QVideoFrame::Format_BGR32] = qt_convert_BGRA32_to_ARGB32_ssse3;
+ }
+#endif
+#ifdef QT_COMPILER_SUPPORTS_AVX2
+ extern void QT_FASTCALL qt_convert_BGRA32_to_ARGB32_avx2(const QVideoFrame&, uchar*);
+ if (qCpuHasFeature(AVX2)){
+ qConvertFuncs[QVideoFrame::Format_BGRA32] = qt_convert_BGRA32_to_ARGB32_avx2;
+ qConvertFuncs[QVideoFrame::Format_BGRA32_Premultiplied] = qt_convert_BGRA32_to_ARGB32_avx2;
+ qConvertFuncs[QVideoFrame::Format_BGR32] = qt_convert_BGRA32_to_ARGB32_avx2;
+ }
+#endif
+}
+
+/*!
+ \internal
+*/
+QImage qt_imageFromVideoFrame(const QVideoFrame &f)
+{
+ QVideoFrame &frame = const_cast<QVideoFrame&>(f);
+ QImage result;
+
+ if (!frame.isValid() || !frame.map(QAbstractVideoBuffer::ReadOnly))
+ return result;
+
+ // Formats supported by QImage don't need conversion
+ QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(frame.pixelFormat());
+ if (imageFormat != QImage::Format_Invalid) {
+ result = QImage(frame.bits(), frame.width(), frame.height(), imageFormat).copy();
+ }
+
+ // Load from JPG
+ else if (frame.pixelFormat() == QVideoFrame::Format_Jpeg) {
+ result.loadFromData(frame.bits(), frame.mappedBytes(), "JPG");
+ }
+
+ // Need conversion
+ else {
+ static bool initAsmFuncsDone = false;
+ if (!initAsmFuncsDone) {
+ qInitConvertFuncsAsm();
+ initAsmFuncsDone = true;
+ }
+ VideoFrameConvertFunc convert = qConvertFuncs[frame.pixelFormat()];
+ if (!convert) {
+ qWarning() << Q_FUNC_INFO << ": unsupported pixel format" << frame.pixelFormat();
+ } else {
+ result = QImage(frame.width(), frame.height(), QImage::Format_ARGB32);
+ convert(frame, result.bits());
+ }
+ }
+
+ frame.unmap();
+
+ return result;
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, QVideoFrame::PixelFormat pf)
{
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index a273b7f73..633604ebb 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -96,6 +96,9 @@ public:
Format_CameraRaw,
Format_AdobeDng,
+#ifndef Q_QDOC
+ NPixelFormats,
+#endif
Format_User = 1000
};
diff --git a/src/multimedia/video/qvideoframe_p.h b/src/multimedia/video/qvideoframe_p.h
new file mode 100644
index 000000000..15260c26f
--- /dev/null
+++ b/src/multimedia/video/qvideoframe_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVIDEOFRAME_P_H
+#define QVIDEOFRAME_P_H
+
+#include <QtMultimedia/qvideoframe.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.
+//
+
+QT_BEGIN_NAMESPACE
+
+Q_MULTIMEDIA_EXPORT QImage qt_imageFromVideoFrame(const QVideoFrame &frame);
+
+QT_END_NAMESPACE
+
+#endif // QVIDEOFRAME_P_H
+
diff --git a/src/multimedia/video/qvideoframeconversionhelper.cpp b/src/multimedia/video/qvideoframeconversionhelper.cpp
new file mode 100644
index 000000000..9599b1947
--- /dev/null
+++ b/src/multimedia/video/qvideoframeconversionhelper.cpp
@@ -0,0 +1,348 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvideoframeconversionhelper_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#define CLAMP(n) (n > 255 ? 255 : (n < 0 ? 0 : n))
+
+#define EXPAND_UV(u, v) \
+ int uu = u - 128; \
+ int vv = v - 128; \
+ int rv = 409 * vv + 128; \
+ int guv = 100 * uu + 208 * vv + 128; \
+ int bu = 516 * uu + 128; \
+
+static inline quint32 qYUVToARGB32(int y, int rv, int guv, int bu, int a = 0xff)
+{
+ int yy = (y - 16) * 298;
+ return (a << 24)
+ | CLAMP((yy + rv) >> 8) << 16
+ | CLAMP((yy - guv) >> 8) << 8
+ | CLAMP((yy + bu) >> 8);
+}
+
+static inline void planarYUV420_to_ARGB32(const uchar *y, int yStride,
+ const uchar *u, int uStride,
+ const uchar *v, int vStride,
+ int uvPixelStride,
+ quint32 *rgb,
+ int width, int height)
+{
+ quint32 *rgb0 = rgb;
+ quint32 *rgb1 = rgb + width;
+
+ for (int j = 0; j < height; j += 2) {
+ const uchar *lineY0 = y;
+ const uchar *lineY1 = y + yStride;
+ const uchar *lineU = u;
+ const uchar *lineV = v;
+
+ for (int i = 0; i < width; i += 2) {
+ EXPAND_UV(*lineU, *lineV);
+ lineU += uvPixelStride;
+ lineV += uvPixelStride;
+
+ *rgb0++ = qYUVToARGB32(*lineY0++, rv, guv, bu);
+ *rgb0++ = qYUVToARGB32(*lineY0++, rv, guv, bu);
+ *rgb1++ = qYUVToARGB32(*lineY1++, rv, guv, bu);
+ *rgb1++ = qYUVToARGB32(*lineY1++, rv, guv, bu);
+ }
+
+ y += yStride << 1; // stride * 2
+ u += uStride;
+ v += vStride;
+ rgb0 += width;
+ rgb1 += width;
+ }
+}
+
+
+
+void QT_FASTCALL qt_convert_YUV420P_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_TRIPLANAR(frame)
+ planarYUV420_to_ARGB32(plane1, plane1Stride,
+ plane2, plane2Stride,
+ plane3, plane3Stride,
+ 1,
+ reinterpret_cast<quint32*>(output),
+ width, height);
+}
+
+void QT_FASTCALL qt_convert_YV12_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_TRIPLANAR(frame)
+ planarYUV420_to_ARGB32(plane1, plane1Stride,
+ plane3, plane3Stride,
+ plane2, plane2Stride,
+ 1,
+ reinterpret_cast<quint32*>(output),
+ width, height);
+}
+
+void QT_FASTCALL qt_convert_AYUV444_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 4)
+
+ quint32 *rgb = reinterpret_cast<quint32*>(output);
+
+ for (int i = 0; i < height; ++i) {
+ const uchar *lineSrc = src;
+
+ for (int j = 0; j < width; ++j) {
+ int a = *lineSrc++;
+ int y = *lineSrc++;
+ int u = *lineSrc++;
+ int v = *lineSrc++;
+
+ EXPAND_UV(u, v);
+
+ *rgb++ = qYUVToARGB32(y, rv, guv, bu, a);
+ }
+
+ src += stride;
+ }
+}
+
+void QT_FASTCALL qt_convert_YUV444_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 3)
+
+ quint32 *rgb = reinterpret_cast<quint32*>(output);
+
+ for (int i = 0; i < height; ++i) {
+ const uchar *lineSrc = src;
+
+ for (int j = 0; j < width; ++j) {
+ int y = *lineSrc++;
+ int u = *lineSrc++;
+ int v = *lineSrc++;
+
+ EXPAND_UV(u, v);
+
+ *rgb++ = qYUVToARGB32(y, rv, guv, bu);
+ }
+
+ src += stride;
+ }
+}
+
+void QT_FASTCALL qt_convert_UYVY_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 2)
+
+ quint32 *rgb = reinterpret_cast<quint32*>(output);
+
+ for (int i = 0; i < height; ++i) {
+ const uchar *lineSrc = src;
+
+ for (int j = 0; j < width; j += 2) {
+ int u = *lineSrc++;
+ int y0 = *lineSrc++;
+ int v = *lineSrc++;
+ int y1 = *lineSrc++;
+
+ EXPAND_UV(u, v);
+
+ *rgb++ = qYUVToARGB32(y0, rv, guv, bu);
+ *rgb++ = qYUVToARGB32(y1, rv, guv, bu);
+ }
+
+ src += stride;
+ }
+}
+
+void QT_FASTCALL qt_convert_YUYV_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 2)
+
+ quint32 *rgb = reinterpret_cast<quint32*>(output);
+
+ for (int i = 0; i < height; ++i) {
+ const uchar *lineSrc = src;
+
+ for (int j = 0; j < width; j += 2) {
+ int y0 = *lineSrc++;
+ int u = *lineSrc++;
+ int y1 = *lineSrc++;
+ int v = *lineSrc++;
+
+ EXPAND_UV(u, v);
+
+ *rgb++ = qYUVToARGB32(y0, rv, guv, bu);
+ *rgb++ = qYUVToARGB32(y1, rv, guv, bu);
+ }
+
+ src += stride;
+ }
+}
+
+void QT_FASTCALL qt_convert_NV12_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_BIPLANAR(frame)
+ planarYUV420_to_ARGB32(plane1, plane1Stride,
+ plane2, plane2Stride,
+ plane2 + 1, plane2Stride,
+ 2,
+ reinterpret_cast<quint32*>(output),
+ width, height);
+}
+
+void QT_FASTCALL qt_convert_NV21_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_BIPLANAR(frame)
+ planarYUV420_to_ARGB32(plane1, plane1Stride,
+ plane2 + 1, plane2Stride,
+ plane2, plane2Stride,
+ 2,
+ reinterpret_cast<quint32*>(output),
+ width, height);
+}
+
+void QT_FASTCALL qt_convert_BGRA32_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 4)
+
+ quint32 *argb = reinterpret_cast<quint32*>(output);
+
+ for (int y = 0; y < height; ++y) {
+ const quint32 *bgra = reinterpret_cast<const quint32*>(src);
+
+ int x = 0;
+ for (; x < width - 3; x += 4) {
+ *argb++ = qConvertBGRA32ToARGB32(*bgra++);
+ *argb++ = qConvertBGRA32ToARGB32(*bgra++);
+ *argb++ = qConvertBGRA32ToARGB32(*bgra++);
+ *argb++ = qConvertBGRA32ToARGB32(*bgra++);
+ }
+
+ // leftovers
+ for (; x < width; ++x)
+ *argb++ = qConvertBGRA32ToARGB32(*bgra++);
+
+ src += stride;
+ }
+}
+
+void QT_FASTCALL qt_convert_BGR24_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 3)
+
+ quint32 *argb = reinterpret_cast<quint32*>(output);
+
+ for (int y = 0; y < height; ++y) {
+ const uchar *bgr = src;
+
+ int x = 0;
+ for (; x < width - 3; x += 4) {
+ *argb++ = qConvertBGR24ToARGB32(bgr);
+ bgr += 3;
+ *argb++ = qConvertBGR24ToARGB32(bgr);
+ bgr += 3;
+ *argb++ = qConvertBGR24ToARGB32(bgr);
+ bgr += 3;
+ *argb++ = qConvertBGR24ToARGB32(bgr);
+ bgr += 3;
+ }
+
+ // leftovers
+ for (; x < width; ++x) {
+ *argb++ = qConvertBGR24ToARGB32(bgr);
+ bgr += 3;
+ }
+
+ src += stride;
+ }
+}
+
+void QT_FASTCALL qt_convert_BGR565_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 2)
+
+ quint32 *argb = reinterpret_cast<quint32*>(output);
+
+ for (int y = 0; y < height; ++y) {
+ const quint16 *bgr = reinterpret_cast<const quint16*>(src);
+
+ int x = 0;
+ for (; x < width - 3; x += 4) {
+ *argb++ = qConvertBGR565ToARGB32(*bgr++);
+ *argb++ = qConvertBGR565ToARGB32(*bgr++);
+ *argb++ = qConvertBGR565ToARGB32(*bgr++);
+ *argb++ = qConvertBGR565ToARGB32(*bgr++);
+ }
+
+ // leftovers
+ for (; x < width; ++x)
+ *argb++ = qConvertBGR565ToARGB32(*bgr++);
+
+ src += stride;
+ }
+}
+
+void QT_FASTCALL qt_convert_BGR555_to_ARGB32(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 2)
+
+ quint32 *argb = reinterpret_cast<quint32*>(output);
+
+ for (int y = 0; y < height; ++y) {
+ const quint16 *bgr = reinterpret_cast<const quint16*>(src);
+
+ int x = 0;
+ for (; x < width - 3; x += 4) {
+ *argb++ = qConvertBGR555ToARGB32(*bgr++);
+ *argb++ = qConvertBGR555ToARGB32(*bgr++);
+ *argb++ = qConvertBGR555ToARGB32(*bgr++);
+ *argb++ = qConvertBGR555ToARGB32(*bgr++);
+ }
+
+ // leftovers
+ for (; x < width; ++x)
+ *argb++ = qConvertBGR555ToARGB32(*bgr++);
+
+ src += stride;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/multimedia/video/qvideoframeconversionhelper_avx2.cpp b/src/multimedia/video/qvideoframeconversionhelper_avx2.cpp
new file mode 100644
index 000000000..c769c8868
--- /dev/null
+++ b/src/multimedia/video/qvideoframeconversionhelper_avx2.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvideoframeconversionhelper_p.h"
+
+#ifdef QT_COMPILER_SUPPORTS_AVX2
+
+QT_BEGIN_NAMESPACE
+
+void QT_FASTCALL qt_convert_BGRA32_to_ARGB32_avx2(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 4)
+ quint32 *argb = reinterpret_cast<quint32*>(output);
+
+ const __m256i shuffleMask = _mm256_set_epi8(12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3,
+ 12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3);
+
+ for (int y = 0; y < height; ++y) {
+ const quint32 *bgra = reinterpret_cast<const quint32*>(src);
+
+ int x = 0;
+ ALIGN(32, argb, x, width) {
+ *argb = qConvertBGRA32ToARGB32(*bgra);
+ ++bgra;
+ ++argb;
+ }
+
+ for (; x < width - 15; x += 16) {
+ __m256i pixelData = _mm256_loadu_si256(reinterpret_cast<const __m256i*>(bgra));
+ __m256i pixelData2 = _mm256_loadu_si256(reinterpret_cast<const __m256i*>(bgra + 8));
+ bgra += 16;
+ pixelData = _mm256_shuffle_epi8(pixelData, shuffleMask);
+ pixelData2 = _mm256_shuffle_epi8(pixelData2, shuffleMask);
+ _mm256_store_si256(reinterpret_cast<__m256i*>(argb), pixelData);
+ _mm256_store_si256(reinterpret_cast<__m256i*>(argb + 8), pixelData2);
+ argb += 16;
+ }
+
+ // leftovers
+ for (; x < width; ++x) {
+ *argb = qConvertBGRA32ToARGB32(*bgra);
+ ++bgra;
+ ++argb;
+ }
+
+ src += stride;
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/multimedia/video/qvideoframeconversionhelper_p.h b/src/multimedia/video/qvideoframeconversionhelper_p.h
new file mode 100644
index 000000000..10e9d3ab3
--- /dev/null
+++ b/src/multimedia/video/qvideoframeconversionhelper_p.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVIDEOFRAMECONVERSIONHELPER_P_H
+#define QVIDEOFRAMECONVERSIONHELPER_P_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 <qvideoframe.h>
+#include <private/qsimd_p.h>
+
+typedef void (QT_FASTCALL *VideoFrameConvertFunc)(const QVideoFrame &frame, uchar *output);
+
+inline quint32 qConvertBGRA32ToARGB32(quint32 bgra)
+{
+ return (((bgra & 0xFF000000) >> 24)
+ | ((bgra & 0x00FF0000) >> 8)
+ | ((bgra & 0x0000FF00) << 8)
+ | ((bgra & 0x000000FF) << 24));
+}
+
+inline quint32 qConvertBGR24ToARGB32(const uchar *bgr)
+{
+ return 0xFF000000 | bgr[0] | bgr[1] << 8 | bgr[2] << 16;
+}
+
+inline quint32 qConvertBGR565ToARGB32(quint16 bgr)
+{
+ return 0xff000000
+ | ((((bgr) >> 8) & 0xf8) | (((bgr) >> 13) & 0x7))
+ | ((((bgr) << 5) & 0xfc00) | (((bgr) >> 1) & 0x300))
+ | ((((bgr) << 19) & 0xf80000) | (((bgr) << 14) & 0x70000));
+}
+
+inline quint32 qConvertBGR555ToARGB32(quint16 bgr)
+{
+ return 0xff000000
+ | ((((bgr) >> 7) & 0xf8) | (((bgr) >> 12) & 0x7))
+ | ((((bgr) << 6) & 0xf800) | (((bgr) << 1) & 0x700))
+ | ((((bgr) << 19) & 0xf80000) | (((bgr) << 11) & 0x70000));
+}
+
+#define FETCH_INFO_PACKED(frame) \
+ const uchar *src = frame.bits(); \
+ int stride = frame.bytesPerLine(); \
+ int width = frame.width(); \
+ int height = frame.height();
+
+#define FETCH_INFO_BIPLANAR(frame) \
+ const uchar *plane1 = frame.bits(0); \
+ const uchar *plane2 = frame.bits(1); \
+ int plane1Stride = frame.bytesPerLine(0); \
+ int plane2Stride = frame.bytesPerLine(1); \
+ int width = frame.width(); \
+ int height = frame.height();
+
+#define FETCH_INFO_TRIPLANAR(frame) \
+ const uchar *plane1 = frame.bits(0); \
+ const uchar *plane2 = frame.bits(1); \
+ const uchar *plane3 = frame.bits(2); \
+ int plane1Stride = frame.bytesPerLine(0); \
+ int plane2Stride = frame.bytesPerLine(1); \
+ int plane3Stride = frame.bytesPerLine(2); \
+ int width = frame.width(); \
+ int height = frame.height(); \
+
+#define MERGE_LOOPS(width, height, stride, bpp) \
+ if (stride == width * bpp) { \
+ width *= height; \
+ height = 1; \
+ stride = 0; \
+ }
+
+#define ALIGN(boundary, ptr, x, length) \
+ for (; ((reinterpret_cast<qintptr>(ptr) & (boundary - 1)) != 0) && x < length; ++x)
+
+#endif // QVIDEOFRAMECONVERSIONHELPER_P_H
+
diff --git a/src/multimedia/video/qvideoframeconversionhelper_sse2.cpp b/src/multimedia/video/qvideoframeconversionhelper_sse2.cpp
new file mode 100644
index 000000000..27689e5bb
--- /dev/null
+++ b/src/multimedia/video/qvideoframeconversionhelper_sse2.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvideoframeconversionhelper_p.h"
+
+#ifdef QT_COMPILER_SUPPORTS_SSE2
+
+QT_BEGIN_NAMESPACE
+
+void QT_FASTCALL qt_convert_BGRA32_to_ARGB32_sse2(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 4)
+ quint32 *argb = reinterpret_cast<quint32*>(output);
+
+ const __m128i zero = _mm_setzero_si128();
+
+ for (int y = 0; y < height; ++y) {
+ const quint32 *bgra = reinterpret_cast<const quint32*>(src);
+
+ int x = 0;
+ ALIGN(16, argb, x, width) {
+ *argb = qConvertBGRA32ToARGB32(*bgra);
+ ++bgra;
+ ++argb;
+ }
+
+ for (; x < width - 3; x += 4) {
+ __m128i pixelData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(bgra));
+ bgra += 4;
+ __m128i gaComponents = _mm_unpacklo_epi8(pixelData, zero);
+ __m128i brComponents = _mm_unpackhi_epi8(pixelData, zero);
+ gaComponents = _mm_shufflelo_epi16(_mm_shufflehi_epi16(gaComponents, _MM_SHUFFLE(0, 1, 2, 3)), _MM_SHUFFLE(0, 1, 2, 3)); // swap GA
+ brComponents = _mm_shufflelo_epi16(_mm_shufflehi_epi16(brComponents, _MM_SHUFFLE(0, 1, 2, 3)), _MM_SHUFFLE(0, 1, 2, 3)); // swap BR
+ pixelData = _mm_packus_epi16(gaComponents, brComponents);
+ _mm_store_si128(reinterpret_cast<__m128i*>(argb), pixelData);
+ argb += 4;
+ }
+
+ // leftovers
+ for (; x < width; ++x) {
+ *argb = qConvertBGRA32ToARGB32(*bgra);
+ ++bgra;
+ ++argb;
+ }
+
+ src += stride;
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/multimedia/video/qvideoframeconversionhelper_ssse3.cpp b/src/multimedia/video/qvideoframeconversionhelper_ssse3.cpp
new file mode 100644
index 000000000..b15617cef
--- /dev/null
+++ b/src/multimedia/video/qvideoframeconversionhelper_ssse3.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvideoframeconversionhelper_p.h"
+
+#ifdef QT_COMPILER_SUPPORTS_SSSE3
+
+QT_BEGIN_NAMESPACE
+
+void QT_FASTCALL qt_convert_BGRA32_to_ARGB32_ssse3(const QVideoFrame &frame, uchar *output)
+{
+ FETCH_INFO_PACKED(frame)
+ MERGE_LOOPS(width, height, stride, 4)
+ quint32 *argb = reinterpret_cast<quint32*>(output);
+
+ __m128i shuffleMask = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3);
+
+ for (int y = 0; y < height; ++y) {
+ const quint32 *bgra = reinterpret_cast<const quint32*>(src);
+
+ int x = 0;
+ ALIGN(16, argb, x, width) {
+ *argb = qConvertBGRA32ToARGB32(*bgra);
+ ++bgra;
+ ++argb;
+ }
+
+ for (; x < width - 7; x += 8) {
+ __m128i pixelData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(bgra));
+ __m128i pixelData2 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(bgra + 4));
+ bgra += 8;
+ pixelData = _mm_shuffle_epi8(pixelData, shuffleMask);
+ pixelData2 = _mm_shuffle_epi8(pixelData2, shuffleMask);
+ _mm_store_si128(reinterpret_cast<__m128i*>(argb), pixelData);
+ _mm_store_si128(reinterpret_cast<__m128i*>(argb + 4), pixelData2);
+ argb += 8;
+ }
+
+ // leftovers
+ for (; x < width; ++x) {
+ *argb = qConvertBGRA32ToARGB32(*bgra);
+ ++bgra;
+ ++argb;
+ }
+
+ src += stride;
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/multimedia/video/qvideooutputorientationhandler_p.h b/src/multimedia/video/qvideooutputorientationhandler_p.h
index 28629adce..c690cafae 100644
--- a/src/multimedia/video/qvideooutputorientationhandler_p.h
+++ b/src/multimedia/video/qvideooutputorientationhandler_p.h
@@ -34,6 +34,17 @@
#ifndef QVIDEOOUTPUTORIENTATIONHANDLER_P_H
#define QVIDEOOUTPUTORIENTATIONHANDLER_P_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 <qtmultimediadefs.h>
#include <QObject>
diff --git a/src/multimedia/video/qvideosurfaceoutput_p.h b/src/multimedia/video/qvideosurfaceoutput_p.h
index 2356a6b44..b9e3960f4 100644
--- a/src/multimedia/video/qvideosurfaceoutput_p.h
+++ b/src/multimedia/video/qvideosurfaceoutput_p.h
@@ -34,6 +34,17 @@
#ifndef QVIDEOSURFACEOUTPUT_P_H
#define QVIDEOSURFACEOUTPUT_P_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 <qmediabindableinterface.h>
#include <QtCore/qsharedpointer.h>
diff --git a/src/multimedia/video/video.pri b/src/multimedia/video/video.pri
index 3e39d9d18..e5fa697ce 100644
--- a/src/multimedia/video/video.pri
+++ b/src/multimedia/video/video.pri
@@ -14,7 +14,9 @@ PRIVATE_HEADERS += \
video/qimagevideobuffer_p.h \
video/qmemoryvideobuffer_p.h \
video/qvideooutputorientationhandler_p.h \
- video/qvideosurfaceoutput_p.h
+ video/qvideosurfaceoutput_p.h \
+ video/qvideoframe_p.h \
+ video/qvideoframeconversionhelper_p.h
SOURCES += \
video/qabstractvideobuffer.cpp \
@@ -26,4 +28,9 @@ SOURCES += \
video/qvideosurfaceformat.cpp \
video/qvideosurfaceoutput.cpp \
video/qvideoprobe.cpp \
- video/qabstractvideofilter.cpp
+ video/qabstractvideofilter.cpp \
+ video/qvideoframeconversionhelper.cpp
+
+SSE2_SOURCES += video/qvideoframeconversionhelper_sse2.cpp
+SSSE3_SOURCES += video/qvideoframeconversionhelper_ssse3.cpp
+AVX2_SOURCES += video/qvideoframeconversionhelper_avx2.cpp