QMediaFormat Class

Beschreibt ein Kodierungsformat für eine Multimediadatei oder einen Stream. Mehr...

Kopfzeile: #include <QMediaFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia

Öffentliche Typen

enum class AudioCodec { WMA, AC3, AAC, ALAC, DolbyTrueHD, …, Unspecified }
enum ConversionMode { Encode, Decode }
enum FileFormat { WMA, AAC, Matroska, WMV, MP3, …, UnspecifiedFormat }
enum ResolveFlags { NoFlags, RequiresVideo }
enum class VideoCodec { VP8, MPEG2, MPEG1, WMV, H265, …, Unspecified }

Eigenschaften

Öffentliche Funktionen

QMediaFormat(QMediaFormat::FileFormat format = UnspecifiedFormat)
QMediaFormat(const QMediaFormat &other)
QMediaFormat(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)
void swap(QMediaFormat &other)
QMediaFormat::VideoCodec videoCodec() const
bool operator!=(const QMediaFormat &other) const
QMediaFormat &operator=(QMediaFormat &&other)
QMediaFormat &operator=(const QMediaFormat &other)
bool operator==(const QMediaFormat &other) const

Statische öffentliche Mitglieder

QString audioCodecDescription(QMediaFormat::AudioCodec codec)
QString audioCodecName(QMediaFormat::AudioCodec codec)
QString fileFormatDescription(QMediaFormat::FileFormat fileFormat)
QString fileFormatName(QMediaFormat::FileFormat fileFormat)
QString videoCodecDescription(QMediaFormat::VideoCodec codec)
QString videoCodecName(QMediaFormat::VideoCodec codec)

Detaillierte Beschreibung

QMediaFormat beschreibt ein Kodierungsformat für eine Multimedia-Datei oder einen Stream.

Mit QMediaFormat können Sie überprüfen, ob ein bestimmtes Medienformat für die Kodierung oder Dekodierung verwendet werden kann.

Dokumentation der Mitgliedstypen

enum class QMediaFormat::AudioCodec

Beschreibt den in der Multimediadatei oder dem Stream verwendeten Audiocodec.

KonstanteWertBeschreibung
QMediaFormat::AudioCodec::WMA9Windows Media Audio
QMediaFormat::AudioCodec::AC32Dolby Digital
QMediaFormat::AudioCodec::AAC1Erweiterte Audiocodierung
QMediaFormat::AudioCodec::ALAC10Apple Lossless-Audiocodec
QMediaFormat::AudioCodec::DolbyTrueHD5Dolby TrueHD
QMediaFormat::AudioCodec::EAC33Dolby Digital Plus (EAC3)
QMediaFormat::AudioCodec::MP30MPEG-1 Audio Layer III oder MPEG-2 Audio Layer III
QMediaFormat::AudioCodec::Wave8Waveform Audio Dateiformat
QMediaFormat::AudioCodec::Vorbis7Ogg Vorbis
QMediaFormat::AudioCodec::FLAC4Freier verlustfreier Audiocodec
QMediaFormat::AudioCodec::Opus6Opus Audio Format
QMediaFormat::AudioCodec::Unspecified-1Nicht spezifizierter Codec

enum QMediaFormat::ConversionMode

In vielen Fällen haben Systeme asymmetrische Fähigkeiten und können oft mehr Formate oder Codecs dekodieren als kodiert werden können. Diese Aufzählung beschreibt den angeforderten Konvertierungsmodus, der bei der Prüfung, ob ein bestimmtes Dateiformat oder ein Codec unterstützt wird, verwendet werden soll.

KonstanteWertBeschreibung
QMediaFormat::Encode0Wird verwendet, um zu prüfen, ob ein bestimmtes Dateiformat oder ein Codec kodiert werden kann.
QMediaFormat::Decode1Wird verwendet, um zu prüfen, ob ein bestimmtes Dateiformat oder ein Codec dekodiert werden kann.

Siehe auch supportedFileFormats, supportedAudioCodecs, und supportedVideoCodecs.

enum QMediaFormat::FileFormat

Beschreibt das in einer Multimediadatei oder einem Stream verwendete Containerformat.

