Showing the changes to plugins/opusCodec/src/OpusCodecManager.cpp (1 of 7 files). Show all
Unified · Split
| @@ -22,6 +22,9 @@ · 21 unmodified lines | |||
| 22 | #include <opus/opus_multistream.h> | 22 | #include <opus/opus_multistream.h> |
| 23 | #include <opus/opus_projection.h> | 23 | #include <opus/opus_projection.h> |
| 24 | 24 | ||
| 25 | #include "OpusEncoder.h" | ||
| 26 | #include "OpusDecoder.h" | ||
| 27 | |||
| 25 | #define FRAME_SIZE 960 | 28 | #define FRAME_SIZE 960 |
| 26 | #define SAMPLE_RATE 48000 | 29 | #define SAMPLE_RATE 48000 |
| 27 | #define CHANNELS 2 | 30 | #define CHANNELS 2 |
| @@ -31,56 +34,41 @@ · 3 unmodified lines | |||
| 31 | #define MAX_FRAME_SIZE 6*FRAME_SIZE | 34 | #define MAX_FRAME_SIZE 6*FRAME_SIZE |
| 32 | #define MAX_PACKET_SIZE 3*1276 | 35 | #define MAX_PACKET_SIZE 3*1276 |
| 33 | 36 | ||
| 34 | const char* OpusCodec::NAME { "opus" }; | 37 | const char* AthenaOpusCodec::NAME { "opus" }; |
| 35 | 38 | ||
| 36 | void OpusCodec::init() { | 39 | void AthenaOpusCodec::init() { |
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | void OpusCodec::deinit() { | 42 | void AthenaOpusCodec::deinit() { |
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | bool OpusCodec::activate() { | 45 | bool AthenaOpusCodec::activate() { |
| 43 | CodecPlugin::activate(); | 46 | CodecPlugin::activate(); |
| 44 | return true; | 47 | return true; |
| 45 | } | 48 | } |
| 46 | 49 | ||
| 47 | void OpusCodec::deactivate() { | 50 | void AthenaOpusCodec::deactivate() { |
| 48 | CodecPlugin::deactivate(); | 51 | CodecPlugin::deactivate(); |
| 49 | } | 52 | } |
| 50 | 53 | ||
| 51 | 54 | ||
| 52 | bool OpusCodec::isSupported() const { | 55 | bool AthenaOpusCodec::isSupported() const { |
| 53 | return true; | 56 | return true; |
| 54 | } | 57 | } |
| 55 | 58 | ||
| 56 | 59 | ||
| 57 | class OpusEncoder : public Encoder { | 60 | Encoder* AthenaOpusCodec::createEncoder(int sampleRate, int numChannels) { |
| 58 | public: | 61 | return new AthenaOpusEncoder(sampleRate, numChannels); |
| 59 | OpusEncoder(int sampleRate, int numChannels) { | ||
| 60 | |||
| 61 | } | ||
| 62 | |||
| 63 | virtual void encode(const QByteArray& decodedBuffer, QByteArray& encodedBuffer) override { | ||
| 64 | encodedBuffer.resize(_encodedSize); | ||
| 65 | } | ||
| 66 | |||
| 67 | private: | ||
| 68 | int _encodedSize; | ||
| 69 | }; | ||
| 70 | |||
| 71 | |||
| 72 | Encoder* OpusCodec::createEncoder(int sampleRate, int numChannels) { | ||
| 73 | return new OpusEncoder(sampleRate, numChannels); | ||
| 74 | } | 62 | } |
| 75 | 63 | ||
| 76 | Decoder* OpusCodec::createDecoder(int sampleRate, int numChannels) { | 64 | Decoder* AthenaOpusCodec::createDecoder(int sampleRate, int numChannels) { |
| 77 | return this; | 65 | return new AthenaOpusDecoder(sampleRate, numChannels); |
| 78 | } | 66 | } |
| 79 | 67 | ||
| 80 | void OpusCodec::releaseEncoder(Encoder* encoder) { | 68 | void AthenaOpusCodec::releaseEncoder(Encoder* encoder) { |
| 81 | delete encoder; | 69 | delete encoder; |
| 82 | } | 70 | } |
| 83 | 71 | ||
| 84 | void OpusCodec::releaseDecoder(Decoder* decoder) { | 72 | void AthenaOpusCodec::releaseDecoder(Decoder* decoder) { |
| 85 | delete decoder; | 73 | delete decoder; |
| 86 | } | 74 | } |