mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
standardize to some more specific int types for frame size and rate variables.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1095 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -55,14 +55,14 @@ static switch_status switch_g711u_init(switch_codec *codec, switch_codec_flag fl
|
||||
static switch_status switch_g711u_encode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *decoded_data,
|
||||
size_t decoded_data_len,
|
||||
int decoded_rate,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data,
|
||||
size_t *encoded_data_len, int *encoded_rate, unsigned int *flag)
|
||||
uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
|
||||
{
|
||||
short *dbuf;
|
||||
unsigned char *ebuf;
|
||||
size_t i;
|
||||
uint32_t i;
|
||||
|
||||
dbuf = decoded_data;
|
||||
ebuf = encoded_data;
|
||||
@@ -79,14 +79,14 @@ static switch_status switch_g711u_encode(switch_codec *codec,
|
||||
static switch_status switch_g711u_decode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *encoded_data,
|
||||
size_t encoded_data_len,
|
||||
int encoded_rate,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data,
|
||||
size_t *decoded_data_len, int *decoded_rate, unsigned int *flag)
|
||||
uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
|
||||
{
|
||||
short *dbuf;
|
||||
unsigned char *ebuf;
|
||||
size_t i;
|
||||
uint32_t i;
|
||||
|
||||
dbuf = decoded_data;
|
||||
ebuf = encoded_data;
|
||||
@@ -130,14 +130,14 @@ static switch_status switch_g711a_init(switch_codec *codec, switch_codec_flag fl
|
||||
static switch_status switch_g711a_encode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *decoded_data,
|
||||
size_t decoded_data_len,
|
||||
int decoded_rate,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data,
|
||||
size_t *encoded_data_len, int *encoded_rate, unsigned int *flag)
|
||||
uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
|
||||
{
|
||||
short *dbuf;
|
||||
unsigned char *ebuf;
|
||||
size_t i;
|
||||
uint32_t i;
|
||||
|
||||
dbuf = decoded_data;
|
||||
ebuf = encoded_data;
|
||||
@@ -154,14 +154,14 @@ static switch_status switch_g711a_encode(switch_codec *codec,
|
||||
static switch_status switch_g711a_decode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *encoded_data,
|
||||
size_t encoded_data_len,
|
||||
int encoded_rate,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data,
|
||||
size_t *decoded_data_len, int *decoded_rate, unsigned int *flag)
|
||||
uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
|
||||
{
|
||||
short *dbuf;
|
||||
unsigned char *ebuf;
|
||||
size_t i;
|
||||
uint32_t i;
|
||||
|
||||
dbuf = decoded_data;
|
||||
ebuf = encoded_data;
|
||||
|
||||
@@ -84,12 +84,12 @@ static switch_status switch_g729_encode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *decoded_data,
|
||||
|
||||
size_t decoded_data_len,
|
||||
int decoded_rate,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data,
|
||||
|
||||
size_t *encoded_data_len,
|
||||
int *encoded_rate,
|
||||
uint32_t *encoded_data_len,
|
||||
uint32_t *encoded_rate,
|
||||
unsigned int *flag)
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@ static switch_status switch_g729_encode(switch_codec *codec,
|
||||
}
|
||||
|
||||
if (decoded_data_len % 160 == 0) {
|
||||
unsigned int new_len = 0;
|
||||
uint32_t new_len = 0;
|
||||
INT16 * ddp = decoded_data;
|
||||
char *edp = encoded_data;
|
||||
int x;
|
||||
@@ -131,12 +131,12 @@ static switch_status switch_g729_decode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *encoded_data,
|
||||
|
||||
size_t encoded_data_len,
|
||||
int encoded_rate,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data,
|
||||
|
||||
size_t *decoded_data_len,
|
||||
int *decoded_rate,
|
||||
uint32_t *decoded_data_len,
|
||||
uint32_t *decoded_rate,
|
||||
unsigned int *flag)
|
||||
{
|
||||
|
||||
@@ -175,7 +175,7 @@ static switch_status switch_g729_decode(switch_codec *codec,
|
||||
|
||||
int x;
|
||||
|
||||
unsigned int new_len = 0;
|
||||
uint32_t new_len = 0;
|
||||
|
||||
test = (uint8_t *) encoded_data;
|
||||
if (*test == 0 && *(test+1) == 0) {
|
||||
|
||||
@@ -68,15 +68,15 @@ static switch_status switch_gsm_destroy(switch_codec *codec)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
static switch_status switch_gsm_encode(switch_codec *codec, switch_codec *other_codec, void *decoded_data,
|
||||
size_t decoded_data_len, int decoded_rate, void *encoded_data,
|
||||
size_t *encoded_data_len, int *encoded_rate, unsigned int *flag)
|
||||
uint32_t decoded_data_len, uint32_t decoded_rate, void *encoded_data,
|
||||
uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct gsm_context *context = codec->private_info;
|
||||
if (!context) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
if (decoded_data_len % 320 == 0) {
|
||||
unsigned int new_len = 0;
|
||||
uint32_t new_len = 0;
|
||||
gsm_signal * ddp = decoded_data;
|
||||
gsm_byte * edp = encoded_data;
|
||||
int x;
|
||||
@@ -97,8 +97,8 @@ static switch_status switch_gsm_encode(switch_codec *codec, switch_codec *other_
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
static switch_status switch_gsm_decode(switch_codec *codec, switch_codec *other_codec, void *encoded_data,
|
||||
size_t encoded_data_len, int encoded_rate, void *decoded_data,
|
||||
size_t *decoded_data_len, int *decoded_rate, unsigned int *flag)
|
||||
uint32_t encoded_data_len, uint32_t encoded_rate, void *decoded_data,
|
||||
uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct gsm_context *context = codec->private_info;
|
||||
if (!context) {
|
||||
@@ -110,7 +110,7 @@ static switch_status switch_gsm_decode(switch_codec *codec, switch_codec *other_
|
||||
gsm_byte * edp = encoded_data;
|
||||
gsm_signal * ddp = decoded_data;
|
||||
int x;
|
||||
unsigned int new_len = 0;
|
||||
uint32_t new_len = 0;
|
||||
|
||||
for (x = 0; x < loops && new_len < *decoded_data_len; x++) {
|
||||
gsm_decode(context->decoder, edp, ddp);
|
||||
|
||||
@@ -52,10 +52,10 @@ static switch_status switch_raw_init(switch_codec *codec, switch_codec_flag flag
|
||||
static switch_status switch_raw_encode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *decoded_data,
|
||||
size_t decoded_data_len,
|
||||
int decoded_rate,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data,
|
||||
size_t *encoded_data_len, int *encoded_rate, unsigned int *flag)
|
||||
uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
|
||||
{
|
||||
|
||||
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
|
||||
@@ -70,10 +70,10 @@ static switch_status switch_raw_encode(switch_codec *codec,
|
||||
static switch_status switch_raw_decode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *encoded_data,
|
||||
size_t encoded_data_len,
|
||||
int encoded_rate,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data,
|
||||
size_t *decoded_data_len, int *decoded_rate, unsigned int *flag)
|
||||
uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
|
||||
{
|
||||
if (codec && other_codec && codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
|
||||
memcpy(decoded_data, encoded_data, encoded_data_len);
|
||||
|
||||
@@ -160,10 +160,10 @@ static switch_status switch_speex_init(switch_codec *codec, switch_codec_flag fl
|
||||
static switch_status switch_speex_encode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *decoded_data,
|
||||
size_t decoded_data_len,
|
||||
int decoded_rate,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data,
|
||||
size_t *encoded_data_len, int *encoded_rate, unsigned int *flag)
|
||||
uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct speex_context *context = codec->private_info;
|
||||
short *buf;
|
||||
@@ -215,10 +215,10 @@ static switch_status switch_speex_encode(switch_codec *codec,
|
||||
static switch_status switch_speex_decode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *encoded_data,
|
||||
size_t encoded_data_len,
|
||||
int encoded_rate,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data,
|
||||
size_t *decoded_data_len, int *decoded_rate, unsigned int *flag)
|
||||
uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct speex_context *context = codec->private_info;
|
||||
short *buf;
|
||||
|
||||
@@ -117,7 +117,7 @@ struct private_object {
|
||||
int32_t timestamp_recv;
|
||||
int32_t timestamp_dtmf;
|
||||
char *codec_name;
|
||||
int codec_num;
|
||||
uint8_t codec_num;
|
||||
};
|
||||
|
||||
struct rfc2833_digit {
|
||||
@@ -545,7 +545,8 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
|
||||
switch_io_flag flags, int stream_id)
|
||||
{
|
||||
struct private_object *tech_pvt = NULL;
|
||||
size_t bytes = 0, samples = 0, frames = 0, ms = 0;
|
||||
uint32_t bytes = 0;
|
||||
switch_size_t samples = 0, frames = 0, ms = 0;
|
||||
switch_channel *channel = NULL;
|
||||
int payload = 0;
|
||||
|
||||
@@ -728,7 +729,7 @@ static switch_status channel_write_frame(switch_core_session *session, switch_fr
|
||||
//printf("%s send %d bytes %d samples in %d frames ts=%d\n", switch_channel_get_name(channel), frame->datalen, samples, frames, tech_pvt->timestamp_send);
|
||||
|
||||
|
||||
switch_rtp_write(tech_pvt->rtp_session, frame->data, (int) frame->datalen, samples);
|
||||
switch_rtp_write(tech_pvt->rtp_session, frame->data, frame->datalen, samples);
|
||||
tech_pvt->timestamp_send += (int) samples;
|
||||
|
||||
switch_clear_flag(tech_pvt, TFLAG_WRITING);
|
||||
|
||||
@@ -134,7 +134,7 @@ static switch_status sndfile_file_open(switch_file_handle *handle, char *path)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Opening File [%s] %dhz\n", path, context->sfinfo.samplerate);
|
||||
handle->samples = (unsigned int) context->sfinfo.frames;
|
||||
handle->samplerate = context->sfinfo.samplerate;
|
||||
handle->channels = context->sfinfo.channels;
|
||||
handle->channels = (uint8_t)context->sfinfo.channels;
|
||||
handle->format = context->sfinfo.format;
|
||||
handle->sections = context->sfinfo.sections;
|
||||
handle->seekable = context->sfinfo.seekable;
|
||||
|
||||
@@ -1665,7 +1665,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((write_frame.datalen = switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
|
||||
if ((write_frame.datalen = (uint32_t)switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
|
||||
if (loops > 0) {
|
||||
switch_buffer *tmp;
|
||||
|
||||
@@ -1675,7 +1675,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
tto->loop_buffer = tmp;
|
||||
loops--;
|
||||
/* try again */
|
||||
if ((write_frame.datalen = switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
|
||||
if ((write_frame.datalen = (uint32_t)switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user