KonstanteWertBeschreibung
QMediaFormat::WMA9Windows Media Audio
QMediaFormat::AAC8Erweiterte Audiocodierung
QMediaFormat::Matroska2Matroska (MKV)
QMediaFormat::WMV0Windows Media Video
QMediaFormat::MP310MPEG-1 Audio Layer III oder MPEG-2 Audio Layer III
QMediaFormat::Wave12Wellenform-Audio-Dateiformat
QMediaFormat::Ogg4Ogg
QMediaFormat::MPEG43MPEG-4
QMediaFormat::AVI1Audio-Video-Verschachtelung
QMediaFormat::QuickTime5QuickTime
QMediaFormat::WebM6WebM
QMediaFormat::Mpeg4Audio7MPEG-4 Teil 3 oder MPEG-4 Audio (formell ISO/IEC 14496-3)
QMediaFormat::FLAC11Freier verlustfreier Audiocodec
QMediaFormat::UnspecifiedFormat-1Das Format ist nicht spezifiziert.

enum QMediaFormat::ResolveFlags

Beschreibt die Anforderungen für die Festlegung eines geeigneten Formats für QMediaRecorder.

KonstanteWertBeschreibung
QMediaFormat::NoFlags0Keine Anforderungen
QMediaFormat::RequiresVideo1Ein Videocodec ist erforderlich

Siehe auch resolveForEncoding().

enum class QMediaFormat::VideoCodec

Beschreibt den in der Multimediadatei oder dem Stream verwendeten Videocode.

KonstanteWertBeschreibung
QMediaFormat::VideoCodec::VP85VP8
QMediaFormat::VideoCodec::MPEG21MPEG-2
QMediaFormat::VideoCodec::MPEG10MPEG-1
QMediaFormat::VideoCodec::WMV9Windows Media Video
QMediaFormat::VideoCodec::H2654Hocheffiziente Videokodierung (HEVC)
QMediaFormat::VideoCodec::H2643Erweiterte Videokodierung
QMediaFormat::VideoCodec::MPEG42MPEG-4
QMediaFormat::VideoCodec::AV17AOMedia Video 1
QMediaFormat::VideoCodec::MotionJPEG10MotionJPEG
QMediaFormat::VideoCodec::VP96VP9
QMediaFormat::VideoCodec::Theora8Theora
QMediaFormat::VideoCodec::Unspecified-1Video-Codec nicht angegeben

Eigenschaft Dokumentation

audioCodec : AudioCodec

Diese Eigenschaft enthält den Audiocodec des Mediums.

Zugriffsfunktionen:

QMediaFormat::AudioCodec audioCodec() const
void setAudioCodec(QMediaFormat::AudioCodec codec)

Siehe auch QMediaFormat::AudioCodec.

fileFormat : FileFormat

Diese Eigenschaft enthält das Dateiformat (Container) des Mediums.

Zugriffsfunktionen:

QMediaFormat::FileFormat fileFormat() const
void setFileFormat(QMediaFormat::FileFormat f)

Siehe auch QMediaFormat::FileFormat.

videoCodec : VideoCodec

Diese Eigenschaft enthält den Videocodec des Mediums.

Zugriffsfunktionen:

QMediaFormat::VideoCodec videoCodec() const
void setVideoCodec(QMediaFormat::VideoCodec codec)

Siehe auch QMediaFormat::VideoCodec.

Dokumentation der Mitgliedsfunktionen

QMediaFormat::QMediaFormat(QMediaFormat::FileFormat format = UnspecifiedFormat)

Konstruiert ein QMediaFormat-Objekt für format.

[noexcept] QMediaFormat::QMediaFormat(const QMediaFormat &other)

Konstruiert ein QMediaFormat-Objekt durch Kopieren von other.

[noexcept] QMediaFormat::QMediaFormat(QMediaFormat &&other)

Konstruiert ein QMediaFormat-Objekt durch Verschieben von other.

[noexcept] QMediaFormat::~QMediaFormat()

Zerstört das Objekt QMediaFormat.

QMediaFormat::AudioCodec QMediaFormat::audioCodec() const

Gibt den in diesem Format verwendeten Audiocodec zurück.

Hinweis: Getter-Funktion für die Eigenschaft audioCodec.

Siehe auch setAudioCodec() und QMediaFormat::AudioCodec.

[static invokable] QString QMediaFormat::audioCodecDescription(QMediaFormat::AudioCodec codec)

Gibt eine Beschreibung für codec zurück.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

[static invokable] QString QMediaFormat::audioCodecName(QMediaFormat::AudioCodec codec)

Gibt einen stringbasierten Namen für codec zurück.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

[static invokable] QString QMediaFormat::fileFormatDescription(QMediaFormat::FileFormat fileFormat)

Gibt eine Beschreibung für fileFormat zurück.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

[static invokable] QString QMediaFormat::fileFormatName(QMediaFormat::FileFormat fileFormat)

Gibt einen stringbasierten Namen für fileFormat zurück.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

