swift
opusencoder.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_OPUSENCODER_H
7 #define SWIFT_SOUND_CODECS_OPUSENCODER_H
8 
9 #include <QByteArray>
10 #include <QVector>
11 
12 #include "opus/opus.h"
13 
14 #include "sound/swiftsoundexport.h"
15 
16 namespace swift::sound::codecs
17 {
20  {
21  public:
23  COpusEncoder(int sampleRate, int channels, int application = OPUS_APPLICATION_VOIP);
24 
26  ~COpusEncoder();
27 
29  COpusEncoder(const COpusEncoder &temp_obj) = delete;
30 
32  COpusEncoder &operator=(const COpusEncoder &temp_obj) = delete;
33 
35  void setBitRate(int bitRate);
36 
38  QByteArray encode(const QVector<qint16> &pcmSamples, int samplesLength, int *encodedLength);
39 
40  private:
41  OpusEncoder *opusEncoder = nullptr;
42 
43  static constexpr int maxDataBytes = 4000;
44  };
45 } // namespace swift::sound::codecs
46 
47 #endif // SWIFT_SOUND_CODECS_OPUSENCODER_H
COpusEncoder & operator=(const COpusEncoder &temp_obj)=delete
Non assignable.
COpusEncoder(const COpusEncoder &temp_obj)=delete
Non copyable.
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.