Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwindowsresampler_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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
5#ifndef QT_QWINDOWSRESAMPLER_H
6#define QT_QWINDOWSRESAMPLER_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <qbytearray.h>
20#include <qbytearrayview.h>
21#include <qaudioformat.h>
22#include <private/qcomptr_p.h>
23#include <qt_windows.h>
24#include <mftransform.h>
25
26struct IMFSample;
27struct IMFTransform;
28
30
32
33class Q_MULTIMEDIA_EXPORT QWindowsResampler
34{
35public:
38
39 bool setup(const QAudioFormat &in, const QAudioFormat &out);
40
41 QByteArray resample(const QByteArrayView &in);
42 QByteArray resample(IMFSample *sample);
43
44 QAudioFormat inputFormat() const { return m_inputFormat; }
45 QAudioFormat outputFormat() const { return m_outputFormat; }
46
47 quint64 outputBufferSize(quint64 inputBufferSize) const;
48 quint64 inputBufferSize(quint64 outputBufferSize) const;
49
50 quint64 totalInputBytes() const { return m_totalInputBytes; }
51 quint64 totalOutputBytes() const { return m_totalOutputBytes; }
52
53private:
54 HRESULT processInput(const QByteArrayView &in);
55 HRESULT processOutput(QByteArray &out);
56
57 ComPtr<IMFTransform> m_resampler;
58 QWindowsMediaFoundation *m_wmf = nullptr;
59
60 bool m_resamplerNeedsSampleBuffer = false;
61 quint64 m_totalInputBytes = 0;
62 quint64 m_totalOutputBytes = 0;
63 QAudioFormat m_inputFormat;
64 QAudioFormat m_outputFormat;
65
66 DWORD m_inputStreamID = 0;
67};
68
70
71#endif // QT_QWINDOWSRESAMPLER_H
The QAudioFormat class stores audio stream parameter information.
\inmodule QtCore
Definition qbytearray.h:57
quint64 totalInputBytes() const
QAudioFormat inputFormat() const
quint64 totalOutputBytes() const
QAudioFormat outputFormat() const
Combined button and popup list for selecting options.
GLuint in
unsigned long long quint64
Definition qtypes.h:56
long HRESULT
QTextStream out(stdout)
[7]