[invokable] bool QMediaFormat::isSupported(QMediaFormat::ConversionMode mode) const

Gibt true zurück, wenn Qt Multimedia dieses Format kodieren oder dekodieren kann, abhängig von mode.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

QMimeType QMediaFormat::mimeType() const

Gibt den MIME-Typ für das in diesem Medienformat verwendete Dateiformat zurück.

void QMediaFormat::resolveForEncoding(QMediaFormat::ResolveFlags flags)

Löst das Format, basierend auf flags, in ein Format auf, das von QMediaRecorder unterstützt wird.

Diese Methode versucht, die bestmögliche Übereinstimmung für nicht spezifizierte Einstellungen zu finden. Einstellungen, die vom Rekorder nicht unterstützt werden, werden auf die nächstmögliche Übereinstimmung geändert, die unterstützt wird.

Bei der Auflösung wird die Priorität in der folgenden Reihenfolge angegeben:

  1. Dateiformat
  2. Video-Codec
  3. Audiocodec

void QMediaFormat::setAudioCodec(QMediaFormat::AudioCodec codec)

Setzt den Audiocodec auf codec.

Hinweis: Setter-Funktion für die Eigenschaft audioCodec.

Siehe auch audioCodec() und QMediaFormat::AudioCodec.

void QMediaFormat::setVideoCodec(QMediaFormat::VideoCodec codec)

Setzt den Videocodec auf codec.

Hinweis: Setter-Funktion für die Eigenschaft videoCodec.

Siehe auch videoCodec() und QMediaFormat::VideoCodec.

[invokable] QList<QMediaFormat::AudioCodec> QMediaFormat::supportedAudioCodecs(QMediaFormat::ConversionMode m)

Liefert eine Liste von Audio-Codecs für das gewählte Dateiformat und den Video-Codec (m).

Um alle unterstützten Audiocodecs zu erhalten, führen Sie diese Abfrage auf einer standardmäßig konstruierten QMediaFormat aus.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

Siehe auch QMediaFormat::ConversionMode.

[invokable] QList<QMediaFormat::FileFormat> QMediaFormat::supportedFileFormats(QMediaFormat::ConversionMode m)

Gibt eine Liste von Dateiformaten für den durch m angegebenen Audio- und Videocodec zurück.

Um alle unterstützten Dateiformate zu erhalten, führen Sie diese Abfrage auf einem standardmäßig konstruierten QMediaFormat aus.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

Siehe auch QMediaFormat::ConversionMode.

[invokable] QList<QMediaFormat::VideoCodec> QMediaFormat::supportedVideoCodecs(QMediaFormat::ConversionMode m)

Gibt eine Liste der Video-Codecs für das gewählte Dateiformat und den Audio-Codec zurück (m).

Um alle unterstützten Videocodecs zu erhalten, führen Sie diese Abfrage für ein standardmäßig konstruiertes MediaFormat aus.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

Siehe auch QMediaFormat::ConversionMode.

[noexcept] void QMediaFormat::swap(QMediaFormat &other)

Tauscht das Medienformat mit other aus.

QMediaFormat::VideoCodec QMediaFormat::videoCodec() const

Gibt den in diesem Format verwendeten Videocodec zurück.

Hinweis: Getter-Funktion für die Eigenschaft videoCodec.

Siehe auch setVideoCodec() und QMediaFormat::VideoCodec.

[static invokable] QString QMediaFormat::videoCodecDescription(QMediaFormat::VideoCodec codec)

Gibt eine Beschreibung für codec zurück.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

[static invokable] QString QMediaFormat::videoCodecName(QMediaFormat::VideoCodec codec)

Gibt einen stringbasierten Namen für codec zurück.

Hinweis: Diese Funktion kann über das Meta-Objektsystem und von QML aus aufgerufen werden. Siehe Q_INVOKABLE.

bool QMediaFormat::operator!=(const QMediaFormat &other) const

Gibt true zurück, wenn other nicht mit dem aktuellen Medienformat übereinstimmt, andernfalls wird false zurückgegeben.

[noexcept] QMediaFormat &QMediaFormat::operator=(QMediaFormat &&other)

Verschiebt other in diese QMediaFormat Objekte.

[noexcept] QMediaFormat &QMediaFormat::operator=(const QMediaFormat &other)

Kopiert other in dieses QMediaFormat Objekt.

bool QMediaFormat::operator==(const QMediaFormat &other) const

Gibt true zurück, wenn other mit dem aktuellen Medienformat übereinstimmt, andernfalls wird false zurückgegeben.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.