示例#1
0
文件: voice7.c 项目: canthar/libgadu
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
}
示例#2
0
static int processing_state_destructor(struct mgcp_process_rtp_state *state)
{
	switch (state->src_fmt) {
	case AF_GSM:
		if (state->src.gsm_handle)
			gsm_destroy(state->src.gsm_handle);
		break;
#ifdef HAVE_BCG729
	case AF_G729:
		if (state->src.g729_dec)
			closeBcg729DecoderChannel(state->src.g729_dec);
		break;
#endif
	default:
		break;
	}
	switch (state->dst_fmt) {
	case AF_GSM:
		if (state->dst.gsm_handle)
			gsm_destroy(state->dst.gsm_handle);
		break;
#ifdef HAVE_BCG729
	case AF_G729:
		if (state->dst.g729_enc)
			closeBcg729EncoderChannel(state->dst.g729_enc);
		break;
#endif
	default:
		break;
	}
	return 0;
}
示例#3
0
文件: gsm.c 项目: 46labs/sems
static void gsm_destroy_if(long h_codec)
{
  gsm* h_arr = (gsm*)h_codec;

  gsm_destroy(h_arr[0]);
  gsm_destroy(h_arr[1]);

  free(h_arr);
}
示例#4
0
int tdav_codec_gsm_close(tmedia_codec_t* self)
{
    tdav_codec_gsm_t* gsm = (tdav_codec_gsm_t*)self;

    if(gsm->encoder) {
        gsm_destroy(gsm->encoder);
        gsm->encoder = tsk_null;
    }
    if(gsm->decoder) {
        gsm_destroy(gsm->decoder);
        gsm->decoder = tsk_null;
    }

    return 0;
}
示例#5
0
static av_cold int libgsm_decode_close(AVCodecContext *avctx) {
    LibGSMDecodeContext *s = avctx->priv_data;

    gsm_destroy(s->state);
    s->state = NULL;
    return 0;
}
/* ======================================================================== */
OSCL_EXPORT_REF void PV_Wav_Parser::CleanupWAVFile(void)
{
    if (ipWAVFile != NULL)
        ipWAVFile->Close();
    OSCL_DELETE(ipWAVFile);
    ipWAVFile = NULL;

    AudioFormat = 0;
    NumChannels = 0;
    SampleRate = 0;
    ByteRate = 0;
    BlockAlign = 0;
    BitsPerSample = 0;
    BytesPerSample = 0;
    PCMBytesRead = 0;
    PCMBytesPresent = 0;
    iHeaderSize = 0;
    isLittleEndian = 1; // little endian by default
    xLawTable = NULL;
    if(iGsmHandle) 
    {
        gsm_destroy((gsm)iGsmHandle);
        iGsmHandle = 0;
    }
    iPrevData = 0;
}
示例#7
0
static void gsm_destroy_stuff(struct ast_translator_pvt *pvt)
{
	if (pvt->gsm)
		gsm_destroy(pvt->gsm);
	free(pvt);
	localusecnt--;
}
示例#8
0
WavDecoder::~WavDecoder()
{
#ifdef WAVGSM_SUPPORTED
    if(d->header.wave.audioFormat == 49)
        gsm_destroy( d->gsmhandle );
#endif
    delete d;
}
示例#9
0
static av_cold int libgsm_encode_close(AVCodecContext *avctx) {
#if FF_API_OLD_ENCODE_AUDIO
    av_freep(&avctx->coded_frame);
#endif
    gsm_destroy(avctx->priv_data);
    avctx->priv_data = NULL;
    return 0;
}
示例#10
0
/* destructor */
static tsk_object_t* tdav_codec_gsm_dtor(tsk_object_t * self)
{
    tdav_codec_gsm_t *gsm = self;
    if(gsm) {
        /* deinit base */
        tmedia_codec_audio_deinit(gsm);
        /* deinit self */
        if(gsm->encoder) {
            gsm_destroy(gsm->encoder);
        }
        if(gsm->decoder) {
            gsm_destroy(gsm->decoder);
        }
    }

    return self;
}
示例#11
0
SmartSAudioDecoder::~SmartSAudioDecoder()
{
	if( m_pGSMBuffer )
		delete []m_pGSMBuffer;
	
	if( m_GSMInstance )
		gsm_destroy( m_GSMInstance );
}
示例#12
0
/*
 * Close codec.
 */
