QMediaFormat Class▲
-
Header: QMediaFormat
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
-
qmake: QT += multimedia
-
Group: QMediaFormat is part of multimedia
Detailed Description▲
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.
Member Type Documentation▲
enum QMediaFormat::AudioCodec▲
Describes the audio codec used in multimedia file or stream.
Constant |
Value |
Description |
---|---|---|
QMediaFormat::AudioCodec::WMA |
9 |
|
QMediaFormat::AudioCodec::AC3 |
2 |
|
QMediaFormat::AudioCodec::AAC |
1 |
|
QMediaFormat::AudioCodec::ALAC |
10 |
|
QMediaFormat::AudioCodec::DolbyTrueHD |
5 |
|
QMediaFormat::AudioCodec::EAC3 |
3 |
|
QMediaFormat::AudioCodec::MP3 |
0 |
|
QMediaFormat::AudioCodec::Wave |
8 |
|
QMediaFormat::AudioCodec::Vorbis |
7 |
|
QMediaFormat::AudioCodec::FLAC |
4 |
|
QMediaFormat::AudioCodec::Opus |
6 |
|
QMediaFormat::AudioCodec::Unspecified |
-1 |
Unspecified codec |
enum QMediaFormat::ConversionMode▲
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.
Constant |
Value |
Description |
---|---|---|
QMediaFormat::Encode |
0 |
Used to check whether a certain file format or codec can be encoded. |
QMediaFormat::Decode |
1 |
Used to check whether a certain file format or codec can be decoded. |
See Also▲
enum QMediaFormat::FileFormat▲
Describes the container format used in a multimedia file or stream.
Constant |
Value |
Description |
---|---|---|
QMediaFormat::WMA |
9 |
|
QMediaFormat::AAC |
8 |
|
QMediaFormat::Matroska |
2 |
|
QMediaFormat::WMV |
0 |
|
QMediaFormat::MP3 |
10 |
|
QMediaFormat::Wave |
12 |
|
QMediaFormat::Ogg |
4 |
|
QMediaFormat::MPEG4 |
3 |
|
QMediaFormat::AVI |
1 |
|
QMediaFormat::QuickTime |
5 |
|
QMediaFormat::WebM |
6 |
|
QMediaFormat::Mpeg4Audio |
7 |
|
QMediaFormat::FLAC |
11 |
|
QMediaFormat::UnspecifiedFormat |
-1 |
The format is unspecified. |
enum QMediaFormat::ResolveFlags▲
Describes the requirements for resolving a suitable format for QMediaRecorder.
Constant |
Value |
Description |
---|---|---|
QMediaFormat::NoFlags |
0 |
No requirements |
QMediaFormat::RequiresVideo |
1 |
A video codec is required |
See Also▲
See also resolveForEncoding()
enum QMediaFormat::VideoCodec▲
Describes the video coded used in multimedia file or stream.
Constant |
Value |
Description |
---|---|---|
QMediaFormat::VideoCodec::VP8 |
5 |
|
QMediaFormat::VideoCodec::MPEG2 |
1 |
|
QMediaFormat::VideoCodec::MPEG1 |
0 |
|
QMediaFormat::VideoCodec::WMV |
9 |
|
QMediaFormat::VideoCodec::H265 |
4 |
|
QMediaFormat::VideoCodec::H264 |
3 |
|
QMediaFormat::VideoCodec::MPEG4 |
2 |
|
QMediaFormat::VideoCodec::AV1 |
7 |
|
QMediaFormat::VideoCodec::MotionJPEG |
10 |
|
QMediaFormat::VideoCodec::VP9 |
6 |
|
QMediaFormat::VideoCodec::Theora |
8 |
|
QMediaFormat::VideoCodec::Unspecified |
-1 |
Video codec not specified |
Property Documentation▲
audioCodec : AudioCodec▲
This property holds the audio codec of the media.
Access functions:
-
audioCodec() const
-
void setAudioCodec( codec)
See Also▲
See also QMediaFormat::AudioCodec
fileFormat : FileFormat▲
This property holds the file (container) format of the media.
Access functions:
-
fileFormat() const
-
void setFileFormat( f)
See Also▲
See also QMediaFormat::FileFormat
videoCodec : VideoCodec▲
This property holds the video codec of the media.
Access functions:
-
videoCodec() const
-
void setVideoCodec( codec)
See Also▲
See also QMediaFormat::VideoCodec
Member Function Documentation▲
QMediaFormat::QMediaFormat(QMediaFormat::FileFormat format = UnspecifiedFormat)▲
Constructs a QMediaFormat object for format.
QMediaFormat::QMediaFormat(const QMediaFormat &other)▲
Constructs a QMediaFormat object by copying from other.
QMediaFormat::QMediaFormat(QMediaFormat &&other)▲
Constructs a QMediaFormat objects by moving from other.
QMediaFormat::~QMediaFormat()▲
Destroys the QMediaFormat object.
QMediaFormat::AudioCodec QMediaFormat::audioCodec() const▲
Returns the audio codec used in this format.
Getter function for property audioCodec.
See Also▲
See also setAudioCodec(), QMediaFormat::AudioCodec
[static] QString QMediaFormat::audioCodecDescription(QMediaFormat::AudioCodec codec)▲
Returns a description for codec.
[static] QString QMediaFormat::audioCodecName(QMediaFormat::AudioCodec codec)▲
Returns a string based name for codec.
[static] QString QMediaFormat::fileFormatDescription(QMediaFormat::FileFormat fileFormat)▲
Returns a description for fileFormat.
[static] QString QMediaFormat::fileFormatName(QMediaFormat::FileFormat fileFormat)▲
Returns a string based name for fileFormat.
bool QMediaFormat::isSupported(QMediaFormat::ConversionMode mode) const▲
Returns true if Qt Multimedia can encode or decode this format, depending on mode.
QMimeType QMediaFormat::mimeType() const▲
Returns the MIME type for the file format used in this media format.
void QMediaFormat::resolveForEncoding(QMediaFormat::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:
-
File format
-
Video codec
-
Audio codec
void QMediaFormat::setAudioCodec(QMediaFormat::AudioCodec codec)▲
Sets the audio codec to codec.
Setter function for property audioCodec.
See Also▲
See also audioCodec(), QMediaFormat::AudioCodec
void QMediaFormat::setVideoCodec(QMediaFormat::VideoCodec codec)▲
Sets the video codec to codec.
Setter function for property videoCodec.
See Also▲
See also videoCodec(), QMediaFormat::VideoCodec
QList<QMediaFormat::AudioCodec> QMediaFormat::supportedAudioCodecs(QMediaFormat::ConversionMode m)▲
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.
See Also▲
See also QMediaFormat::ConversionMode
QList<QMediaFormat::FileFormat> QMediaFormat::supportedFileFormats(QMediaFormat::ConversionMode m)▲
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.
See Also▲
See also QMediaFormat::ConversionMode
QList<QMediaFormat::VideoCodec> QMediaFormat::supportedVideoCodecs(QMediaFormat::ConversionMode m)▲
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.
See Also▲
See also QMediaFormat::ConversionMode
QMediaFormat::VideoCodec QMediaFormat::videoCodec() const▲
Returns the video codec used in this format.
Getter function for property videoCodec.
See Also▲
See also setVideoCodec(), QMediaFormat::VideoCodec
[static] QString QMediaFormat::videoCodecDescription(QMediaFormat::VideoCodec codec)▲
Returns a description for codec.
[static] QString QMediaFormat::videoCodecName(QMediaFormat::VideoCodec codec)▲
Returns a string based name for codec.
bool QMediaFormat::operator!=(const QMediaFormat &other) const▲
Returns true if other is not equal to the current media format, otherwise returns false.
QMediaFormat &QMediaFormat::operator=(const QMediaFormat &other)▲
Copies other into this QMediaFormat object.
QMediaFormat &QMediaFormat::operator=(QMediaFormat &&other)▲
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.