本文整理汇总了C++中speex_bits_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ speex_bits_destroy函数的具体用法?C++ speex_bits_destroy怎么用?C++ speex_bits_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了speex_bits_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch_speex_destroy
static switch_status_t switch_speex_destroy(switch_codec_t *codec)
{
int encoding, decoding;
struct speex_context *context = codec->private_info;
if (!context) {
return SWITCH_STATUS_FALSE;
}
encoding = (codec->flags & SWITCH_CODEC_FLAG_ENCODE);
decoding = (codec->flags & SWITCH_CODEC_FLAG_DECODE);
if (encoding) {
speex_bits_destroy(&context->encoder_bits);
speex_encoder_destroy(context->encoder_state);
}
if (decoding) {
speex_bits_destroy(&context->decoder_bits);
speex_decoder_destroy(context->decoder_state);
}
codec->private_info = NULL;
return SWITCH_STATUS_SUCCESS;
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:26,代码来源:mod_speex.c
示例2: voice_close
void voice_close()
{
if (voice_fd != -1) {
close(voice_fd);
voice_fd = -1;
}
#if HAVE_GSM
if (voice_gsm_dec) {
gsm_destroy(voice_gsm_dec);
voice_gsm_dec = NULL;
}
if (voice_gsm_enc) {
gsm_destroy(voice_gsm_enc);
voice_gsm_enc = NULL;
}
#endif
#if HAVE_SPEEX
if (voice_speex_enc) {
speex_encoder_destroy(voice_speex_enc);
voice_speex_enc = NULL;
speex_bits_destroy(&speex_enc_bits);
}
if (voice_speex_dec) {
speex_decoder_destroy(voice_speex_dec);
voice_speex_dec = NULL;
speex_bits_destroy(&speex_dec_bits);
}
#endif
}
开发者ID:canthar,项目名称:libgadu,代码行数:33,代码来源:voice7.c
示例3: tdav_codec_speex_deinit
int tdav_codec_speex_deinit(tdav_codec_speex_t* self)
{
if(self){
if(self->decoder.state){
speex_decoder_destroy(self->decoder.state);
self->decoder.state = tsk_null;
}
speex_bits_destroy(&self->decoder.bits);
if(self->decoder.buffer){
TSK_FREE(self->decoder.buffer);
self->decoder.size = 0;
}
if(self->encoder.state){
speex_encoder_destroy(self->encoder.state);
self->encoder.state = tsk_null;
}
speex_bits_destroy(&self->encoder.bits);
self->encoder.size = 0;
return 0;
}
else{
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
}
开发者ID:SayCV,项目名称:doubango,代码行数:27,代码来源:tdav_codec_speex.c
示例4: Java_com_mogujie_tt_support_audio_Speex_close
extern "C" JNIEXPORT void JNICALL Java_com_mogujie_tt_support_audio_Speex_close(
JNIEnv *env, jobject obj) {
if (--codec_open != 0)
return;
speex_bits_destroy(&ebits);
speex_bits_destroy(&dbits);
speex_decoder_destroy(dec_state);
speex_encoder_destroy(enc_state);
}
开发者ID:10045125,项目名称:TTAndroidClient,代码行数:11,代码来源:speex_jni.cpp
示例5: Java_com_haitou_xiaoyoupai_imservice_support_audio_Speex_close
extern "C" JNIEXPORT void JNICALL Java_com_haitou_xiaoyoupai_imservice_support_audio_Speex_close(
JNIEnv *env, jobject obj) {
if (--codec_open != 0)
return;
speex_bits_destroy(&ebits);
speex_bits_destroy(&dbits);
speex_decoder_destroy(dec_state);
speex_encoder_destroy(enc_state);
}
开发者ID:treejames,项目名称:FreshMAn-Task,代码行数:11,代码来源:speex_jni.cpp
示例6: speex_bits_destroy
JNIEXPORT void JNICALL Java_com_speex_encode_Speex_close
(JNIEnv *env, jobject obj) {
if (--codec_open != 0)
return;
speex_bits_destroy(&ebits);
speex_bits_destroy(&dbits);
speex_decoder_destroy(dec_state);
speex_encoder_destroy(enc_state);
}
开发者ID:xuechinahb,项目名称:langs,代码行数:11,代码来源:speex_jni.cpp
示例7: qSpeexDestroyHandle
void qSpeexDestroyHandle(QSpeexCodecPtr handle)
{
if (!handle) return;
speex_encoder_destroy(handle->encState);
speex_decoder_destroy(handle->decState);
speex_bits_destroy(&handle->encBits);
speex_bits_destroy(&handle->decBits);
speex_jitter_destroy(&handle->jitter);
free(handle);
}
开发者ID:JupiterSmalltalk,项目名称:openqwaq,代码行数:14,代码来源:qAudioSpeex.c
示例8: wait
AudioInput::~AudioInput() {
bRunning = false;
wait();
speex_bits_destroy(&sbBits);
speex_encoder_destroy(esEncState);
mumble_drft_clear(&fftTable);
jitter_buffer_destroy(jb);
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 [] psSpeaker;
delete [] psClean;
if (pfMicInput)
delete [] pfMicInput;
if (pfEchoInput)
delete [] pfEchoInput;
if (pfOutput)
delete [] pfOutput;
}
开发者ID:ArminW,项目名称:re-whisper,代码行数:29,代码来源:AudioInput.cpp
示例9: main
int main(int argc, char **argv)
{
char *outFile;
FILE *fout;
/*Holds the audio that will be written to file (16 bits per sample)*/
short out[FRAME_SIZE];
/*Speex handle samples as float, so we need an array of floats*/
float output[FRAME_SIZE];
char cbits[200];
int nbBytes;
/*Holds the state of the decoder*/
void *state;
/*Holds bits so they can be read and written to by the Speex routines*/
SpeexBits bits;
int i, tmp;
/*Create a new decoder state in narrowband mode*/
state = speex_decoder_init(&speex_nb_mode);
/*Set the perceptual enhancement on*/
tmp=1;
speex_decoder_ctl(state, SPEEX_SET_ENH, &tmp);
outFile = argv[1];
fout = fopen(outFile, "w");
/*Initialization of the structure that holds the bits*/
speex_bits_init(&bits);
while (1)
{
/*Read the size encoded by sampleenc, this part will likely be
different in your application*/
fread(&nbBytes, sizeof(int), 1, stdin);
fprintf (stderr, "nbBytes: %d\n", nbBytes);
if (feof(stdin))
break;
/*Read the "packet" encoded by sampleenc*/
fread(cbits, 1, nbBytes, stdin);
/*Copy the data into the bit-stream struct*/
speex_bits_read_from(&bits, cbits, nbBytes);
/*Decode the data*/
speex_decode(state, &bits, output);
/*Copy from float to short (16 bits) for output*/
for (i=0;i<FRAME_SIZE;i++)
out[i]=output[i];
/*Write the decoded audio to file*/
fwrite(out, sizeof(short), FRAME_SIZE, fout);
}
/*Destroy the decoder state*/
speex_decoder_destroy(state);
/*Destroy the bit-stream truct*/
speex_bits_destroy(&bits);
fclose(fout);
return 0;
}
开发者ID:Distrotech,项目名称:speex,代码行数:60,代码来源:sampledec.c
示例10: decoder_error_init
static struct spx_data *spx_open_internal (struct io_stream *stream)
{
struct spx_data *data;
SpeexStereoState stereo = SPEEX_STEREO_STATE_INIT;
data = (struct spx_data *)xmalloc (sizeof(struct spx_data));
decoder_error_init (&data->error);
data->stream = stream;
data->st = NULL;
data->stereo = stereo;
data->header = NULL;
data->output = NULL;
data->comment_packet = NULL;
data->bitrate = -1;
ogg_sync_init (&data->oy);
speex_bits_init (&data->bits);
if (!read_speex_header(data)) {
ogg_sync_clear (&data->oy);
speex_bits_destroy (&data->bits);
data->ok = 0;
}
else
data->ok = 1;
return data;
}
开发者ID:jonsafari,项目名称:mocp,代码行数:29,代码来源:speex.c
示例11: destroy_speex_decoder
void destroy_speex_decoder() {
if (gDecoderState != NULL) {
speex_decoder_destroy(gDecoderState);
speex_bits_destroy(&gDecoderBits);
gDecoderState = NULL;
}
}
开发者ID:Aleph-One-Marathon,项目名称:alephone-psp,代码行数:7,代码来源:network_speex.cpp
示例12: encode_speex
static int encode_speex(int16_t * input_frame, uint8_t nbframes, char * output, int bitrate) {
int i, bytesToWrite, nbBytes;
SpeexBits bits;
void * state;
long long total;
speex_bits_init(&bits);
state = speex_encoder_init(&speex_nb_mode);
speex_encoder_ctl(state, SPEEX_SET_QUALITY, &bitrate);
speex_bits_reset(&bits);
total = 0;
for(i=0;i<5*160;i++) {
total += input_frame[i];
}
total /= (5*160);
if(abs(total) < 10)
return 0;
for(i=0;i<5;i++) {
speex_encode_int(state, input_frame + (i*160), &bits);
}
bytesToWrite = speex_bits_nbytes(&bits);
nbBytes = speex_bits_write(&bits, output, bytesToWrite);
speex_bits_destroy(&bits);
speex_decoder_destroy(state);
return nbBytes;
}
开发者ID:Youx,项目名称:soliloque-client,代码行数:29,代码来源:encoder.c
示例13: speextolin_destroy
static void speextolin_destroy(struct ast_trans_pvt *arg)
{
struct speex_coder_pvt *pvt = arg->pvt;
speex_decoder_destroy(pvt->speex);
speex_bits_destroy(&pvt->bits);
}
开发者ID:mtulio,项目名称:mtulio,代码行数:7,代码来源:codec_speex.c
示例14: gst_speex_dec_reset
static void
gst_speex_dec_reset (GstSpeexDec * dec)
{
dec->packetno = 0;
dec->frame_size = 0;
dec->frame_duration = 0;
dec->mode = NULL;
free (dec->header);
dec->header = NULL;
speex_bits_destroy (&dec->bits);
speex_bits_set_bit_buffer (&dec->bits, NULL, 0);
gst_buffer_replace (&dec->streamheader, NULL);
gst_buffer_replace (&dec->vorbiscomment, NULL);
if (dec->stereo) {
speex_stereo_state_destroy (dec->stereo);
dec->stereo = NULL;
}
if (dec->state) {
speex_decoder_destroy (dec->state);
dec->state = NULL;
}
}
开发者ID:pexip,项目名称:gst-plugins-good,代码行数:25,代码来源:gstspeexdec.c
示例15: wait
AudioInput::~AudioInput() {
bRunning = false;
wait();
if (ceEncoder) {
cCodec->celt_encoder_destroy(ceEncoder);
} else if (esSpeex) {
speex_bits_destroy(&sbBits);
speex_encoder_destroy(esSpeex);
}
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:ashurta,项目名称:mumble,代码行数:32,代码来源:AudioInput.cpp
示例16: decode_destructor
static void decode_destructor(void *arg)
{
struct audec_state *st = arg;
speex_bits_destroy(&st->bits);
speex_decoder_destroy(st->dec);
}
开发者ID:FOSSRIT,项目名称:baresip,代码行数:7,代码来源:speex.c
示例17: encode_destructor
static void encode_destructor(void *arg)
{
struct auenc_state *st = arg;
speex_bits_destroy(&st->bits);
speex_encoder_destroy(st->enc);
}
开发者ID:FOSSRIT,项目名称:baresip,代码行数:7,代码来源:speex.c
示例18: main
int main(int argc, char **argv)
{
char *inFile;
FILE *fin;
short in[FRAME_SIZE];
float input[FRAME_SIZE];
char cbits[2000];
int nbBytes;
/*Holds the state of the encoder*/
void *state;
/*Holds bits so they can be read and written to by the Speex routines*/
SpeexBits bits;
int i, tmp;
/*Create a new encoder state in narrowband mode*/
state = speex_encoder_init(&speex_nb_mode);
//printf("inited\n");
/*Set the quality to 8 (15 kbps)*/
tmp=8;
speex_encoder_ctl(state, SPEEX_SET_QUALITY, &tmp);
inFile = argv[1];
fin = fopen(inFile, "r");
/*Initialization of the structure that holds the bits*/
speex_bits_init(&bits);
while (1)
{
/*Read a 16 bits/sample audio frame*/
fread(in, sizeof(short), FRAME_SIZE, fin);
if (feof(fin))
break;
/*Copy the 16 bits values to float so Speex can work on them*/
for (i=0;i<FRAME_SIZE;i++)
input[i]=in[i];
/*Flush all the bits in the struct so we can encode a new frame*/
speex_bits_reset(&bits);
/*Encode the frame*/
speex_encode(state, input, &bits);
/*Copy the bits to an array of char that can be written*/
nbBytes = speex_bits_write(&bits, cbits, 2000);
/*Write the size of the frame first. This is what sampledec expects but
it's likely to be different in your own application*/
fwrite(&nbBytes, sizeof(int), 1, stdout);
/*Write the compressed data*/
fwrite(cbits, 1, nbBytes, stdout);
}
/*Destroy the encoder state*/
speex_encoder_destroy(state);
/*Destroy the bit-packing struct*/
speex_bits_destroy(&bits);
fclose(fin);
return 0;
}
开发者ID:kaainet,项目名称:smart_bus_proto,代码行数:59,代码来源:sample.c
示例19: speex_encoder_destroy
void SpeexEncoder::Close()
{
speex_encoder_destroy(st);
speex_bits_destroy(&bits);
ogg_stream_clear(&os);
fclose(fout);
closed = true;
}
开发者ID:MarcoMedrano,项目名称:speexsharp,代码行数:8,代码来源:speexencoder.cpp
示例20: codec_drv_stop
static void codec_drv_stop(ErlDrvData handle)
{
codec_data *d = (codec_data *) handle;
speex_bits_destroy(&d->bits);
speex_encoder_destroy(d->estate);
speex_decoder_destroy(d->dstate);
driver_free((char*)handle);
}
开发者ID:LeoKudrik,项目名称:rtplib,代码行数:8,代码来源:speex_codec.c
注:本文中的speex_bits_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论