QMediaFormat Class
Header: | #include <QMediaFormat> |
CMake: | find_package(Qt6 COMPONENTS Multimedia REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
qmake: | QT += multimedia |
Since: | Qt 6.2 |
Public Types
enum class | AudioCodec { } |
enum | FileFormat { } |
enum class | VideoCodec { } |
Properties
- audioCodec : AudioCodec
- fileFormat : FileFormat
- videoCodec : VideoCodec
Public Functions
QMediaFormat(QMediaFormat &&other) | |
QMediaFormat(const QMediaFormat &other) | |
QMediaFormat(QMediaFormat::FileFormat format = UnspecifiedFormat) | |
QMediaFormat & | operator=(QMediaFormat &&other) |
QMediaFormat & | operator=(const QMediaFormat &other) |
~QMediaFormat() | |
QMediaFormat::AudioCodec | audioCodec() const |
QMediaFormat::FileFormat | fileFormat() const |
bool | isSupported(QMediaFormat::ConversionMode mode) const |
QMimeType | mimeType() const |
void | resolveForEncoding(QMediaFormat::ResolveFlags flags) |
void | setAudioCodec(QMediaFormat::AudioCodec codec) |
void | setFileFormat(QMediaFormat::FileFormat f) |
void | setVideoCodec(QMediaFormat::VideoCodec codec) |
QList<QMediaFormat::AudioCodec> | supportedAudioCodecs(QMediaFormat::ConversionMode m) |
QList<QMediaFormat::FileFormat> | supportedFileFormats(QMediaFormat::ConversionMode m) |
QList<QMediaFormat::VideoCodec> | supportedVideoCodecs(QMediaFormat::ConversionMode m) |
QMediaFormat::VideoCodec | videoCodec() const |
Detailed Description
Describes an encoding format for a multimedia file or stream.
You can check whether a certain QMediaFormat can be used for encoding or decoding using QMediaDecoderInfo or QMediaRecorderInfo.
Member Type Documentation
enum class QMediaFormat::AudioCodec
Describes the audio coded used in multimedia file or stream.
enum QMediaFormat::FileFormat
Describes the container format used in a multimedia file or stream.
enum class QMediaFormat::VideoCodec
Describes the video coded used in multimedia file or stream.
Property Documentation
audioCodec : AudioCodec
This property holds the audio codec of the media.
Access functions:
QMediaFormat::AudioCodec | audioCodec() const |
void | setAudioCodec(QMediaFormat::AudioCodec codec) |
See also QMediaFormat::AudioCodec.
fileFormat : FileFormat
This property holds the file (container) format of the media.
Access functions:
QMediaFormat::FileFormat | fileFormat() const |
void | setFileFormat(QMediaFormat::FileFormat f) |
See also QMediaFormat::FileFormat.
videoCodec : VideoCodec
This property holds the video codec of the media.
Access functions:
QMediaFormat::VideoCodec | videoCodec() const |
void | setVideoCodec(QMediaFormat::VideoCodec codec) |
See also QMediaFormat::VideoCodec.
Member Function Documentation
QMediaFormat::QMediaFormat(QMediaFormat &&other)
Constructs a QMediaFormat objects by moving from other.
QMediaFormat::QMediaFormat(const QMediaFormat &other)
Constructs a QMediaFormat object by copying from other.
QMediaFormat::QMediaFormat(QMediaFormat::FileFormat format = UnspecifiedFormat)
Constucts a QMediaFormat object for format.
QMediaFormat &QMediaFormat::operator=(QMediaFormat &&other)
Moves other into this QMediaFormat objects.
QMediaFormat &QMediaFormat::operator=(const QMediaFormat &other)
Copies other into this QMediaFormat object.
QMediaFormat::~QMediaFormat()
Destroys the QMediaFormat object.
QMediaFormat::AudioCodec QMediaFormat::audioCodec() const
Returns the audio codec used in this format.
Note: Getter function for property audioCodec.
See also setAudioCodec() and QMediaFormat::AudioCodec.
[invokable]
bool QMediaFormat::isSupported(QMediaFormat::ConversionMode mode) const
Returns true if Qt Multimedia can encode or decode this format, depending on mode.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also QMediaDecoderInfo.
QMimeType QMediaFormat::mimeType() const
Returns the mimetype for the file format used in this media format.
See also format() and setFormat().
void QMediaFormat::resolveForEncoding(QMediaFormat::ResolveFlags flags)
Resolves the format 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.
void QMediaFormat::setAudioCodec(QMediaFormat::AudioCodec codec)
Sets the audio codec to codec.
Note: Setter function for property audioCodec.
See also audioCodec() and QMediaFormat::AudioCodec.
void QMediaFormat::setVideoCodec(QMediaFormat::VideoCodec codec)
Sets the video codec to codec.
Note: Setter function for property videoCodec.
See also videoCodec() and QMediaFormat::VideoCodec.
[invokable]
QList<QMediaFormat::AudioCodec> QMediaFormat::supportedAudioCodecs(QMediaFormat::ConversionMode m)
Returns a list of audio codecs that are supported for mode.
The list is constrained by the chosen file format and video codec and will only return the audio codecs that can be used with those settings.
To get all supported audio codecs, run this query on a default constructed QMediaFormat.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
QList<QMediaFormat::FileFormat> QMediaFormat::supportedFileFormats(QMediaFormat::ConversionMode m)
Returns a list of container formats that are supported for mode.
The list is constrained by the chosen audio and video codec and will only match file formats that can be created with those codecs.
To get all supported file formats, run this query on a default constructed QMediaFormat.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
QList<QMediaFormat::VideoCodec> QMediaFormat::supportedVideoCodecs(QMediaFormat::ConversionMode m)
Returns a list of video codecs that are supported for mode.
The list is constrained by the chosen file format and audio codec and will only return the video codecs that can be used with those settings.
To get all supported video codecs, run this query on a default constructed QMediaFormat.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
QMediaFormat::VideoCodec QMediaFormat::videoCodec() const
Returns the video codec used in this format.
Note: Getter function for property videoCodec.
See also setVideoCodec() and QMediaFormat::VideoCodec.