summaryrefslogtreecommitdiffstats
path: root/src/multimedia/audio
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-01-21 13:55:39 +0100
committerLars Knoll <lars.knoll@qt.io>2021-01-29 08:50:03 +0000
commit4b720199c379b90b160a7b9632388ebbc44e55c3 (patch)
tree3e9d098edd85881c82ffdffc6cbe940131372a56 /src/multimedia/audio
parent8b749d4fc21a3a94afb58e86f384221e4ccaee66 (diff)
Move QAudioDecoder over to use the new platform infrastructure
And remove the hasSupport() method for now as with QMediaPlayer and QMediaRecorder. Also adjust the auto test to use the new mock infrastructure. Change-Id: I84a8587f273525d1ee1ed26ded6822bb92448e01 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/audio')
-rw-r--r--src/multimedia/audio/qaudiodecoder.cpp39
-rw-r--r--src/multimedia/audio/qaudiodecoder.h2
2 files changed, 2 insertions, 39 deletions
diff --git a/src/multimedia/audio/qaudiodecoder.cpp b/src/multimedia/audio/qaudiodecoder.cpp
index 1e333f132..85fd3a5d0 100644
--- a/src/multimedia/audio/qaudiodecoder.cpp
+++ b/src/multimedia/audio/qaudiodecoder.cpp
@@ -45,12 +45,7 @@
#include "qaudiodecodercontrol.h"
#include <private/qmediaserviceprovider_p.h>
-#if QT_CONFIG(gstreamer)
-#include <private/qgstreameraudiodecodercontrol_p.h>
-#include <private/qgstutils_p.h>
-#elif defined(Q_OS_WIN)
-#include <private/mfaudiodecodercontrol_p.h>
-#endif
+#include <private/qmediaplatformintegration_p.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qmetaobject.h>
@@ -132,12 +127,7 @@ QAudioDecoder::QAudioDecoder(QObject *parent)
{
Q_D(QAudioDecoder);
-#if QT_CONFIG(gstreamer)
- gst_init(nullptr, nullptr);
- d->control = new QGstreamerAudioDecoderControl(this);
-#elif defined(Q_OS_WIN)
- d->control = new MFAudioDecoderControl(this);
-#endif
+ d->control = QMediaPlatformIntegration::instance()->createAudioDecoder();
if (d->control != nullptr) {
connect(d->control, SIGNAL(stateChanged(QAudioDecoder::State)), SLOT(_q_stateChanged(QAudioDecoder::State)));
connect(d->control, SIGNAL(error(int,QString)), SLOT(_q_error(int,QString)));
@@ -329,31 +319,6 @@ void QAudioDecoder::setAudioFormat(const QAudioFormat &format)
}
/*!
- Returns the level of support an audio decoder has for a \a mimeType and a set of \a codecs.
-*/
-QMultimedia::SupportEstimate QAudioDecoder::hasSupport(const QString &mimeType,
- const QStringList& codecs)
-{
-#if QT_CONFIG(gstreamer)
- // ### this code should not be there
- auto isDecoderOrDemuxer = [](GstElementFactory *factory) -> bool
- {
- return gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DEMUXER)
- || gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DECODER
- | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO);
- };
- gst_init(nullptr, nullptr);
- auto set = QGstUtils::supportedMimeTypes(isDecoderOrDemuxer);
- return QGstUtils::hasSupport(mimeType, codecs, set);
-#elif defined(Q_OS_WIN)
- return QMultimedia::MaybeSupported;
-#endif
- Q_UNUSED(mimeType);
- Q_UNUSED(codecs);
- return QMultimedia::NotSupported;
-}
-
-/*!
Returns true if a buffer is available to be read,
and false otherwise. If there is no buffer available, calling
the \l read() function will return an invalid buffer.
diff --git a/src/multimedia/audio/qaudiodecoder.h b/src/multimedia/audio/qaudiodecoder.h
index 0045f92b7..670af4027 100644
--- a/src/multimedia/audio/qaudiodecoder.h
+++ b/src/multimedia/audio/qaudiodecoder.h
@@ -78,8 +78,6 @@ public:
explicit QAudioDecoder(QObject *parent = nullptr);
~QAudioDecoder();
- static QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs = QStringList());
-
State state() const;
QString sourceFilename() const;