static pj_status_t gsm_codec_close( pjmedia_codec *codec )
{
    struct gsm_data *gsm_data = (struct gsm_data*) codec->codec_data;

    pj_assert(gsm_data != NULL);

    if (gsm_data->encoder) {
	gsm_destroy(gsm_data->encoder);
	gsm_data->encoder = NULL;
    }
    if (gsm_data->decoder) {
	gsm_destroy(gsm_data->decoder);
	gsm_data->decoder = NULL;
    }

    return PJ_SUCCESS;
}
示例#13
0
static void libgsm_flush(AVCodecContext *avctx) {
    LibGSMDecodeContext *s = avctx->priv_data;
    int one = 1;

    gsm_destroy(s->state);
    s->state = gsm_create();
    if (avctx->codec_id == CODEC_ID_GSM_MS)
        gsm_option(s->state, GSM_OPT_WAV49, &one);
}
示例#14
0
static gboolean
gst_gsmenc_stop (GstAudioEncoder * enc)
{
  GstGSMEnc *gsmenc = GST_GSMENC (enc);

  GST_DEBUG_OBJECT (enc, "stop");
  gsm_destroy (gsmenc->state);

  return TRUE;
}
示例#15
0
OsStatus MpdSipxGSM::freeDecode(void)
{
   if (mpGsmState != NULL) 
   {
      gsm_destroy(mpGsmState);
      mpGsmState = NULL;
   }

   return OS_SUCCESS;
}
示例#16
0
static void close_gsm(bgav_stream_t * s)
  {
  gsm_priv * priv;
  priv = s->decoder_priv;

  if(priv->frame)
    gavl_audio_frame_destroy(priv->frame);
  gsm_destroy(priv->gsm_state);
  free(priv);
  }
示例#17
0
/* Destroy structure for callback method */
void destroycallbackData(callbackDataIn_t *Data){
	LOGI("Enter: destroycallbackData\n");
	if(Data!=NULL){
		gsm_destroy(Data->gsm);
		free(Data);
	}else{
		LOGE("Exit: destroycallbackData: Callback data structure not init\n");
	}
	LOGI("Exit: destroycallbackData: OK\n");
}
示例#18
0
文件: gsm_1215.c 项目: rsenn/eXT2
static void cleanupGsm(LADSPA_Handle instance) {
	Gsm *plugin_data = (Gsm *)instance;
	free(plugin_data->src);
	free(plugin_data->dst);
	free(plugin_data->dry);
	free(plugin_data->blf);
	if (plugin_data->handle) {
	  gsm_destroy(plugin_data->handle);
	}
	free(instance);
}
示例#19
0
static gboolean
gst_gsmdec_stop (GstAudioDecoder * dec)
{
  GstGSMDec *gsmdec = GST_GSMDEC (dec);

  GST_DEBUG_OBJECT (dec, "stop");

  gsm_destroy (gsmdec->state);

  return TRUE;
}
示例#20
0
CODEC_API int PLG_FREE_V1(libgsm)(void* handle, int isDecoder)
{
   struct libgsm_codec_data *mpGsm = (struct libgsm_codec_data *)handle;

   if (NULL != handle)
   {
      gsm_destroy(mpGsm->mpGsmState);
      free(handle);
   }
   return RPLG_SUCCESS;
}
示例#21
0
static void
gst_gsmdec_finalize (GObject * object)
{
    GstGSMDec *gsmdec;

    gsmdec = GST_GSMDEC (object);

    g_object_unref (gsmdec->adapter);
    gsm_destroy (gsmdec->state);

    G_OBJECT_CLASS (parent_class)->finalize (object);
}
int st_gsmstopread(ft_t ft)
{
        struct gsmpriv *p = (struct gsmpriv *) ft->priv;
        int ch;

        for (ch=0; ch<p->channels; ch++)
                gsm_destroy(p->handle[ch]);

        free(p->samples);
        free(p->frames);
        return (ST_SUCCESS);
}
示例#23
0
文件: gsm610.c 项目: Caught/openpliPC
static void gsm610_dispose (audio_decoder_t *this_gen) {

  gsm610_decoder_t *this = (gsm610_decoder_t *) this_gen;

  if (this->gsm_state)
    gsm_destroy(this->gsm_state);

  if (this->output_open)
    this->stream->audio_out->close (this->stream->audio_out, this->stream);
  this->output_open = 0;

  if (this->buf)
    free(this->buf);

  free (this_gen);
}
示例#24
0
static av_cold int libgsm_encode_init(AVCodecContext *avctx) {
    if (avctx->channels > 1) {
        av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n",
               avctx->channels);
        return -1;
    }

    if (avctx->sample_rate != 8000) {
        av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n",
               avctx->sample_rate);
        if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)
            return -1;
    }
    if (avctx->bit_rate != 13000 /* Official */ &&
        avctx->bit_rate != 13200 /* Very common */ &&
        avctx->bit_rate != 0 /* Unknown; a.o. mov does not set bitrate when decoding */ ) {
        av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n",
               avctx->bit_rate);
        if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)
            return -1;
    }

    avctx->priv_data = gsm_create();

    switch(avctx->codec_id) {
    case CODEC_ID_GSM:
        avctx->frame_size = GSM_FRAME_SIZE;
        avctx->block_align = GSM_BLOCK_SIZE;
        break;
    case CODEC_ID_GSM_MS: {
        int one = 1;
        gsm_option(avctx->priv_data, GSM_OPT_WAV49, &one);
        avctx->frame_size = 2*GSM_FRAME_SIZE;
        avctx->block_align = GSM_MS_BLOCK_SIZE;
        }
    }

