本文整理汇总了C++中opus_encoder_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ opus_encoder_destroy函数的具体用法?C++ opus_encoder_destroy怎么用?C++ opus_encoder_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了opus_encoder_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: reconfigure_audio_encoder
bool reconfigure_audio_encoder(Logger *log, OpusEncoder **e, int32_t new_br, int32_t new_sr, uint8_t new_ch,
int32_t *old_br, int32_t *old_sr, int32_t *old_ch)
{
/* Values are checked in toxav.c */
if (*old_sr != new_sr || *old_ch != new_ch) {
OpusEncoder *new_encoder = create_audio_encoder(log, new_br, new_sr, new_ch);
if (new_encoder == NULL) {
return false;
}
opus_encoder_destroy(*e);
*e = new_encoder;
} else if (*old_br == new_br) {
return true; /* Nothing changed */
}
int status = opus_encoder_ctl(*e, OPUS_SET_BITRATE(new_br));
if (status != OPUS_OK) {
LOGGER_ERROR(log, "Error while setting encoder ctl: %s", opus_strerror(status));
return false;
}
*old_br = new_br;
*old_sr = new_sr;
*old_ch = new_ch;
LOGGER_DEBUG(log, "Reconfigured audio encoder br: %d sr: %d cc:%d", new_br, new_sr, new_ch);
return true;
}
开发者ID:GrayHatter,项目名称:toxcore,代码行数:31,代码来源:audio.c
示例2: cs_kill
void cs_kill(CSSession *cs)
{
if (!cs) return;
/* queue_message will not be called since it's unregistered before cs_kill is called */
pthread_mutex_destroy(cs->queue_mutex);
if ( cs->audio_encoder )
opus_encoder_destroy(cs->audio_encoder);
if ( cs->audio_decoder )
opus_decoder_destroy(cs->audio_decoder);
if ( cs->capabilities & cs_VideoDecoding )
vpx_codec_destroy(&cs->v_decoder);
if ( cs->capabilities & cs_VideoEncoding )
vpx_codec_destroy(&cs->v_encoder);
jbuf_free(cs->j_buf);
buffer_free(cs->vbuf_raw);
free(cs->frame_buf);
LOGGER_DEBUG("Terminated codec state: %p", cs);
free(cs);
}
开发者ID:ittner,项目名称:toxcore,代码行数:27,代码来源:codec.c
示例3: wait
AudioInput::~AudioInput() {
bRunning = false;
wait();
#ifdef USE_OPUS
if (opusState)
opus_encoder_destroy(opusState);
#endif
if (ceEncoder) {
cCodec->celt_encoder_destroy(ceEncoder);
}
foreach(short *buf, qlEchoFrames)
delete [] buf;
if (sppPreprocess)
speex_preprocess_state_destroy(sppPreprocess);
if (sesEcho)
speex_echo_state_destroy(sesEcho);
if (srsMic)
speex_resampler_destroy(srsMic);
if (srsEcho)
speex_resampler_destroy(srsEcho);
delete [] psMic;
delete [] psClean;
delete [] psSpeaker;
delete [] pfMicInput;
delete [] pfEchoInput;
delete [] pfOutput;
}
开发者ID:AceXare,项目名称:mumble,代码行数:34,代码来源:AudioInput.cpp
示例4: opus_create
long opus_create(const char* format_parameters, const char** format_parameters_out,
amci_codec_fmt_info_t** format_description) {
opus_state_t* codec_inst;
int error;
unsigned int maxbandwidth = _OPUS_RATE;
int useinbandfec = _OPUS_INBAND_FEC_;
int stereo = 0;
if (format_parameters) {
DBG("OPUS params: >>%s<<.\n", format_parameters);
decode_format_parameters(format_parameters, &maxbandwidth, &useinbandfec, &stereo);
}
codec_inst = (opus_state_t*)malloc(sizeof(opus_state_t));
if (!codec_inst)
return -1;
DBG("OPUS: creating encoder with maxbandwidth=%u, stereo=%s, useinbandfec=%s\n",
maxbandwidth, stereo?"true":"false", useinbandfec?"true":"false");
codec_inst->opus_enc = opus_encoder_create(_OPUS_RATE,1,_OPUS_APPLICATION_,&error);
if (error) {
DBG("OPUS: error %d while creating encoder state.\n", error);
return -1;
}
opus_encoder_ctl(codec_inst->opus_enc, OPUS_SET_FORCE_CHANNELS(stereo ? 2:1));
unsigned int opus_set_bw = _OPUS_RATE;
if (maxbandwidth <= 8000) {
opus_set_bw = OPUS_BANDWIDTH_NARROWBAND;
} else if (maxbandwidth <= 12000) {
opus_set_bw = OPUS_BANDWIDTH_MEDIUMBAND;
} else if (maxbandwidth <= 16000) {
opus_set_bw = OPUS_BANDWIDTH_WIDEBAND;
} else if (maxbandwidth <= 24000) {
opus_set_bw = OPUS_BANDWIDTH_SUPERWIDEBAND;
} else {
opus_set_bw = OPUS_BANDWIDTH_FULLBAND;
}
opus_encoder_ctl(codec_inst->opus_enc, OPUS_SET_MAX_BANDWIDTH(opus_set_bw));
opus_encoder_ctl(codec_inst->opus_enc, OPUS_SET_PACKET_LOSS_PERC(_OPUS_PKT_LOSS_PCT_));
opus_encoder_ctl(codec_inst->opus_enc, OPUS_SET_COMPLEXITY(_OPUS_COMPLEXITY_));
opus_encoder_ctl(codec_inst->opus_enc, OPUS_SET_INBAND_FEC(useinbandfec ? 1:0));
opus_encoder_ctl(codec_inst->opus_enc, OPUS_SET_DTX(_OPUS_DTX_));
codec_inst->opus_dec = opus_decoder_create(_OPUS_RATE,1,&error);
if (error) {
DBG("OPUS: error %d while creating decoder state.\n", error);
opus_encoder_destroy(codec_inst->opus_enc);
return -1;
}
*format_description = opus_fmt_description;
return (long)codec_inst;
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:60,代码来源:opus.c
示例5: destructor
static void destructor(void *arg)
{
struct auenc_state *aes = arg;
if (aes->enc)
opus_encoder_destroy(aes->enc);
}
开发者ID:lmangani,项目名称:baresip,代码行数:7,代码来源:encode.c
示例6: opus_encoder_destroy
Opus::~Opus()
{
if (encoder_)
opus_encoder_destroy(encoder_);
if (decoder_)
opus_decoder_destroy(decoder_);
}
开发者ID:ThereIsNoYeti,项目名称:sflphone,代码行数:7,代码来源:opuscodec.cpp
示例7: while
void Opus::setOptimalFormat(uint32_t sample_rate, uint8_t channels)
{
// Use a SR higher or equal to sample_rate.
// Typical case: 44.1kHz => 48kHz.
unsigned i = 0;
while (i < VALID_SAMPLING_RATE_NUM - 1 and VALID_SAMPLING_RATE[i] < sample_rate)
i++;
sample_rate = VALID_SAMPLING_RATE[i];
// Opus supports 1 or 2 channels.
channels = std::max(std::min(channels, (uint8_t) 2), (uint8_t) 1);
if (not (!encoder_ || !decoder_ || sample_rate != clockRateCur_ || channels != channelsCur_))
return;
clockRateCur_ = sample_rate;
channelsCur_ = channels;
int err;
if (encoder_)
opus_encoder_destroy(encoder_);
encoder_ = opus_encoder_create(sample_rate, channels, OPUS_APPLICATION_VOIP, &err);
if (err)
throw std::runtime_error("opus: could not create encoder");
if (decoder_)
opus_decoder_destroy(decoder_);
lastDecodedFrameSize_ = 0;
decoder_ = opus_decoder_create(sample_rate, channels, &err);
if (err)
throw std::runtime_error("opus: could not create decoder");
}
开发者ID:ThereIsNoYeti,项目名称:sflphone,代码行数:32,代码来源:opuscodec.cpp
示例8: cleanupRecorder
void cleanupRecorder() {
if (_encoder) {
opus_encoder_destroy(_encoder);
_encoder = 0;
}
ogg_stream_clear(&os);
if (_packet) {
free(_packet);
_packet = 0;
}
if (_fileOs) {
fclose(_fileOs);
_fileOs = 0;
}
_packetId = -1;
bytes_written = 0;
pages_out = 0;
total_samples = 0;
enc_granulepos = 0;
size_segments = 0;
last_segments = 0;
last_granulepos = 0;
memset(&os, 0, sizeof(ogg_stream_state));
memset(&inopt, 0, sizeof(oe_enc_opt));
memset(&header, 0, sizeof(OpusHeader));
memset(&op, 0, sizeof(ogg_packet));
memset(&og, 0, sizeof(ogg_page));
}
开发者ID:actorapp,项目名称:droidkit-opus,代码行数:32,代码来源:audio.c
示例9: audio_encoder_terminate
static void audio_encoder_terminate()
{
if (opus_enc) {
opus_encoder_destroy(opus_enc);
opus_enc = NULL;
}
}
开发者ID:KJYoo1989,项目名称:Ubercaster,代码行数:7,代码来源:sender.c
示例10: Destroy
void Destroy(OpusEncoder* Encoder) const
{
#if USE_UE4_MEM_ALLOC
FMemory::Free(Encoder);
#else
opus_encoder_destroy(Encoder);
#endif
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:8,代码来源:AudioFormatOpus.cpp
示例11: kill_group_av
static void kill_group_av(Group_AV *group_av)
{
if (group_av->audio_encoder) {
opus_encoder_destroy(group_av->audio_encoder);
}
free(group_av);
}
开发者ID:Ansa89,项目名称:toxcore,代码行数:8,代码来源:group.c
示例12: PLG_FREE_V1
CODEC_API int PLG_FREE_V1(opus_48000)(void* opaqueCodecContext, int isDecoder)
{
int status = RPLG_INVALID_ARGUMENT;
assert(opaqueCodecContext);
if(opaqueCodecContext)
{
struct MpCodecOpusCodecState* codecContext = (struct MpCodecOpusCodecState*) opaqueCodecContext;
if(isDecoder)
{
assert(codecContext->mCodecType == CODEC_DECODE);
assert(codecContext->mpDecoderContext);
if(codecContext->mpDecoderContext)
{
opus_encoder_destroy(codecContext->mpDecoderContext);
status = RPLG_BAD_HANDLE;
codecContext->mpDecoderContext = NULL;
}
else
{
status = RPLG_BAD_HANDLE;
}
}
else
{
assert(codecContext->mCodecType == CODEC_ENCODE);
assert(codecContext->mpEncoderContext);
if(codecContext->mpEncoderContext)
{
opus_decoder_destroy(codecContext->mpEncoderContext);
status = RPLG_BAD_HANDLE;
codecContext->mpEncoderContext = NULL;
}
else
{
status = RPLG_BAD_HANDLE;
}
}
if(codecContext->mFmtp)
{
free(codecContext->mFmtp);
codecContext->mFmtp = NULL;
}
free(codecContext);
codecContext = NULL;
opaqueCodecContext = NULL;
}
return(status);
}
开发者ID:xaccc,项目名称:sipXtapi,代码行数:58,代码来源:plgopus.c
示例13: opus_encoder_destroy
void FVoiceEncoderOpus::Destroy()
{
#if USE_UE4_MEM_ALLOC
FMemory::Free(Encoder);
#else
opus_encoder_destroy(Encoder);
#endif
Encoder = NULL;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:9,代码来源:VoiceCodecOpus.cpp
示例14: opus_encoder_destroy
OpusTrackEncoder::~OpusTrackEncoder()
{
if (mEncoder) {
opus_encoder_destroy(mEncoder);
}
if (mResampler) {
speex_resampler_destroy(mResampler);
mResampler = nullptr;
}
}
开发者ID:froydnj,项目名称:gecko-dev,代码行数:10,代码来源:OpusTrackEncoder.cpp
示例15: opus_destroy
void opus_destroy(long h_inst) {
opus_state_t* codec_inst;
if (h_inst) {
codec_inst = (opus_state_t*)h_inst;
opus_encoder_destroy(codec_inst->opus_enc);
opus_decoder_destroy(codec_inst->opus_dec);
free(codec_inst);
}
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:10,代码来源:opus.c
示例16: destructor
static void destructor(void *arg)
{
struct aucodec_st *st = arg;
if (st->enc)
opus_encoder_destroy(st->enc);
if (st->dec)
opus_decoder_destroy(st->dec);
mem_deref(st->ac);
}
开发者ID:FihlaTV,项目名称:BareSip-Android,代码行数:11,代码来源:opus.c
示例17: ms_opus_enc_uninit
static void ms_opus_enc_uninit(MSFilter *f) {
OpusEncData *d = (OpusEncData *)f->data;
if (d == NULL) return;
if (d->state) {
opus_encoder_destroy(d->state);
d->state = NULL;
}
ms_bufferizer_destroy(d->bufferizer);
d->bufferizer = NULL;
ms_free(d);
}
开发者ID:xiaolds,项目名称:VideoCallVoIP,代码行数:11,代码来源:msopus.c
示例18: sm_destroy
OpusSM* sm_destroy(OpusSM* sm) {
if (sm == NULL) {
return NULL;
}
if (sm->opus_enc != NULL) {
opus_encoder_destroy(sm->opus_enc);
}
free(sm);
sm = NULL;
return sm;
}
开发者ID:jzombi,项目名称:opus_sm,代码行数:13,代码来源:opus_sm.c
示例19: ac_kill
void ac_kill(ACSession *ac)
{
if (!ac)
return;
opus_encoder_destroy(ac->encoder);
opus_decoder_destroy(ac->decoder);
jbuf_free(ac->j_buf);
pthread_mutex_destroy(ac->queue_mutex);
LOGGER_DEBUG("Terminated audio handler: %p", ac);
free(ac);
}
开发者ID:Ansa89,项目名称:toxcore,代码行数:14,代码来源:audio.c
示例20: opus_encoder_create
OpusEncoder *create_audio_encoder(Logger *log, int32_t bit_rate, int32_t sampling_rate, int32_t channel_count)
{
int status = OPUS_OK;
OpusEncoder *rc = opus_encoder_create(sampling_rate, channel_count, OPUS_APPLICATION_VOIP, &status);
if (status != OPUS_OK) {
LOGGER_ERROR(log, "Error while starting audio encoder: %s", opus_strerror(status));
return NULL;
}
status = opus_encoder_ctl(rc, OPUS_SET_BITRATE(bit_rate));
if (status != OPUS_OK) {
LOGGER_ERROR(log, "Error while setting encoder ctl: %s", opus_strerror(status));
goto FAILURE;
}
/* Enable in-band forward error correction in codec */
status = opus_encoder_ctl(rc, OPUS_SET_INBAND_FEC(1));
if (status != OPUS_OK) {
LOGGER_ERROR(log, "Error while setting encoder ctl: %s", opus_strerror(status));
goto FAILURE;
}
/* Make codec resistant to up to 10% packet loss
* NOTE This could also be adjusted on the fly, rather than hard-coded,
* with feedback from the receiving client.
*/
status = opus_encoder_ctl(rc, OPUS_SET_PACKET_LOSS_PERC(10));
if (status != OPUS_OK) {
LOGGER_ERROR(log, "Error while setting encoder ctl: %s", opus_strerror(status));
goto FAILURE;
}
/* Set algorithm to the highest complexity, maximizing compression */
status = opus_encoder_ctl(rc, OPUS_SET_COMPLEXITY(10));
if (status != OPUS_OK) {
LOGGER_ERROR(log, "Error while setting encoder ctl: %s", opus_strerror(status));
goto FAILURE;
}
return rc;
FAILURE:
opus_encoder_destroy(rc);
return NULL;
}
开发者ID:GrayHatter,项目名称:toxcore,代码行数:50,代码来源:audio.c
注:本文中的opus_encoder_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论