From 4241af760259211cc52b6817b3a28c4dbf450dbf Mon Sep 17 00:00:00 2001 From: Doris Verria Date: Fri, 10 Sep 2021 14:56:59 +0200 Subject: QDarwinFormatInfo: Remove unsupported audio codecs for encoding From the Apple docs, AVFoundation can only support encoding to AAC, ALAC, and WAV from our list of codecs. Remove the rest of the audio codecs from the list of encoders. Fixes: QTBUG-96376 Pick-to: 6.2.0 6.2 Change-Id: I4ceba470f5267212dd7088a15cc311ff2d07512f Reviewed-by: Lars Knoll --- .../platform/darwin/qdarwinformatsinfo.mm | 23 +++------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/multimedia') diff --git a/src/multimedia/platform/darwin/qdarwinformatsinfo.mm b/src/multimedia/platform/darwin/qdarwinformatsinfo.mm index 58b973ea9..9d27a843d 100644 --- a/src/multimedia/platform/darwin/qdarwinformatsinfo.mm +++ b/src/multimedia/platform/darwin/qdarwinformatsinfo.mm @@ -85,7 +85,7 @@ static struct { { "; codecs=\"ac-3\"", QMediaFormat::AudioCodec::AC3 }, { "; codecs=\"ec-3\"", QMediaFormat::AudioCodec::EAC3 }, { "; codecs=\"flac\"", QMediaFormat::AudioCodec::FLAC }, - { "; codecs=\"alac\"", QMediaFormat::AudioCodec::FLAC }, + { "; codecs=\"alac\"", QMediaFormat::AudioCodec::ALAC }, { "; codecs=\"opus\"", QMediaFormat::AudioCodec::Opus }, { nullptr, QMediaFormat::AudioCodec::Unspecified }, }; @@ -117,7 +117,6 @@ QDarwinFormatInfo::QDarwinFormatInfo() while (a->name) { QByteArray extendedMimetype = m->name; extendedMimetype += a->name; -// qDebug() << "audio" << extendedMimetype << [AVURLAsset isPlayableExtendedMIMEType:[NSString stringWithUTF8String:extendedMimetype.constData()]]; if ([AVURLAsset isPlayableExtendedMIMEType:[NSString stringWithUTF8String:extendedMimetype.constData()]]) audio << a->value; ++a; @@ -133,29 +132,14 @@ QDarwinFormatInfo::QDarwinFormatInfo() } } -// #if 1 -// // ### Verify that this is correct -// encoders = decoders; -// #else - // ### Haven't seen a good way to figure this out. // seems AVFoundation only supports those for encoding encoders = { { QMediaFormat::MPEG4, - { QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::MP3, QMediaFormat::AudioCodec::ALAC, QMediaFormat::AudioCodec::AC3, QMediaFormat::AudioCodec::EAC3, }, + { QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::ALAC }, { QMediaFormat::VideoCodec::H264, QMediaFormat::VideoCodec::H265, QMediaFormat::VideoCodec::MotionJPEG } }, { QMediaFormat::QuickTime, - { QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::MP3, QMediaFormat::AudioCodec::ALAC, QMediaFormat::AudioCodec::AC3, QMediaFormat::AudioCodec::EAC3, }, + { QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::ALAC }, { QMediaFormat::VideoCodec::H264, QMediaFormat::VideoCodec::H265, QMediaFormat::VideoCodec::MotionJPEG } }, - // seems AVFoundation does not support directly encoding to an AAC and MP3 file - // { QMediaFormat::AAC, - // { QMediaFormat::AudioCodec::AAC }, - // {} }, - // { QMediaFormat::MP3, - // { QMediaFormat::AudioCodec::MP3 }, - // {} }, - // { QMediaFormat::FLAC, - // { QMediaFormat::AudioCodec::FLAC }, - // {} }, { QMediaFormat::Mpeg4Audio, { QMediaFormat::AudioCodec::AAC }, {} }, @@ -163,7 +147,6 @@ QDarwinFormatInfo::QDarwinFormatInfo() { QMediaFormat::AudioCodec::Wave }, {} }, }; -// #endif // ### imageFormats << QImageCapture::JPEG; -- cgit v1.2.3