#if FF_API_OLD_ENCODE_AUDIO
    avctx->coded_frame= avcodec_alloc_frame();
    if (!avctx->coded_frame) {
        gsm_destroy(avctx->priv_data);
        return AVERROR(ENOMEM);
    }
#endif

    return 0;
}
示例#25
0
void
_v3_coder_destroy(v3_handle v3h, v3_coder *coder) {
    _v3_enter(v3h, __func__);

    if (coder->state) {
        _v3_debug(v3h, V3_DBG_MEMORY, "releasing %scoder state", (coder->encoder) ? "en" : "de");
        switch (coder->index) {
#ifdef HAVE_GSM
          case 0:
            gsm_destroy(coder->state);
            _v3_debug(v3h, V3_DBG_MEMORY, "released gsm state");
            break;
#endif
#ifdef HAVE_OPUS
          case 1:
          case 2:
            if (coder->encoder) {
                opus_encoder_destroy(coder->state);
            } else {
                opus_decoder_destroy(coder->state);
            }
            _v3_debug(v3h, V3_DBG_MEMORY, "released opus state");
            break;
#endif
#ifdef HAVE_SPEEX
          case 3:
            if (coder->encoder) {
                speex_encoder_destroy(coder->state);
            } else {
                speex_decoder_destroy(coder->state);
            }
            _v3_debug(v3h, V3_DBG_MEMORY, "released speex state");
            break;
#endif
          default:
            break;
        }
        coder->state = NULL;
    }

    _v3_leave(v3h, __func__);
}
示例#26
0
int	
wav_gsm610_close	(SF_PRIVATE  *psf)
{	GSM610_PRIVATE *pgsm610 ; 

	if (! psf->fdata)
		return 0 ;

	pgsm610 = (GSM610_PRIVATE*) psf->fdata ;

#if defined(USE_LIBSND_ALL) || defined(USE_LIBSND_WRITE) 
	if (psf->mode == SF_MODE_WRITE)
	{	/*	If a block has been partially assembled, write it out
		**	as the final block.
		*/
	
		if (pgsm610->samplecount && pgsm610->samplecount < GSM610_SAMPLES)
			wav_gsm610_write_block (psf, pgsm610) ;	

		/*  Now we know for certain the length of the file we can
		**  re-write correct values for the RIFF and data chunks.
		*/
		 
		fseek (psf->file, 0, SEEK_END) ;
		psf->filelength = ftell (psf->file) ;

		psf->sf.samples = GSM610_SAMPLES * pgsm610->blockcount ;
		psf->datalength = psf->filelength - psf->dataoffset ;

		wav_gsm610_write_header (psf) ;
		} ;
#endif

	if (pgsm610->gsm_data)
		gsm_destroy (pgsm610->gsm_data) ;

	if (psf->fdata)
		free (psf->fdata) ;
	psf->fdata = NULL ;

	return 0 ;
} /* wav_gsm610_close */
示例#27
0
void vmsDeInit(VmsPlayRecordType **vmspP)
{
	if(vmspP)
	{
		if(*vmspP)
		{
			if((*vmspP)->playRecordObj)
			{	
				gsm_destroy((*vmspP)->playRecordObj);
			}
			DeInitAudio( (*vmspP)->aqRecordPlayPcm,false);
			if((*vmspP)->playRecordFP)
			{	
				fclose((*vmspP)->playRecordFP);
				(*vmspP)->playRecordFP = 0;
				
			}
			
			free(*vmspP);
			*vmspP = 0;
		
		}
	}
}
示例#28
0
t_gsm_audio_encoder::~t_gsm_audio_encoder() {
	gsm_destroy(gsm_encoder);
}
示例#29
0
static void gsm_destroy_stuff(struct ast_trans_pvt *pvt)
{
	struct gsm_translator_pvt *tmp = pvt->pvt;
	if (tmp->gsm)
		gsm_destroy(tmp->gsm);
}
SoftGSM::~SoftGSM() {
    gsm_destroy(mGsm);
}