run indent on the whole tree and update copyright dates in prep for 1.0.5

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16579 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2010-02-06 03:38:24 +00:00
1 parent 7b347417e5
commit 886e1ddb4d
229 files changed
+20252 -20192

No files matched your search

+46 -44
View File
@@ -1,6 +1,6 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
* Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
@@ -52,7 +52,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Handle already open\n");
return SWITCH_STATUS_FALSE;
}
if (!fh->samplerate) {
if (!(fh->samplerate = rate)) {
fh->samplerate = 8000;
@@ -93,18 +93,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
if (*p == '[' && *(p + 1) == *SWITCH_PATH_SEPARATOR) {
e = switch_find_end_paren(p, '[', ']');
if (e) {
*e = '\0';
spool_path = p + 1;
fh->file_path = e + 1;
}
}
}
if (!spool_path) {
spool_path = switch_core_get_variable(SWITCH_AUDIO_SPOOL_PATH_VARIABLE);
}
file_path = fh->file_path;
}
@@ -116,7 +116,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
fh->file_path = switch_core_strdup(fh->memory_pool, file_path);
}
if ((fh->file_interface = switch_loadable_module_get_file_interface(ext)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid file format [%s] for [%s]!\n", ext, file_path);
@@ -127,13 +127,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
fh->func = func;
fh->line = line;
if (spool_path) {
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
switch_uuid_t uuid;
switch_uuid_get(&uuid);
switch_uuid_format(uuid_str, &uuid);
fh->spool_path = switch_core_sprintf(fh->memory_pool, "%s%s%s.%s", spool_path, SWITCH_PATH_SEPARATOR, uuid_str, ext);
}
@@ -159,8 +159,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
}
if ((flags & SWITCH_FILE_FLAG_WRITE) &&
!is_stream && (status = switch_file_exists(file_path, fh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
if ((flags & SWITCH_FILE_FLAG_WRITE) && !is_stream && (status = switch_file_exists(file_path, fh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "File [%s] not created!\n", file_path);
fh->file_interface->file_close(fh);
UNPROTECT_INTERFACE(fh->file_interface);
@@ -193,8 +192,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
switch_set_flag(fh, SWITCH_FILE_OPEN);
return status;
fail:
fail:
if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) {
switch_core_destroy_memory_pool(&fh->memory_pool);
}
@@ -206,7 +205,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_size_t want, got, orig_len = *len;
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
@@ -214,23 +213,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
return SWITCH_STATUS_FALSE;
}
top:
top:
if (fh->buffer && switch_buffer_inuse(fh->buffer) >= *len * 2) {
*len = switch_buffer_read(fh->buffer, data, orig_len * 2) / 2;
return SWITCH_STATUS_SUCCESS;
}
if (switch_test_flag(fh, SWITCH_FILE_DONE)) {
switch_clear_flag(fh, SWITCH_FILE_DONE);
*len = 0;
return SWITCH_STATUS_FALSE;
}
want = *len;
more:
more:
if (fh->pre_buffer) {
switch_size_t rlen;
int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);
@@ -244,7 +243,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
} else {
fh->samples_in += rlen;
if (fh->channels > 1) {
switch_mux_channels((int16_t *)fh->pre_buffer_data, rlen, fh->channels);
switch_mux_channels((int16_t *) fh->pre_buffer_data, rlen, fh->channels);
}
switch_buffer_write(fh->pre_buffer, fh->pre_buffer_data, asis ? rlen : rlen * 2);
}
@@ -253,10 +252,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
rlen = switch_buffer_read(fh->pre_buffer, data, asis ? *len : *len * 2);
*len = asis ? rlen : rlen / 2;
if (*len == 0) {
switch_set_flag(fh, SWITCH_FILE_DONE);
goto top;
goto top;
} else {
status = SWITCH_STATUS_SUCCESS;
}
@@ -271,14 +270,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
fh->samples_in += *len;
if (fh->channels > 1) {
switch_mux_channels((int16_t *)data, *len, fh->channels);
switch_mux_channels((int16_t *) data, *len, fh->channels);
}
}
got = *len;
if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
if (!fh->resampler) {
if (switch_resample_create(&fh->resampler,
@@ -288,8 +287,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
}
}
switch_resample_process(fh->resampler, data, (uint32_t)*len);
switch_resample_process(fh->resampler, data, (uint32_t) * len);
if (fh->resampler->to_len < want || fh->resampler->to_len > orig_len) {
if (!fh->buffer) {
int factor = fh->resampler->to_len * fh->samplerate / 1000;
@@ -316,10 +315,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
memcpy(data, fh->resampler->to, fh->resampler->to_len * 2);
*len = fh->resampler->to_len;
}
}
return status;
}
@@ -342,17 +341,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh,
if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
if (!fh->resampler) {
if (switch_resample_create(&fh->resampler,
fh->native_rate,
fh->samplerate,
(uint32_t) orig_len * 2 * fh->channels,
SWITCH_RESAMPLE_QUALITY, fh->channels) != SWITCH_STATUS_SUCCESS) {
fh->native_rate,
fh->samplerate,
(uint32_t) orig_len * 2 * fh->channels, SWITCH_RESAMPLE_QUALITY, fh->channels) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
return SWITCH_STATUS_GENERR;
}
}
switch_resample_process(fh->resampler, data, (uint32_t)*len);
switch_resample_process(fh->resampler, data, (uint32_t) * len);
if (fh->resampler->to_len > orig_len) {
if (!fh->dbuf) {
void *mem;
@@ -379,22 +377,24 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh,
switch_size_t rlen, blen;
switch_status_t status = SWITCH_STATUS_SUCCESS;
int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);
switch_buffer_write(fh->pre_buffer, data, (asis ? *len : *len * 2) * fh->channels);
rlen = switch_buffer_inuse(fh->pre_buffer);
if (rlen >= fh->pre_buffer_datalen) {
if ((blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen))) {
if (!asis) blen /= 2;
if (fh->channels > 1) blen /= fh->channels;
if (!asis)
blen /= 2;
if (fh->channels > 1)
blen /= fh->channels;
if ((status = fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen)) != SWITCH_STATUS_SUCCESS) {
*len = 0;
}
fh->samples_out += blen;
}
}
return status;
} else {
switch_status_t status;
@@ -478,7 +478,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t
SWITCH_DECLARE(switch_status_t) switch_core_file_truncate(switch_file_handle_t *fh, int64_t offset)
{
switch_status_t status;
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
@@ -490,7 +490,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_truncate(switch_file_handle_t *
return SWITCH_STATUS_FALSE;
}
if ((status=fh->file_interface->file_truncate(fh, offset)) == SWITCH_STATUS_SUCCESS) {
if ((status = fh->file_interface->file_truncate(fh, offset)) == SWITCH_STATUS_SUCCESS) {
if (fh->buffer) {
switch_buffer_zero(fh->buffer);
}
@@ -525,11 +525,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
switch_size_t rlen, blen;
int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);
while((rlen = switch_buffer_inuse(fh->pre_buffer))) {
while ((rlen = switch_buffer_inuse(fh->pre_buffer))) {
if ((blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen))) {
if (!asis) blen /= 2;
if (fh->channels > 1) blen /= fh->channels;
if (!asis)
blen /= 2;
if (fh->channels > 1)
blen /= fh->channels;
if (fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen) != SWITCH_STATUS_SUCCESS) {
break;
}