whitespace cleanup.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3158 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2006-10-22 17:44:41 +00:00
parent 1cd8709762
commit af23ce4853

View File

@ -197,7 +197,6 @@ struct conference_record {
};
typedef struct conference_record conference_record_t;
/* Function Prototypes */
static uint32_t next_member_id(void);
static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member);
@ -235,9 +234,9 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
static void launch_conference_record_thread(conference_obj_t *conference, char *path);
static void conference_member_itterator(conference_obj_t *conference,
switch_stream_handle_t *stream,
int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*),
void *data);
switch_stream_handle_t *stream,
int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*),
void *data);
/* Return a Distinct ID # */
static uint32_t next_member_id(void)
@ -251,7 +250,6 @@ static uint32_t next_member_id(void)
return id;
}
static void switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vol)
{
int16_t *p = data;
@ -481,7 +479,7 @@ static void conference_del_member(conference_obj_t *conference, conference_membe
if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min)
|| (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
switch_set_flag(conference, CFLAG_DESTRUCT);
switch_set_flag(conference, CFLAG_DESTRUCT);
} else {
if (conference->exit_sound) {
conference_play_file(conference, conference->exit_sound, 0);
@ -665,7 +663,6 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
muxed = (int16_t *) omember->mux_frame;
for (x = 0; x < imember->read / 2; x++) {
int32_t z = muxed[x] + bptr[x];
switch_normalize_to_16bit(z);
@ -685,7 +682,6 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
}
}
if (conference->fnode && conference->fnode->done) {
confernce_file_node_t *fnode;
switch_memory_pool_t *pool;
@ -783,7 +779,7 @@ static void conference_loop(conference_member_t *member)
channel = switch_core_session_get_channel(member->session);
assert(channel != NULL);
assert(channel != NULL);
assert(member->conference != NULL);
if (switch_core_timer_init(&timer,
@ -832,7 +828,6 @@ static void conference_loop(conference_member_t *member)
switch_event_destroy(&event);
}
#if 1
if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
// test to see if outbound channel has answered
if (switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(member->conference, CFLAG_ANSWERED)) {
@ -845,9 +840,9 @@ static void conference_loop(conference_member_t *member)
switch_channel_answer(channel);
}
}
#endif
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
for (digit = dtmf; *digit; digit++) {
switch(*digit) {
@ -1068,7 +1063,6 @@ static void conference_loop(conference_member_t *member)
switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_core_timer_destroy(&timer);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
switch_channel_cause2str(switch_channel_get_cause(channel)));
@ -1083,7 +1077,6 @@ static void conference_loop(conference_member_t *member)
}
}
/* Sub-Routine called by a record entity inside a conference */
static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, void *obj)
{
@ -1092,9 +1085,9 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
switch_file_handle_t fh = {0};
conference_member_t smember = {0}, *member;
conference_record_t *rec = (conference_record_t *) obj;
uint32_t divider = 1000 / rec->conference->interval;
uint32_t samples = (rec->conference->rate / divider);
uint32_t bytes = samples * 2;
uint32_t divider = 1000 / rec->conference->interval;
uint32_t samples = (rec->conference->rate / divider);
uint32_t bytes = samples * 2;
uint32_t mux_used;
char *vval;
@ -1107,7 +1100,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
member->flags = MFLAG_CAN_HEAR | MFLAG_NOCHANNEL | MFLAG_RUNNING;
write_frame.data = data;
write_frame.buflen = sizeof(data);
write_frame.buflen = sizeof(data);
assert(rec->conference != NULL);
member->conference = rec->conference;
@ -1139,7 +1132,6 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
goto end;
}
if (switch_core_file_open(&fh,
rec->path,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
@ -1177,8 +1169,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
switch_core_file_close(&fh);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording Stopped\n");
end:
end:
if (rec->pool) {
switch_memory_pool_t *pool = rec->pool;
@ -1193,7 +1184,6 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
return NULL;
}
/* Make files stop playing in a conference either the current one or all of them */
static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop)
{
@ -1257,8 +1247,8 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char *
switch_mutex_unlock(conference->mutex);
if (!count) {
return SWITCH_STATUS_FALSE;
}
return SWITCH_STATUS_FALSE;
}
#ifdef WIN32
if (*(file +1) != ':' && *file != '/') {
@ -1309,7 +1299,6 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char *
return SWITCH_STATUS_SUCCESS;
}
/* Play a file in the conference rooom to a member */
static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin)
{
@ -1432,8 +1421,8 @@ static switch_status_t conference_say(conference_obj_t *conference, char *text,
switch_mutex_lock(conference->member_mutex);
count = conference->count;
if (!(conference->tts_engine && conference->tts_voice)) {
count = 0;
}
count = 0;
}
switch_mutex_unlock(conference->member_mutex);
switch_mutex_unlock(conference->mutex);
@ -1468,7 +1457,6 @@ static switch_status_t conference_say(conference_obj_t *conference, char *text,
return SWITCH_STATUS_FALSE;
}
fnode->pool = pool;
/* Queue the node */
@ -1548,7 +1536,6 @@ static void conference_list(conference_obj_t *conference, switch_stream_handle_t
switch_mutex_unlock(conference->member_mutex);
}
static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
{
conference_member_t *member = NULL;
@ -1724,32 +1711,32 @@ static int conference_function_energy_member(conference_obj_t *conference, confe
if (member != NULL || (member = conference_member_get(conference, id))) {
switch_event_t *event;
if (data) {
switch_mutex_lock(member->flag_mutex);
member->energy_level = atoi((char *)data);
switch_mutex_unlock(member->flag_mutex);
}
stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
if (data) {
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
switch_event_fire(&event);
}
}
} else {
stream->write_function(stream, "Non-Existant ID %u\n", id);
err = 1;
if (data) {
switch_mutex_lock(member->flag_mutex);
member->energy_level = atoi((char *)data);
switch_mutex_unlock(member->flag_mutex);
}
stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
if (data) {
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
switch_event_fire(&event);
}
}
} else {
stream->write_function(stream, "Non-Existant ID %u\n", id);
err = 1;
}
return err;
}
@ -2416,7 +2403,7 @@ static switch_status_t conf_function(char *buf, switch_core_session_t *session,
stream->write_function(stream, "Memory Error!\n");
}
done:
done:
if (lbuf) {
free(lbuf);
@ -2515,7 +2502,7 @@ static switch_status_t conference_outcall(conference_obj_t *conference,
goto done;
}
done:
done:
return status;
}
@ -2564,7 +2551,7 @@ static void conference_function(switch_core_session_t *session, char *data)
char *dpin = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
assert(channel != NULL);
if (!mydata) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
@ -2725,7 +2712,6 @@ static void conference_function(switch_core_session_t *session, char *data)
}
goto done;
}
}
/* Release the config registry handle */
@ -2734,7 +2720,6 @@ static void conference_function(switch_core_session_t *session, char *data)
cxml = NULL;
}
if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
goto done;
@ -2746,8 +2731,6 @@ static void conference_function(switch_core_session_t *session, char *data)
switch_set_flag(conference, CFLAG_ANSWERED);
}
/* Save the original read codec. */
read_codec = switch_core_session_get_read_codec(session);
member.native_rate = read_codec->implementation->samples_per_second;
@ -2823,8 +2806,6 @@ static void conference_function(switch_core_session_t *session, char *data)
goto codec_done1;
}
/* Prepare MUTEXS */
member.id = next_member_id();
member.pool = pool;
@ -2862,11 +2843,11 @@ static void conference_function(switch_core_session_t *session, char *data)
switch_core_session_set_read_codec(member.session, read_codec);
/* Clean Up. codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
codec_done1:
codec_done1:
switch_core_codec_destroy(&member.read_codec);
codec_done2:
codec_done2:
switch_core_codec_destroy(&member.write_codec);
done:
done:
switch_buffer_destroy(&member.resample_buffer);
switch_buffer_destroy(&member.audio_buffer);
@ -2951,10 +2932,10 @@ static void *SWITCH_THREAD_FUNC input_thread_run(switch_thread_t *thread, void *
assert(member != NULL);
channel = switch_core_session_get_channel(member->session);
assert(channel != NULL);
assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(member->session);
assert(read_codec != NULL);
assert(read_codec != NULL);
/* As long as we have a valid read, feed that data into an input buffer where the conference thread will take it
and mux it with any audio from other channels. */
@ -3008,7 +2989,6 @@ static void *SWITCH_THREAD_FUNC input_thread_run(switch_thread_t *thread, void *
switch_event_fire(&event);
}
}
}
} else {
if (hangunder_hits) {
@ -3154,7 +3134,6 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
return SWITCH_STATUS_SUCCESS;
}
static const switch_chat_interface_t conference_chat_interface = {
/*.name */ CONF_CHAT_PROTO,
/*.chat_send */ chat_send,
@ -3400,7 +3379,6 @@ static conference_obj_t *conference_new(char *name, switch_xml_t profile, switch
return conference;
}
/* Called by FreeSWITCH when the module loads */
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
@ -3422,7 +3400,6 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
return SWITCH_STATUS_TERM;
}
/* Setup a hash to store conferences by name */
switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
@ -3434,7 +3411,6 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
return status;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
{