81 QList<QImageCapture::FileFormat> list;
82 const auto formats = QImageWriter::supportedImageFormats();
84 for (
const auto &f : formats) {
85 auto format = QString::fromUtf8(f);
86 if (format.compare(QLatin1String(
"jpg"), Qt::CaseInsensitive) == 0)
87 list.append(QImageCapture::FileFormat::JPEG);
88 else if (format.compare(QLatin1String(
"png"), Qt::CaseInsensitive) == 0)
89 list.append(QImageCapture::FileFormat::PNG);
90 else if (format.compare(QLatin1String(
"webp"), Qt::CaseInsensitive) == 0)
91 list.append(QImageCapture::FileFormat::WebP);
92 else if (format.compare(QLatin1String(
"tiff"), Qt::CaseInsensitive) == 0)
93 list.append(QImageCapture::FileFormat::Tiff);
99QWindowsFormatInfo::QWindowsFormatInfo()
101 const QList<CodecMap> containerTable = {
102 { QMediaFormat::MPEG4,
103 { QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::MP3, QMediaFormat::AudioCodec::ALAC, QMediaFormat::AudioCodec::AC3, QMediaFormat::AudioCodec::EAC3 },
104 { QMediaFormat::VideoCodec::H264, QMediaFormat::VideoCodec::H265, QMediaFormat::VideoCodec::MotionJPEG } },
105 { QMediaFormat::Matroska,
106 { QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::MP3, QMediaFormat::AudioCodec::ALAC, QMediaFormat::AudioCodec::AC3, QMediaFormat::AudioCodec::EAC3, QMediaFormat::AudioCodec::FLAC, QMediaFormat::AudioCodec::Vorbis, QMediaFormat::AudioCodec::Opus },
107 { QMediaFormat::VideoCodec::H264, QMediaFormat::VideoCodec::H265, QMediaFormat::VideoCodec::VP8, QMediaFormat::VideoCodec::VP9, QMediaFormat::VideoCodec::MotionJPEG } },
108 { QMediaFormat::WebM,
109 { QMediaFormat::AudioCodec::Vorbis, QMediaFormat::AudioCodec::Opus },
110 { QMediaFormat::VideoCodec::VP8, QMediaFormat::VideoCodec::VP9 } },
111 { QMediaFormat::QuickTime,
112 { QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::MP3, QMediaFormat::AudioCodec::ALAC, QMediaFormat::AudioCodec::AC3, QMediaFormat::AudioCodec::EAC3 },
113 { QMediaFormat::VideoCodec::H264, QMediaFormat::VideoCodec::H265, QMediaFormat::VideoCodec::MotionJPEG } },
115 { QMediaFormat::AudioCodec::AAC },
118 { QMediaFormat::AudioCodec::MP3 },
120 { QMediaFormat::FLAC,
121 { QMediaFormat::AudioCodec::FLAC },
123 { QMediaFormat::Mpeg4Audio,
124 { QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::MP3, QMediaFormat::AudioCodec::ALAC, QMediaFormat::AudioCodec::AC3, QMediaFormat::AudioCodec::EAC3 },
127 { QMediaFormat::AudioCodec::WMA },
130 { QMediaFormat::AudioCodec::WMA },
131 { QMediaFormat::VideoCodec::WMV } }
134 const QSet<QMediaFormat::FileFormat> decoderFormats = {
136 QMediaFormat::Matroska,
138 QMediaFormat::QuickTime,
142 QMediaFormat::Mpeg4Audio,
147 const QSet<QMediaFormat::FileFormat> encoderFormats = {
152 QMediaFormat::Mpeg4Audio,
157 CheckedCodecs<QMediaFormat::AudioCodec> checkedAudioCodecs;
158 CheckedCodecs<QMediaFormat::VideoCodec> checkedVideoCodecs;
160 auto ensureCodecs = [&] (CodecMap &codecs, QMediaFormat::ConversionMode mode) {
161 codecs.audio.removeIf([&] (
auto codec) {
return !isSupportedCodec(codec, mode, checkedAudioCodecs); });
162 codecs.video.removeIf([&] (
auto codec) {
return !isSupportedCodec(codec, mode, checkedVideoCodecs); });
163 return !codecs.video.empty() || !codecs.audio.empty();
166 for (
const auto &codecMap : containerTable) {
167 if (decoderFormats.contains(codecMap.format)) {
169 if (ensureCodecs(m, QMediaFormat::Decode))
173 if (encoderFormats.contains(codecMap.format)) {
175 if (ensureCodecs(m, QMediaFormat::Encode))
180 imageFormats = getImageFormatList();