代码拉取完成,页面将自动刷新
#pragma once
#include <speex/speex.h>
class SpeexDecoder : public AudioDecoder {
i16 *audioOutput;
void *speexState;
SpeexBits speexBits;
public:
SpeexDecoder():AudioDecoder(){
audioOutput = (i16 *)malloc(640);
auto mode = speex_lib_get_mode(SPEEX_MODEID_WB);
speexState = speex_decoder_init(mode);
speex_bits_init(&speexBits);
emscripten_log(0, "speex init!");
}
virtual ~SpeexDecoder(){
speex_decoder_destroy(speexState);
speex_bits_destroy(&speexBits);
free(audioOutput);
}
int _decode(IOBuffer &input) override
{
u8 *output = outputBuffer + bufferFilled;
if (input.length <= 11)
{
memset(output, 0, 640);
}
else
{
speex_bits_read_from(&speexBits, (const char *)input, 52);
speex_decode_int(speexState, &speexBits, audioOutput);
memcpy(output, audioOutput, 640);
}
return 640;
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。