| 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 | #ifndef QFFMPEGAUDIOFRAMECONVERTER_P_H |
| 4 | #define QFFMPEGAUDIOFRAMECONVERTER_P_H |
| 5 | |
| 6 | // |
| 7 | // W A R N I N G |
| 8 | // ------------- |
| 9 | // |
| 10 | // This file is not part of the Qt API. It exists purely as an |
| 11 | // implementation detail. This header file may change from version to |
| 12 | // version without notice, or even be removed. |
| 13 | // |
| 14 | // We mean it. |
| 15 | // |
| 16 | |
| 17 | #include <QtMultimedia/qaudiobuffer.h> |
| 18 | |
| 19 | extern "C" { |
| 20 | #include <libavutil/frame.h> |
| 21 | } |
| 22 | |
| 23 | #include <memory> |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QFFmpegResampler; |
| 28 | |
| 29 | namespace QFFmpeg { |
| 30 | |
| 31 | struct AbstractAudioFrameConverter |
| 32 | { |
| 33 | virtual ~AbstractAudioFrameConverter(); |
| 34 | virtual QAudioBuffer convert(AVFrame *) = 0; |
| 35 | }; |
| 36 | |
| 37 | struct Frame; |
| 38 | |
| 39 | std::unique_ptr<QFFmpegResampler> createResampler(const Frame &frame, |
| 40 | const QAudioFormat &outputFormat); |
| 41 | |
| 42 | std::unique_ptr<AbstractAudioFrameConverter> |
| 43 | makeTrivialAudioFrameConverter(const Frame &frame, QAudioFormat outputFormat, float playbackRate); |
| 44 | |
| 45 | std::unique_ptr<AbstractAudioFrameConverter> |
| 46 | makePitchShiftingAudioFrameConverter(const Frame &frame, QAudioFormat outputFormat, |
| 47 | float playbackRate); |
| 48 | |
| 49 | } // namespace QFFmpeg |
| 50 | |
| 51 | QT_END_NAMESPACE |
| 52 | |
| 53 | #endif // QFFMPEGAUDIOFRAMECONVERTER_P_H |
| 54 | |