15 if (!
name || strncmp(
name,
"audio/", 6))
18 if (!strcmp(
name,
"mpeg")) {
19 auto version = structure[
"mpegversion"].toInt();
21 auto layer = structure[
"layer"];
27 }
else if (!strcmp(
name,
"x-ac3")) {
29 }
else if (!strcmp(
name,
"x-eac3")) {
31 }
else if (!strcmp(
name,
"x-flac")) {
33 }
else if (!strcmp(
name,
"x-alac")) {
35 }
else if (!strcmp(
name,
"x-true-hd")) {
37 }
else if (!strcmp(
name,
"x-vorbis")) {
39 }
else if (!strcmp(
name,
"x-opus")) {
41 }
else if (!strcmp(
name,
"x-wav")) {
43 }
else if (!strcmp(
name,
"x-wma")) {
53 if (!
name || strncmp(
name,
"video/", 6))
57 if (!strcmp(
name,
"mpeg")) {
58 auto version = structure[
"mpegversion"].toInt();
61 else if (version == 2)
63 else if (version == 4)
65 }
else if (!strcmp(
name,
"x-h264")) {
67#if GST_CHECK_VERSION(1, 17, 0)
68 }
else if (!strcmp(
name,
"x-h265")) {
71 }
else if (!strcmp(
name,
"x-vp8")) {
73 }
else if (!strcmp(
name,
"x-vp9")) {
75 }
else if (!strcmp(
name,
"x-av1")) {
77 }
else if (!strcmp(
name,
"x-theora")) {
79 }
else if (!strcmp(
name,
"x-jpeg")) {
81 }
else if (!strcmp(
name,
"x-wmv")) {
91 if (!strcmp(
name,
"video/x-ms-asf")) {
93 }
else if (!strcmp(
name,
"video/x-msvideo")) {
95 }
else if (!strcmp(
name,
"video/x-matroska")) {
97 }
else if (!strcmp(
name,
"video/quicktime")) {
98 auto variant = structure[
"variant"].toString();
101 else if (!strcmp(
variant,
"iso"))
103 }
else if (!strcmp(
name,
"video/ogg")) {
105 }
else if (!strcmp(
name,
"video/webm")) {
107 }
else if (!strcmp(
name,
"audio/x-m4a")) {
109 }
else if (!strcmp(
name,
"audio/x-wav")) {
111 }
else if (!strcmp(
name,
"audio/mpeg")) {
112 auto mpegversion = structure[
"mpegversion"].toInt();
113 if (mpegversion == 1) {
114 auto layer = structure[
"layer"];
127 if (!strcmp(
name,
"image/jpeg")) {
129 }
else if (!strcmp(
name,
"image/png")) {
131 }
else if (!strcmp(
name,
"image/webp")) {
133 }
else if (!strcmp(
name,
"image/tiff")) {
141 QList<QMediaFormat::AudioCodec> audio;
142 QList<QMediaFormat::VideoCodec> video;
144 GstPadDirection padDirection =
decode ? GST_PAD_SINK : GST_PAD_SRC;
146 GList *elementList = gst_element_factory_list_get_elements(
decode ? GST_ELEMENT_FACTORY_TYPE_DECODER : GST_ELEMENT_FACTORY_TYPE_ENCODER,
149 for (GstElementFactory *
factory :
151 for (GstStaticPadTemplate *padTemplate :
153 gst_element_factory_get_static_pad_templates(
factory))) {
154 if (padTemplate->direction == padDirection) {
157 for (
int i = 0;
i < caps.size();
i++) {
169 gst_plugin_feature_list_free(elementList);
170 return {audio, video};
175 QList<QMediaFormat::AudioCodec> supportedAudioCodecs,
176 QList<QMediaFormat::VideoCodec> supportedVideoCodecs)
178 QList<QGstreamerFormatInfo::CodecMap> muxers;
180 GstPadDirection padDirection = demuxer ? GST_PAD_SINK : GST_PAD_SRC;
182 GList *elementList = gst_element_factory_list_get_elements(
183 demuxer ? GST_ELEMENT_FACTORY_TYPE_DEMUXER : GST_ELEMENT_FACTORY_TYPE_MUXER,
186 for (GstElementFactory *
factory :
188 QList<QMediaFormat::FileFormat> fileFormats;
190 for (GstStaticPadTemplate *padTemplate :
192 gst_element_factory_get_static_pad_templates(
factory))) {
194 if (padTemplate->direction == padDirection) {
197 for (
int i = 0;
i < caps.size();
i++) {
201 fileFormats.append(
fmt);
205 if (fileFormats.isEmpty())
208 QList<QMediaFormat::AudioCodec> audioCodecs;
209 QList<QMediaFormat::VideoCodec> videoCodecs;
211 for (GstStaticPadTemplate *padTemplate :
213 gst_element_factory_get_static_pad_templates(
factory))) {
216 if (padTemplate->direction != padDirection) {
219 bool acceptsRawAudio =
false;
220 for (
int i = 0;
i < caps.size();
i++) {
222 if (structure.
name() ==
"audio/x-raw")
223 acceptsRawAudio =
true;
226 audioCodecs.append(audio);
229 videoCodecs.append(video);
231 if (acceptsRawAudio && fileFormats.size() == 1) {
232 switch (fileFormats.at(0)) {
249 if (!audioCodecs.isEmpty() || !videoCodecs.isEmpty()) {
250 for (
auto f : std::as_const(fileFormats)) {
251 muxers.append({
f, audioCodecs, videoCodecs});
262 gst_plugin_feature_list_free(elementList);
268 QSet<QImageCapture::FileFormat>
formats;
270 GList *elementList = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_ENCODER,
273 for (GstElementFactory *
factory :
276 for (GstStaticPadTemplate *padTemplate :
278 gst_element_factory_get_static_pad_templates(
factory))) {
279 if (padTemplate->direction == GST_PAD_SRC) {
282 for (
int i = 0;
i < caps.
size();
i++) {
293 gst_plugin_feature_list_free(elementList);
298static void dumpAudioCodecs(
const QList<QMediaFormat::AudioCodec> &codecList)
300 qDebug() <<
"Audio codecs:";
301 for (
const auto &
c : codecList)
305static void dumpVideoCodecs(
const QList<QMediaFormat::VideoCodec> &codecList)
307 qDebug() <<
"Video codecs:";
308 for (
const auto &
c : codecList)
312static void dumpMuxers(
const QList<QPlatformMediaFormatInfo::CodecMap> &muxerList)
314 for (
const auto &
m : muxerList) {
317 for (
const auto &
a :
m.audio)
320 for (
const auto &
v :
m.video)
352 "video/quicktime, variant=(string)iso",
356 "video/quicktime, variant=(string)iso",
357 "video/quicktime, variant=(string)iso",
359 "audio/mpeg, mpegversion=(int)1, layer=(int)3",
368 auto codec =
f.audioCodec();
373 "audio/mpeg, mpegversion=(int)1, layer=(int)3",
374 "audio/mpeg, mpegversion=(int)4",
390 auto codec =
f.videoCodec();
395 "video/mpeg, mpegversion=(int)1",
396 "video/mpeg, mpegversion=(int)2",
397 "video/mpeg, mpegversion=(int)4",
constexpr const_pointer data() const noexcept
QGstStructure at(int index) const
QByteArrayView name() const
FileFormat
Choose one of the following image formats:
Combined button and popup list for selecting options.
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLint GLsizei GLsizei GLenum format
QVideoFrameFormat::PixelFormat fmt
QItemEditorFactory * factory
bool contains(const AT &t) const noexcept