-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvoicecodec_celt.h
54 lines (41 loc) · 1.77 KB
/
voicecodec_celt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include "ivoicecodec.h"
#include "celt_header.h"
class VoiceCodec_Celt : public IVoiceCodec
{
public:
VoiceCodec_Celt();
~VoiceCodec_Celt();
virtual bool Init( int quality ) override;
bool Init(celt_int32 SampleRate_Hz, celt_int32 FrameSize, celt_int32 PacketSize);
// Use this to delete the object.
virtual void Release() override;
// Compress the voice data.
// pUncompressed - 16-bit signed mono voice data.
// maxCompressedBytes - The length of the pCompressed buffer. Don't exceed this.
// bFinal - Set to true on the last call to Compress (the user stopped talking).
// Some codecs like big block sizes and will hang onto data you give them in Compress calls.
// When you call with bFinal, the codec will give you compressed data no matter what.
// Return the number of bytes you filled into pCompressed.
virtual int Compress(const char *pUncompressed, int nSamples, char *pCompressed, int maxCompressedBytes, bool bFinal) override;
// Decompress voice data. pUncompressed is 16-bit signed mono.
virtual int Decompress(const char *pCompressed, int compressedBytes, char *pUncompressed, int maxUncompressedBytes) override;
// Some codecs maintain state between Compress and Decompress calls. This should clear that state.
virtual bool ResetState() override;
struct CEncoderSettings
{
celt_int32 SampleRate_Hz;
celt_int32 TargetBitRate_Kbps;
celt_int32 FrameSize;
celt_int32 PacketSize;
celt_int32 Complexity;
double FrameTime;
};
static void InitGlobalSettings();
static const CEncoderSettings &TheEncoderSettings();
int Compress(celt_int16 *pUncompressed, int nSamples, unsigned char *pCompressed, int maxCompressedBytes);
private:
CELTMode *m_pMode;
CELTEncoder *m_pCodec;
CEncoderSettings m_EncoderSettings;
};