swift
opusdecoder.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_SOUND_CODECS_OPUSDECODER_H
7 #define SWIFT_SOUND_CODECS_OPUSDECODER_H
8 
9 #include <QVector>
10 
11 #include "opus/opus.h"
12 
13 #include "sound/swiftsoundexport.h"
14 
15 namespace swift::sound::codecs
16 {
19  {
20  public:
22  COpusDecoder(int sampleRate, int channels);
23 
25  ~COpusDecoder();
26 
29  COpusDecoder(const COpusDecoder &decoder) = delete;
30  COpusDecoder &operator=(COpusDecoder const &) = delete;
32 
34  int frameCount(int bufferSize);
35 
37  QVector<qint16> decode(const QByteArray &opusData, int dataLength, int *decodedLength);
38 
40  void resetState();
41 
42  private:
43  OpusDecoder *m_opusDecoder = nullptr;
44  int m_channels;
45 
46  static constexpr int MaxDataBytes = 4000;
47  };
48 } // namespace swift::sound::codecs
49 
50 #endif // SWIFT_SOUND_CODECS_OPUSDECODER_H
COpusDecoder & operator=(COpusDecoder const &)=delete
Not copyable and assignable.
COpusDecoder(const COpusDecoder &decoder)=delete
Not copyable and assignable.
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.