Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtMultimedia More...
#include <qmediaformat.h>
Public Types | |
enum | FileFormat { UnspecifiedFormat = -1 , WMV , AVI , Matroska , MPEG4 , Ogg , QuickTime , WebM , Mpeg4Audio , AAC , WMA , MP3 , FLAC , Wave , LastFileFormat = Wave } |
Describes the container format used in a multimedia file or stream. More... | |
enum class | AudioCodec { Unspecified = -1 , MP3 , AAC , AC3 , EAC3 , FLAC , DolbyTrueHD , Opus , Vorbis , Wave , WMA , ALAC , LastAudioCodec = ALAC } |
\qmlproperty enumeration QtMultimedia::mediaFormat::fileFormat More... | |
enum class | VideoCodec { Unspecified = -1 , MPEG1 , MPEG2 , MPEG4 , H264 , H265 , VP8 , VP9 , AV1 , Theora , WMV , MotionJPEG , LastVideoCodec = MotionJPEG } |
\qmlproperty enumeration QtMultimedia::mediaFormat::audioCodec More... | |
enum | ConversionMode { Encode , Decode } |
In many cases, systems have asymmetric capabilities and can often decode more formats or codecs than can be encoded. More... | |
enum | ResolveFlags { NoFlags , RequiresVideo } |
Describes the requirements for resolving a suitable format for QMediaRecorder. More... | |
Public Member Functions | |
QMediaFormat (FileFormat format=UnspecifiedFormat) | |
\qmlproperty enumeration QtMultimedia::mediaFormat::videoCodec | |
~QMediaFormat () | |
Destroys the QMediaFormat object. | |
QMediaFormat (const QMediaFormat &other) noexcept | |
Constructs a QMediaFormat object by copying from other. | |
QMediaFormat & | operator= (const QMediaFormat &other) noexcept |
Copies other into this QMediaFormat object. | |
QMediaFormat (QMediaFormat &&other) noexcept=default | |
Constructs a QMediaFormat objects by moving from other. | |
void | swap (QMediaFormat &other) noexcept |
Swaps the media format with other. | |
FileFormat | fileFormat () const |
void | setFileFormat (FileFormat f) |
void | setVideoCodec (VideoCodec codec) |
Sets the video codec to codec. | |
VideoCodec | videoCodec () const |
Returns the video codec used in this format. | |
void | setAudioCodec (AudioCodec codec) |
Sets the audio codec to codec. | |
AudioCodec | audioCodec () const |
Returns the audio codec used in this format. | |
Q_INVOKABLE bool | isSupported (ConversionMode mode) const |
Returns true if Qt Multimedia can encode or decode this format, depending on mode. | |
QMimeType | mimeType () const |
Returns the \l{MIME type} for the file format used in this media format. | |
Q_INVOKABLE QList< FileFormat > | supportedFileFormats (ConversionMode m) |
\qmlmethod list<FileFormat> QtMultimedia::mediaFormat::supportedFileFormats(conversionMode) Returns a list of file formats for the audio and video codec indicated by {conversionMode}. | |
Q_INVOKABLE QList< VideoCodec > | supportedVideoCodecs (ConversionMode m) |
\qmlmethod list<VideoCodec> QtMultimedia::mediaFormat::supportedVideoCodecs(conversionMode) Returns a list of video codecs for the chosen file format and audio codec (conversionMode). | |
Q_INVOKABLE QList< AudioCodec > | supportedAudioCodecs (ConversionMode m) |
\qmlmethod list<AudioCodec> QtMultimedia::mediaFormat::supportedAudioFormats(conversionMode) Returns a list of audio codecs for the chosen file format and video codec (conversionMode). | |
bool | operator== (const QMediaFormat &other) const |
Returns true if other is equal to the current media format, otherwise returns false . | |
bool | operator!= (const QMediaFormat &other) const |
Returns true if other is not equal to the current media format, otherwise returns false . | |
void | resolveForEncoding (ResolveFlags flags) |
Resolves the format, based on flags, to a format that is supported by QMediaRecorder. | |
Static Public Member Functions | |
static Q_INVOKABLE QString | fileFormatName (FileFormat fileFormat) |
\qmlmethod string QtMultimedia::mediaFormat::fileFormatName(fileFormat) Returns a string based name for fileFormat. | |
static Q_INVOKABLE QString | audioCodecName (AudioCodec codec) |
\qmlmethod string QtMultimedia::mediaFormat::audioCodecName(codec) Returns a string based name for codec. | |
static Q_INVOKABLE QString | videoCodecName (VideoCodec codec) |
\qmlmethod string QtMultimedia::mediaFormat::videoCodecName(codec) Returns a string based name for codec. | |
static Q_INVOKABLE QString | fileFormatDescription (QMediaFormat::FileFormat fileFormat) |
\qmlmethod string QtMultimedia::mediaFormat::fileFormatDescription(fileFormat) Returns a description for fileFormat. | |
static Q_INVOKABLE QString | audioCodecDescription (QMediaFormat::AudioCodec codec) |
\qmlmethod string QtMultimedia::mediaFormat::audioCodecDescription(codec) Returns a description for codec. | |
static Q_INVOKABLE QString | videoCodecDescription (QMediaFormat::VideoCodec codec) |
\qmlmethod string QtMultimedia::mediaFormat::videoCodecDescription(codec) Returns a description for codec. | |
Protected Attributes | |
FileFormat | fmt |
AudioCodec | audio = AudioCodec::Unspecified |
VideoCodec | video = VideoCodec::Unspecified |
QExplicitlySharedDataPointer< QMediaFormatPrivate > | d |
Properties | |
FileFormat | fileFormat |
The file (container) format of the media. | |
AudioCodec | audioCodec |
The audio codec of the media. | |
VideoCodec | videoCodec |
The video codec of the media. | |
Friends | |
class | QMediaFormatPrivate |
\inmodule QtMultimedia
Describes an encoding format for a multimedia file or stream.
QMediaFormat describes an encoding format for a multimedia file or stream.
You can check whether a certain media format can be used for encoding or decoding using QMediaFormat.
Definition at line 18 of file qmediaformat.h.
|
strong |
\qmlproperty enumeration QtMultimedia::mediaFormat::fileFormat
Describes the container format used in a multimedia file or stream. It can take one of the following values:
\table \header
Describes the audio codec used in multimedia file or stream.
\value WMA \l {Windows Media Audio} \value AC3 \l {Dolby Digital} \value AAC \l{Advanced Audio Coding} \value ALAC \l{Apple Lossless Audio Codec} \value DolbyTrueHD \l{Dolby TrueHD} \value EAC3 \l {Dolby Digital Plus (EAC3)} \value MP3 \l{MPEG-1 Audio Layer III or MPEG-2 Audio Layer III} \value Wave \l{Waveform Audio File Format} \value Vorbis \l{Ogg Vorbis} \value FLAC \l{Free Lossless Audio Codec} \value Opus \l{Opus Audio Format} \value Unspecified Unspecified codec
\omitvalue LastAudioCodec
Enumerator | |
---|---|
Unspecified | |
MP3 | |
AAC | |
AC3 | |
EAC3 | |
FLAC | |
DolbyTrueHD | |
Opus | |
Vorbis | |
Wave | |
WMA | |
ALAC | |
LastAudioCodec |
Definition at line 47 of file qmediaformat.h.
In many cases, systems have asymmetric capabilities and can often decode more formats or codecs than can be encoded.
This enum describes the requested conversion mode to be used when checking whether a certain file format or codec is supported.
\value Encode Used to check whether a certain file format or codec can be encoded. \value Decode Used to check whether a certain file format or codec can be decoded.
Enumerator | |
---|---|
Encode | |
Decode |
Definition at line 81 of file qmediaformat.h.
Describes the container format used in a multimedia file or stream.
\value WMA \l {Windows Media Audio} \value AAC \l{Advanced Audio Coding} \value Matroska \l{Matroska (MKV)} \value WMV \l{Windows Media Video} \value MP3 \l{MPEG-1 Audio Layer III or MPEG-2 Audio Layer III} \value Wave \l{Waveform Audio File Format} \value Ogg \l{Ogg} \value MPEG4 \l{MPEG-4} \value AVI \l{Audio Video Interleave} \value QuickTime \l{QuickTime} \value WebM \l{WebM} \value Mpeg4Audio \l{MPEG-4 Part 3 or MPEG-4 Audio (formally ISO/IEC 14496-3)} \value FLAC \l{Free Lossless Audio Codec} \value UnspecifiedFormat The format is unspecified.
\omitvalue LastFileFormat
Enumerator | |
---|---|
UnspecifiedFormat | |
WMV | |
AVI | |
Matroska | |
MPEG4 | |
Ogg | |
QuickTime | |
WebM | |
Mpeg4Audio | |
AAC | |
WMA | |
MP3 | |
FLAC | |
Wave | |
LastFileFormat |
Definition at line 26 of file qmediaformat.h.
Describes the requirements for resolving a suitable format for QMediaRecorder.
\value NoFlags No requirements \value RequiresVideo A video codec is required
Enumerator | |
---|---|
NoFlags | |
RequiresVideo |
Definition at line 87 of file qmediaformat.h.
|
strong |
\qmlproperty enumeration QtMultimedia::mediaFormat::audioCodec
Describes the audio codec used in multimedia file or stream. It can take one of the following values:
\table \header
Describes the video coded used in multimedia file or stream.
\value VP8 \l{VP8} \value MPEG2 \l{MPEG-2} \value MPEG1 \l{MPEG-1} \value WMV \l{Windows Media Video} \value H265 \l{High Efficiency Video Coding (HEVC)} \value H264 \l{Advanced Video Coding} \value MPEG4 \l{MPEG-4} \value AV1 \l{AOMedia Video 1} \value MotionJPEG \l{MotionJPEG} \value VP9 \l{VP9} \value Theora \l{Theora} \value Unspecified Video codec not specified
\omitvalue LastVideoCodec
Enumerator | |
---|---|
Unspecified | |
MPEG1 | |
MPEG2 | |
MPEG4 | |
H264 | |
H265 | |
VP8 | |
VP9 | |
AV1 | |
Theora | |
WMV | |
MotionJPEG | |
LastVideoCodec |
Definition at line 64 of file qmediaformat.h.
QMediaFormat::QMediaFormat | ( | FileFormat | format = UnspecifiedFormat | ) |
\qmlproperty enumeration QtMultimedia::mediaFormat::videoCodec
Describes the video codec used in multimedia file or stream. It can take one of the following values:
\table \header
Constructs a QMediaFormat object for format.
Definition at line 354 of file qmediaformat.cpp.
|
default |
Destroys the QMediaFormat object.
|
defaultnoexcept |
Constructs a QMediaFormat object by copying from other.
|
defaultnoexcept |
Constructs a QMediaFormat objects by moving from other.
|
inline |
Returns the audio codec used in this format.
Definition at line 115 of file qmediaformat.h.
|
static |
\qmlmethod string QtMultimedia::mediaFormat::audioCodecDescription(codec) Returns a description for codec.
Returns a description for codec.
Definition at line 673 of file qmediaformat.cpp.
|
static |
\qmlmethod string QtMultimedia::mediaFormat::audioCodecName(codec) Returns a string based name for codec.
Returns a string based name for codec.
Definition at line 589 of file qmediaformat.cpp.
|
inline |
Definition at line 108 of file qmediaformat.h.
|
static |
\qmlmethod string QtMultimedia::mediaFormat::fileFormatDescription(fileFormat) Returns a description for fileFormat.
Returns a description for fileFormat.
Definition at line 643 of file qmediaformat.cpp.
|
static |
\qmlmethod string QtMultimedia::mediaFormat::fileFormatName(fileFormat) Returns a string based name for fileFormat.
Returns a string based name for fileFormat.
Definition at line 559 of file qmediaformat.cpp.
bool QMediaFormat::isSupported | ( | ConversionMode | mode | ) | const |
Returns true
if Qt Multimedia can encode or decode this format, depending on mode.
Definition at line 444 of file qmediaformat.cpp.
QMimeType QMediaFormat::mimeType | ( | ) | const |
Returns the \l{MIME type} for the file format used in this media format.
Definition at line 453 of file qmediaformat.cpp.
|
inline |
Returns true
if other is not equal to the current media format, otherwise returns false
.
Definition at line 134 of file qmediaformat.h.
|
defaultnoexcept |
Copies other into this QMediaFormat object.
Moves other into this QMediaFormat objects.
bool QMediaFormat::operator== | ( | const QMediaFormat & | other | ) | const |
Returns true
if other is equal to the current media format, otherwise returns false
.
Definition at line 730 of file qmediaformat.cpp.
void QMediaFormat::resolveForEncoding | ( | ResolveFlags | flags | ) |
Resolves the format, based on flags, to a format that is supported by QMediaRecorder.
This method tries to find the best possible match for unspecified settings. Settings that are not supported by the recorder will be modified to the closest match that is supported.
When resolving, priority is given in the following order: \list 1
Definition at line 767 of file qmediaformat.cpp.
|
inline |
Sets the audio codec to codec.
Definition at line 114 of file qmediaformat.h.
|
inline |
Definition at line 109 of file qmediaformat.h.
|
inline |
Sets the video codec to codec.
Definition at line 111 of file qmediaformat.h.
QList< QMediaFormat::AudioCodec > QMediaFormat::supportedAudioCodecs | ( | QMediaFormat::ConversionMode | m | ) |
\qmlmethod list<AudioCodec> QtMultimedia::mediaFormat::supportedAudioFormats(conversionMode) Returns a list of audio codecs for the chosen file format and video codec (conversionMode).
To get all supported audio codecs, run this query on a default constructed MediaFormat. To get a list of supported audio codecs for a specific combination of a file format and a video codec, you can set the fileFormat and videoCodec properties before running this query.
Returns a list of audio codecs for the chosen file format and video codec (m).
To get all supported audio codecs, run this query on a default constructed QMediaFormat.
Definition at line 546 of file qmediaformat.cpp.
QList< QMediaFormat::FileFormat > QMediaFormat::supportedFileFormats | ( | QMediaFormat::ConversionMode | m | ) |
\qmlmethod list<FileFormat> QtMultimedia::mediaFormat::supportedFileFormats(conversionMode) Returns a list of file formats for the audio and video codec indicated by {conversionMode}.
To get all supported file formats, run this query on a default constructed MediaFormat. To get a list of file formats supporting a specific combination of an audio and video codec, you can set the audioCodec and videoCodec properties before running this query.
Returns a list of file formats for the audio and video codec indicated by {m}.
To get all supported file formats, run this query on a default constructed QMediaFormat.
Definition at line 494 of file qmediaformat.cpp.
QList< QMediaFormat::VideoCodec > QMediaFormat::supportedVideoCodecs | ( | QMediaFormat::ConversionMode | m | ) |
\qmlmethod list<VideoCodec> QtMultimedia::mediaFormat::supportedVideoCodecs(conversionMode) Returns a list of video codecs for the chosen file format and audio codec (conversionMode).
To get all supported video codecs, run this query on a default constructed MediaFormat. To get a list of supported video codecs for a specific combination of a file format and an audio codec, you can set the fileFormat and audioCodec properties before running this query.
Returns a list of video codecs for the chosen file format and audio codec (m).
To get all supported video codecs, run this query on a default constructed MediaFormat.
Definition at line 520 of file qmediaformat.cpp.
|
inlinenoexcept |
Swaps the media format with other.
Definition at line 100 of file qmediaformat.h.
|
inline |
Returns the video codec used in this format.
Definition at line 112 of file qmediaformat.h.
|
static |
\qmlmethod string QtMultimedia::mediaFormat::videoCodecDescription(codec) Returns a description for codec.
Returns a description for codec.
Definition at line 700 of file qmediaformat.cpp.
|
static |
\qmlmethod string QtMultimedia::mediaFormat::videoCodecName(codec) Returns a string based name for codec.
Returns a string based name for codec.
Definition at line 616 of file qmediaformat.cpp.
|
friend |
Definition at line 140 of file qmediaformat.h.
|
protected |
Definition at line 142 of file qmediaformat.h.
|
protected |
Definition at line 144 of file qmediaformat.h.
|
protected |
Definition at line 141 of file qmediaformat.h.
|
protected |
Definition at line 143 of file qmediaformat.h.
|
readwrite |
The audio codec of the media.
Definition at line 22 of file qmediaformat.h.
|
readwrite |
The file (container) format of the media.
Definition at line 21 of file qmediaformat.h.
|
readwrite |
The video codec of the media.
Definition at line 23 of file qmediaformat.h.