1 Star 0 Fork 0

linshl/jessibuca

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
speex.h 878 Bytes
一键复制 编辑 原始数据 按行查看 历史
langhuihui 提交于 2020-07-24 16:15 . 新增了h265的解码选项
#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;
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/linshl/jessibuca.git
git@gitee.com:linshl/jessibuca.git
linshl
jessibuca
jessibuca
worker

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385