mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
AFV initial commit
This commit is contained in:
committed by
Mat Sutcliffe
parent
7030302e73
commit
b5a2f2ad13
34
src/blacksound/codecs/opusencoder.h
Normal file
34
src/blacksound/codecs/opusencoder.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef OPUSENCODER_H
|
||||
#define OPUSENCODER_H
|
||||
|
||||
#include "blacksound/blacksoundexport.h"
|
||||
#include "opus/opus.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QVector>
|
||||
|
||||
class BLACKSOUND_EXPORT COpusEncoder
|
||||
{
|
||||
public:
|
||||
COpusEncoder(int sampleRate, int channels, int application = OPUS_APPLICATION_VOIP);
|
||||
~COpusEncoder();
|
||||
|
||||
void setBitRate(int bitRate);
|
||||
|
||||
//! \param frameCount Number of audio samples per frame
|
||||
//! \returns the size of an audio frame in bytes
|
||||
int frameByteCount(int frameCount);
|
||||
|
||||
int frameCount(const QVector<qint16> pcmSamples);
|
||||
|
||||
QByteArray encode(const QVector<qint16> pcmSamples, int samplesLength, int *encodedLength);
|
||||
|
||||
private:
|
||||
OpusEncoder *opusEncoder;
|
||||
int m_sampleRate;
|
||||
int m_channels;
|
||||
|
||||
static constexpr int maxDataBytes = 4000;
|
||||
};
|
||||
|
||||
#endif // OPUSENCODER_H
|
||||
Reference in New Issue
Block a user