QtMultimedia Changes in Qt Multimedia

The Qt Multimedia module in Qt 5 combines (and replaces) two older modules, namely the Qt Multimedia module from Qt 4.x, and Qt Multimedia Kit module from Qt Mobility. Existing code that uses Qt Multimedia from Qt 4 can be ported with minimal effort, but porting code that uses Qt Multimedia Kit may be a more involved process. The changed features section highlights changes relevant to porting.

Also, note that widget-based classes, such as QVideoWidget, are now in a separate module called Qt Multimedia Widgets.

There are a number of new features in Qt Multimedia:

  • Expanded QML API
  • In addition to the Video QML type, there is now the option of using MediaPlayer and VideoOutput together
  • QML Torch class
  • New QAudioRecorder class
  • Volume support for QAudioOutput and QAudioInput
  • More examples and documentation
  • QSound moved from Qt GUI to Qt Multimedia
  • QSoundEffect available to C++ now, as well as QML
  • FM Radio Data System classes and types now available (QRadioData, RadioData)
  • Various other API improvements and bugfixes

A number of classes or features previously offered in Qt Multimedia or Qt Multimedia Kit have been removed.

Removed feature Notes
QMediaImageViewer This class (and related controls and services) were removed since their functionality was not suitable for many applications

A number of classes previously offered in Qt Multimedia or Qt Multimedia Kit have changed in ways that may affect previously written code. This table highlights such changes.

Changed feature Notes
qmake project file changes

Previously, to use Qt Multimedia Kit, the qmake project file must contain .. code:: cpp

CONFIG += mobility MOBILITY += multimedia

Now, you only need to write

QT += multimedia

Or, if you want to use the widget classes,

QT += multimedia multimediawidgets
Namespaces The QtMultimediaKit namespace has been renamed to QMultimedia. This affects a few enumerations, namely SupportEstimate, EncodingQuality, EncodingMode and AvailabilityStatus. Searching and replacing QtMultimediaKit with QMultimedia will greatly aid porting efforts. Metadata have been split off into their own namespace, QMediaMetaData.
Metadata types In Qt Multimedia Kit, pre-defined metadata keys were enumerations in the QtMultimediaKit namespace. These pre-defined keys have been changed to string literals in the QMediaMetaData namespace, for consistency with extended keys.
Metadata accessor methods In Qt Multimedia Kit, there were two different families of methods to access metadata. Functions such as QMediaObject::metaData() operated on pre-defined metadata using enumerated keys, while functions such as QMediaObject::extendedMetaData() operated on extended metadata using string keys. Qt 5 combines both families into one (e.g. QMediaObject::metaData()), which can operate on both pre-defined and extended metadata, using string keys.
Qt Metatype registration Qt 5 registers many more classes and types with the meta-object system than before. If you have previously applied Q_DECLARE_METATYPE macros to any Qt Multimedia class, you will probably need to remove them.
QSoundEffect availability The SoundEffect QML type was publicly accessible in Qt Multimeda Kit, and now the C++ version is officially public too. If your code contains the previously undocumented QSoundEffect, you may need to update it.
Camera controls A large number of the camera controls (QCameraImageProcessingControl, QCameraFocusControl, etc.) have been updated to address a number of design flaws. In particular, a number of discrete accessor methods have been collapsed into parametrized methods, and the ranges or data types of some parameters have been adjusted.