AFV initial commit

This commit is contained in:
Roland Rossgotterer
2019-09-14 21:18:26 +02:00
committed by Mat Sutcliffe
parent 7030302e73
commit b5a2f2ad13
100 changed files with 6821 additions and 25 deletions

View 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