Пример #1
0
static void enc_init(MSFilter *f){
	EncState *s=(EncState *)ms_new(EncState, 1); /* alloc EncState object, count = 1 */
	memset(s, 0 , sizeof(*s));
	s->enc = bv16_encode_init(NULL);
	s->ts=0;
	s->bufferizer=ms_bufferizer_new();
	f->data=s;
}
Пример #2
0
static switch_status_t switch_bv16_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
{
	struct bv16_context *context = NULL;
	int encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
	int decoding = (flags & SWITCH_CODEC_FLAG_DECODE);

	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
		return SWITCH_STATUS_FALSE;
	}

	if (encoding) {
		context->encoder_object = bv16_encode_init(NULL);
	}

	if (decoding) {
		context->decoder_object = bv16_decode_init(NULL);
	}

	codec->private_info = context;
	return SWITCH_STATUS_SUCCESS;
}