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
mfaudiodecodercontrol_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 MFAUDIODECODERCONTROL_H
5#define MFAUDIODECODERCONTROL_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
19#include <private/qplatformaudiodecoder_p.h>
20#include <sourceresolver_p.h>
21#include <private/qcomptr_p.h>
22#include <private/qwindowsresampler_p.h>
23
25
27{
29public:
31 ~MFAudioDecoderControl() override;
32
33 QUrl source() const override { return m_source; }
34 void setSource(const QUrl &fileName) override;
35
36 QIODevice* sourceDevice() const override { return m_device; }
37 void setSourceDevice(QIODevice *device) override;
38
39 void start() override;
40 void stop() override;
41
42 QAudioFormat audioFormat() const override { return m_outputFormat; }
43 void setAudioFormat(const QAudioFormat &format) override;
44
45 QAudioBuffer read() override;
46 bool bufferAvailable() const override { return m_audioBuffer.sampleCount() > 0; }
47
48 qint64 position() const override { return m_position; }
49 qint64 duration() const override { return m_duration; }
50
51private Q_SLOTS:
52 void handleMediaSourceReady();
53 void handleMediaSourceError(long hr);
54 void handleNewSample(ComPtr<IMFSample>);
55 void handleSourceFinished();
56
57private:
58 void startReadingSource(IMFMediaSource *source);
59
60 ComPtr<MFDecoderSourceReader> m_decoderSourceReader;
61 SourceResolver *m_sourceResolver;
62 QWindowsResampler m_resampler;
63 QUrl m_source;
64 QIODevice *m_device = nullptr;
65 QAudioFormat m_outputFormat;
66 QAudioBuffer m_audioBuffer;
67 qint64 m_duration = -1;
68 qint64 m_position = -1;
69 bool m_loadingSource = false;
70 bool m_deferredStart = false;
71};
72
74
75#endif//MFAUDIODECODERCONTROL_H
IOBluetoothDevice * device
qint64 duration() const override
void setAudioFormat(const QAudioFormat &format) override
bool bufferAvailable() const override
QUrl source() const override
MFAudioDecoderControl(QAudioDecoder *parent)
void setSourceDevice(QIODevice *device) override
QAudioFormat audioFormat() const override
QAudioBuffer read() override
void setSource(const QUrl &fileName) override
qint64 position() const override
QIODevice * sourceDevice() const override
\inmodule QtMultimedia
qsizetype sampleCount() const noexcept
Returns the number of samples in this buffer.
The QAudioDecoder class implements decoding audio.
The QAudioFormat class stores audio stream parameter information.
\inmodule QtCore \reentrant
Definition qiodevice.h:34
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
#define Q_OBJECT
#define Q_SLOTS
long long qint64
Definition qtypes.h:60