Overte C++ Documentation
OpusEncoder.h
1 //
2 // OpusCodecManager.h
3 // plugins/opusCodec/src
4 //
5 // Copyright 2020 Dale Glass
6 //
7 // Distributed under the Apache License, Version 2.0.
8 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
9 //
10 
11 #ifndef OPUSENCODER_H
12 #define OPUSENCODER_H
13 #include <plugins/CodecPlugin.h>
14 #include <opus/opus.h>
15 
16 
17 class AthenaOpusEncoder : public Encoder {
18 public:
19 
20  AthenaOpusEncoder(int sampleRate, int numChannels);
21  ~AthenaOpusEncoder() override;
22 
23  virtual void encode(const QByteArray& decodedBuffer, QByteArray& encodedBuffer) override;
24 
25 
26  int getComplexity() const;
27  void setComplexity(int complexity);
28 
29  int getBitrate() const;
30  void setBitrate(int bitrate);
31 
32  int getVBR() const;
33  void setVBR(int vbr);
34 
35  int getVBRConstraint() const;
36  void setVBRConstraint(int vbrConstraint);
37 
38  int getMaxBandwidth() const;
39  void setMaxBandwidth(int maxBandwidth);
40 
41  int getBandwidth() const;
42  void setBandwidth(int bandwidth);
43 
44  int getSignal() const;
45  void setSignal(int signal);
46 
47  int getApplication() const;
48  void setApplication(int application);
49 
50  int getLookahead() const;
51 
52  int getInbandFEC() const;
53  void setInbandFEC(int inBandFEC);
54 
55  int getExpectedPacketLossPercentage() const;
56  void setExpectedPacketLossPercentage(int percentage);
57 
58  int getDTX() const;
59  void setDTX(int dtx);
60 
61 
62 private:
63 
64  const int DEFAULT_BITRATE = 128000;
65  const int DEFAULT_COMPLEXITY = 10;
66  const int DEFAULT_APPLICATION = OPUS_APPLICATION_VOIP;
67  const int DEFAULT_SIGNAL = OPUS_AUTO;
68 
69  int _opusSampleRate = 0;
70  int _opusChannels = 0;
71  int _opusExpectedLoss = 0;
72 
73 
74  OpusEncoder* _encoder = nullptr;
75 };
76 
77 
78 #endif // OPUSENCODER_H