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; typedef struct conference_record conference_record_t;
/* Function Prototypes */ /* Function Prototypes */
static uint32_t next_member_id(void); static uint32_t next_member_id(void);
static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member); 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 launch_conference_record_thread(conference_obj_t *conference, char *path);
static void conference_member_itterator(conference_obj_t *conference, static void conference_member_itterator(conference_obj_t *conference,
switch_stream_handle_t *stream, switch_stream_handle_t *stream,
int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*), int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*),
void *data); void *data);
/* Return a Distinct ID # */ /* Return a Distinct ID # */
static uint32_t next_member_id(void) static uint32_t next_member_id(void)
@ -251,7 +250,6 @@ static uint32_t next_member_id(void)
return id; return id;
} }
static void switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vol) static void switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vol)
{ {
int16_t *p = data; 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) if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min)
|| (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) { || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
switch_set_flag(conference, CFLAG_DESTRUCT); switch_set_flag(conference, CFLAG_DESTRUCT);
} else { } else {
if (conference->exit_sound) { if (conference->exit_sound) {
conference_play_file(conference, conference->exit_sound, 0); 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; muxed = (int16_t *) omember->mux_frame;
for (x = 0; x < imember->read / 2; x++) { for (x = 0; x < imember->read / 2; x++) {
int32_t z = muxed[x] + bptr[x]; int32_t z = muxed[x] + bptr[x];
switch_normalize_to_16bit(z); 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) { if (conference->fnode && conference->fnode->done) {
confernce_file_node_t *fnode; confernce_file_node_t *fnode;
switch_memory_pool_t *pool; 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); channel = switch_core_session_get_channel(member->session);
assert(channel != NULL); assert(channel != NULL);
assert(member->conference != NULL); assert(member->conference != NULL);
if (switch_core_timer_init(&timer, if (switch_core_timer_init(&timer,
@ -832,7 +828,6 @@ static void conference_loop(conference_member_t *member)
switch_event_destroy(&event); switch_event_destroy(&event);
} }
#if 1
if (switch_channel_test_flag(channel, CF_OUTBOUND)) { if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
// test to see if outbound channel has answered // test to see if outbound channel has answered
if (switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(member->conference, CFLAG_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); switch_channel_answer(channel);
} }
} }
#endif
if (switch_channel_has_dtmf(channel)) { if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf)); switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
for (digit = dtmf; *digit; digit++) { for (digit = dtmf; *digit; digit++) {
switch(*digit) { switch(*digit) {
@ -1068,7 +1063,6 @@ static void conference_loop(conference_member_t *member)
switch_clear_flag_locked(member, MFLAG_RUNNING); switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_core_timer_destroy(&timer); switch_core_timer_destroy(&timer);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
switch_channel_cause2str(switch_channel_get_cause(channel))); 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 */ /* 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) 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}; switch_file_handle_t fh = {0};
conference_member_t smember = {0}, *member; conference_member_t smember = {0}, *member;
conference_record_t *rec = (conference_record_t *) obj; conference_record_t *rec = (conference_record_t *) obj;
uint32_t divider = 1000 / rec->conference->interval; uint32_t divider = 1000 / rec->conference->interval;
uint32_t samples = (rec->conference->rate / divider); uint32_t samples = (rec->conference->rate / divider);
uint32_t bytes = samples * 2; uint32_t bytes = samples * 2;
uint32_t mux_used; uint32_t mux_used;
char *vval; 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; member->flags = MFLAG_CAN_HEAR | MFLAG_NOCHANNEL | MFLAG_RUNNING;
write_frame.data = data; write_frame.data = data;
write_frame.buflen = sizeof(data); write_frame.buflen = sizeof(data);
assert(rec->conference != NULL); assert(rec->conference != NULL);
member->conference = rec->conference; member->conference = rec->conference;
@ -1139,7 +1132,6 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
goto end; goto end;
} }
if (switch_core_file_open(&fh, if (switch_core_file_open(&fh,
rec->path, rec->path,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, 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_core_file_close(&fh);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording Stopped\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording Stopped\n");
end: end:
if (rec->pool) { if (rec->pool) {
switch_memory_pool_t *pool = 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; return NULL;
} }
/* Make files stop playing in a conference either the current one or all of them */ /* 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) 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); switch_mutex_unlock(conference->mutex);
if (!count) { if (!count) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
#ifdef WIN32 #ifdef WIN32
if (*(file +1) != ':' && *file != '/') { if (*(file +1) != ':' && *file != '/') {
@ -1309,7 +1299,6 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char *
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
/* Play a file in the conference rooom to a member */ /* 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) 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); switch_mutex_lock(conference->member_mutex);
count = conference->count; count = conference->count;
if (!(conference->tts_engine && conference->tts_voice)) { if (!(conference->tts_engine && conference->tts_voice)) {
count = 0; count = 0;
} }
switch_mutex_unlock(conference->member_mutex); switch_mutex_unlock(conference->member_mutex);
switch_mutex_unlock(conference->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; return SWITCH_STATUS_FALSE;
} }
fnode->pool = pool; fnode->pool = pool;
/* Queue the node */ /* 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); switch_mutex_unlock(conference->member_mutex);
} }
static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream) static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
{ {
conference_member_t *member = NULL; 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))) { if (member != NULL || (member = conference_member_get(conference, id))) {
switch_event_t *event; switch_event_t *event;
if (data) { if (data) {
switch_mutex_lock(member->flag_mutex); switch_mutex_lock(member->flag_mutex);
member->energy_level = atoi((char *)data); member->energy_level = atoi((char *)data);
switch_mutex_unlock(member->flag_mutex); 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;
} }
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; 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"); stream->write_function(stream, "Memory Error!\n");
} }
done: done:
if (lbuf) { if (lbuf) {
free(lbuf); free(lbuf);
@ -2515,7 +2502,7 @@ static switch_status_t conference_outcall(conference_obj_t *conference,
goto done; goto done;
} }
done: done:
return status; return status;
} }
@ -2564,7 +2551,7 @@ static void conference_function(switch_core_session_t *session, char *data)
char *dpin = NULL; char *dpin = NULL;
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
assert(channel != NULL); assert(channel != NULL);
if (!mydata) { if (!mydata) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n"); 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; goto done;
} }
} }
/* Release the config registry handle */ /* Release the config registry handle */
@ -2734,7 +2720,6 @@ static void conference_function(switch_core_session_t *session, char *data)
cxml = NULL; cxml = NULL;
} }
if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) { if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) { if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
goto done; goto done;
@ -2746,8 +2731,6 @@ static void conference_function(switch_core_session_t *session, char *data)
switch_set_flag(conference, CFLAG_ANSWERED); switch_set_flag(conference, CFLAG_ANSWERED);
} }
/* Save the original read codec. */ /* Save the original read codec. */
read_codec = switch_core_session_get_read_codec(session); read_codec = switch_core_session_get_read_codec(session);
member.native_rate = read_codec->implementation->samples_per_second; 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; goto codec_done1;
} }
/* Prepare MUTEXS */ /* Prepare MUTEXS */
member.id = next_member_id(); member.id = next_member_id();
member.pool = pool; 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); 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 */ /* 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); switch_core_codec_destroy(&member.read_codec);
codec_done2: codec_done2:
switch_core_codec_destroy(&member.write_codec); switch_core_codec_destroy(&member.write_codec);
done: done:
switch_buffer_destroy(&member.resample_buffer); switch_buffer_destroy(&member.resample_buffer);
switch_buffer_destroy(&member.audio_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); assert(member != NULL);
channel = switch_core_session_get_channel(member->session); channel = switch_core_session_get_channel(member->session);
assert(channel != NULL); assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(member->session); 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 /* 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. */ 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); switch_event_fire(&event);
} }
} }
} }
} else { } else {
if (hangunder_hits) { 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; return SWITCH_STATUS_SUCCESS;
} }
static const switch_chat_interface_t conference_chat_interface = { static const switch_chat_interface_t conference_chat_interface = {
/*.name */ CONF_CHAT_PROTO, /*.name */ CONF_CHAT_PROTO,
/*.chat_send */ chat_send, /*.chat_send */ chat_send,
@ -3400,7 +3379,6 @@ static conference_obj_t *conference_new(char *name, switch_xml_t profile, switch
return conference; return conference;
} }
/* Called by FreeSWITCH when the module loads */ /* 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) 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; return SWITCH_STATUS_TERM;
} }
/* Setup a hash to store conferences by name */ /* Setup a hash to store conferences by name */
switch_core_hash_init(&globals.conference_hash, globals.conference_pool); switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, 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; return status;
} }
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void) SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
{ {