typedef int (*encoder_t) (int, int, g726_state *);
typedef int (*decoder_t) (int, int, g726_state *);
-
typedef struct {
g726_state context;
switch_byte_t bits_per_frame;
}
}
-
static switch_status_t switch_g726_destroy(switch_codec_t *codec)
{
codec->private_info = NULL;
return SWITCH_STATUS_SUCCESS;
}
-
-
static switch_status_t switch_g726_encode(switch_codec_t *codec,
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
unsigned int *flag)
{
-
g726_handle_t *handle = codec->private_info;
g726_state *context = &handle->context;
uint32_t len = codec->implementation->bytes_per_frame;
- //uint32_t elen = codec->implementation->encoded_bytes_per_frame;
if (!context) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error!\n");
return SWITCH_STATUS_SUCCESS;
}
-
-
static switch_status_t switch_g726_decode(switch_codec_t *codec,
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
unsigned int *flag)
{
-
g726_handle_t *handle = codec->private_info;
g726_state *context = &handle->context;
int16_t *ddp = decoded_data;
return SWITCH_STATUS_FALSE;
}
-
return SWITCH_STATUS_SUCCESS;
-
}
-
-
/* Registration */
static switch_codec_implementation_t g726_16k_implementation = {
/*.destroy */ switch_g726_destroy,
};
-
static switch_codec_implementation_t g726_24k_implementation = {
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 126,
/*.destroy */ switch_g726_destroy,
};
-
-
static switch_codec_implementation_t aal2_g726_16k_implementation = {
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 124,
/*.destroy */ switch_g726_destroy,
};
-
static switch_codec_implementation_t aal2_g726_24k_implementation = {
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 123,
codec->private_info = context;
return SWITCH_STATUS_SUCCESS;
-
}
#endif
}
if (!context) {
return SWITCH_STATUS_FALSE;
-
}
if (encoded_data_len % 2 == 0) {
}
if (new_len <= *decoded_data_len) {
-
*decoded_data_len = new_len;
-
} else {
-
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!!\n");
return SWITCH_STATUS_FALSE;