本文整理汇总了C++中speex_bits_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ speex_bits_destroy函数的具体用法?C++ speex_bits_destroy怎么用?C++ speex_bits_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了speex_bits_destroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例11: destroy_speex_decoder
void destroy_speex_decoder() {
if (gDecoderState != NULL) {
speex_decoder_destroy(gDecoderState);
speex_bits_destroy(&gDecoderBits);
gDecoderState = NULL;
}
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}