Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qmediaformat.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QMEDIAFORMAT_H
5#define QMEDIAFORMAT_H
6
7#include <QtCore/qsharedpointer.h>
8#include <QtMultimedia/qtmultimediaglobal.h>
9
11
12class QMimeType;
13class QMediaFormat;
15
17
18class Q_MULTIMEDIA_EXPORT QMediaFormat
19{
21 Q_PROPERTY(FileFormat fileFormat READ fileFormat WRITE setFileFormat)
22 Q_PROPERTY(AudioCodec audioCodec READ audioCodec WRITE setAudioCodec)
23 Q_PROPERTY(VideoCodec videoCodec READ videoCodec WRITE setVideoCodec)
24 Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
25public:
27 UnspecifiedFormat = -1,
28 // Video Formats
36 // Audio Only Formats
43 LastFileFormat = Wave
44 };
45 Q_ENUM(FileFormat)
46
47 enum class AudioCodec {
48 Unspecified = -1,
49 MP3,
50 AAC,
51 AC3,
52 EAC3,
53 FLAC,
54 DolbyTrueHD,
55 Opus,
56 Vorbis,
57 Wave,
58 WMA,
59 ALAC,
60 LastAudioCodec = ALAC
61 };
62 Q_ENUM(AudioCodec)
63
64 enum class VideoCodec {
65 Unspecified = -1,
66 MPEG1,
67 MPEG2,
68 MPEG4,
69 H264,
70 H265,
71 VP8,
72 VP9,
73 AV1,
74 Theora,
75 WMV,
76 MotionJPEG,
77 LastVideoCodec = MotionJPEG
78 };
79 Q_ENUM(VideoCodec)
80
83 Decode
84 };
86
88 {
90 RequiresVideo
91 };
92
93 QMediaFormat(FileFormat format = UnspecifiedFormat);
97
98 QMediaFormat(QMediaFormat &&other) noexcept = default;
99 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMediaFormat)
101 {
102 std::swap(fmt, other.fmt);
103 std::swap(audio, other.audio);
104 std::swap(video, other.video);
105 d.swap(other.d);
106 }
107
108 FileFormat fileFormat() const { return fmt; }
110
112 VideoCodec videoCodec() const { return video; }
113
115 AudioCodec audioCodec() const { return audio; }
116
117 Q_INVOKABLE bool isSupported(ConversionMode mode) const;
118
119 QMimeType mimeType() const;
120
121 Q_INVOKABLE QList<FileFormat> supportedFileFormats(ConversionMode m);
122 Q_INVOKABLE QList<VideoCodec> supportedVideoCodecs(ConversionMode m);
123 Q_INVOKABLE QList<AudioCodec> supportedAudioCodecs(ConversionMode m);
124
125 Q_INVOKABLE static QString fileFormatName(FileFormat fileFormat);
126 Q_INVOKABLE static QString audioCodecName(AudioCodec codec);
127 Q_INVOKABLE static QString videoCodecName(VideoCodec codec);
128
129 Q_INVOKABLE static QString fileFormatDescription(QMediaFormat::FileFormat fileFormat);
130 Q_INVOKABLE static QString audioCodecDescription(QMediaFormat::AudioCodec codec);
131 Q_INVOKABLE static QString videoCodecDescription(QMediaFormat::VideoCodec codec);
132
133 bool operator==(const QMediaFormat &other) const;
134 bool operator!=(const QMediaFormat &other) const
135 { return !operator==(other); }
136
137 void resolveForEncoding(ResolveFlags flags);
138
139protected:
142 AudioCodec audio = AudioCodec::Unspecified;
143 VideoCodec video = VideoCodec::Unspecified;
144 QExplicitlySharedDataPointer<QMediaFormatPrivate> d;
145};
146
148
149#endif
\inmodule QtMultimedia
QMediaFormat & operator=(const QMediaFormat &other) noexcept
Copies other into this QMediaFormat object.
AudioCodec
\qmlproperty enumeration QtMultimedia::mediaFormat::fileFormat
void setVideoCodec(VideoCodec codec)
Sets the video codec to codec.
QMediaFormat(QMediaFormat &&other) noexcept=default
Constructs a QMediaFormat objects by moving from other.
AudioCodec audioCodec() const
Returns the audio codec used in this format.
FileFormat
Describes the container format used in a multimedia file or stream.
bool operator!=(const QMediaFormat &other) const
Returns true if other is not equal to the current media format, otherwise returns false.
VideoCodec videoCodec() const
Returns the video codec used in this format.
FileFormat fmt
QExplicitlySharedDataPointer< QMediaFormatPrivate > d
void setAudioCodec(AudioCodec codec)
Sets the audio codec to codec.
~QMediaFormat()
Destroys the QMediaFormat object.
ConversionMode
In many cases, systems have asymmetric capabilities and can often decode more formats or codecs than ...
VideoCodec
\qmlproperty enumeration QtMultimedia::mediaFormat::audioCodec
FileFormat fileFormat() const
ResolveFlags
Describes the requirements for resolving a suitable format for QMediaRecorder.
void setFileFormat(FileFormat f)
QMediaFormat(const QMediaFormat &other) noexcept
Constructs a QMediaFormat object by copying from other.
\inmodule QtCore
Definition qmimetype.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
QMediaFormat::AudioCodec codec
const char * mimeType
QMediaFormat::FileFormat fileFormat
ConversionMode
Definition qjsoncbor.cpp:25
GLenum mode
const GLfloat * m
GLfloat GLfloat f
GLbitfield flags
GLint GLsizei GLsizei GLenum format
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(Class, ExportMacro)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_CLASSINFO(name, value)
#define Q_INVOKABLE
#define Q_GADGET
QVideoFrameFormat::PixelFormat fmt
QSharedPointer< T > other(t)
[5]
this swap(other)