1// Copyright (C) 2024 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 QFFMPEGAVAUDIOFORMAT_P_H
5#define QFFMPEGAVAUDIOFORMAT_P_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
18#include <QtFFmpegMediaPluginImpl/private/qffmpegdefs_p.h>
19#include <QtMultimedia/private/qtmultimediaglobal_p.h>
20
21#if QT_FFMPEG_HAS_AV_CHANNEL_LAYOUT
22[[maybe_unused]] static inline bool operator==(const AVChannelLayout &lhs,
23 const AVChannelLayout &rhs)
24{
25 return lhs.order == rhs.order && lhs.nb_channels == rhs.nb_channels && lhs.u.mask == rhs.u.mask;
26}
27
28[[maybe_unused]] static inline bool operator!=(const AVChannelLayout &lhs,
29 const AVChannelLayout &rhs)
30{
31 return !(lhs == rhs);
32}
33
34#endif
35
36QT_BEGIN_NAMESPACE
37
38class QAudioFormat;
39
40namespace QFFmpeg {
41
42struct AVAudioFormat
43{
44 AVAudioFormat(const AVCodecContext *context);
45
46 AVAudioFormat(const AVCodecParameters *codecPar);
47
48 AVAudioFormat(const QAudioFormat &audioFormat);
49
50#if QT_FFMPEG_HAS_AV_CHANNEL_LAYOUT
51 AVChannelLayout channelLayout;
52#else
53 uint64_t channelLayoutMask;
54#endif
55 AVSampleFormat sampleFormat;
56 int sampleRate;
57};
58
59bool operator==(const AVAudioFormat &lhs, const AVAudioFormat &rhs);
60
61inline bool operator!=(const AVAudioFormat &lhs, const AVAudioFormat &rhs)
62{
63 return !(lhs == rhs);
64}
65
66QDebug operator<<(QDebug, const AVAudioFormat &);
67
68} // namespace QFFmpeg
69
70QT_END_NAMESPACE
71
72#endif // QFFMPEGAVAUDIOFORMAT_P_H
73

source code of qtmultimedia/src/plugins/multimedia/ffmpeg/qffmpegavaudioformat_p.h