fix emacs tabs mode
This commit is contained in:
Anthony Minessale 2015-04-17 18:00:19 -05:00 committed by Michael Jerris
parent 48c21b6998
commit d697acb281
14 changed files with 184 additions and 182 deletions

View File

@ -391,7 +391,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_bert_shutdown)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -129,7 +129,7 @@ typedef struct cv_context_s {
int tick_x;
uint32_t overlay_idx;
uint32_t overlay_count;
switch_core_session_t *session;
switch_core_session_t *session;
char *cascade_path;
char *nested_cascade_path;
switch_memory_pool_t *pool;
@ -201,7 +201,7 @@ static void context_render_text(cv_context_t *context, struct overlay *overlay,
width = (int) (float)(font_size * 0.75f * len);
switch_color_set_rgb(&bgcolor, overlay->bg);
switch_color_set_rgb(&bgcolor, overlay->bg);
if (!overlay->png || (overlay->png->d_w != width || overlay->png->d_h != font_size * 2)) {
switch_img_free(&overlay->png);
@ -578,7 +578,7 @@ void detectAndDraw(cv_context_t *context)
int i = 0;
vector<Rect> detectedObjs, detectedObjs2;
const static Scalar colors[] = { CV_RGB(0,0,255),
const static Scalar colors[] = { CV_RGB(0,0,255),
CV_RGB(0,128,255),
CV_RGB(0,255,255),
CV_RGB(0,255,0),
@ -1097,13 +1097,13 @@ SWITCH_STANDARD_APP(cv_start_function)
char *lbuf;
char *cascade_path;
char *nested_cascade_path;
char *argv[25];
int argc;
char *argv[25];
int argc;
init_context(&context);
if (data && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (data && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
context.cascade_path = argv[0];
context.nested_cascade_path = argv[1];
@ -1118,16 +1118,16 @@ SWITCH_STANDARD_APP(cv_start_function)
switch_core_session_set_video_read_callback(session, video_thread_callback, &context);
while (switch_channel_ready(channel)) {
switch_status_t status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
while (switch_channel_ready(channel)) {
switch_status_t status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
if (switch_test_flag(read_frame, SFF_CNG)) {
continue;
}
if (switch_test_flag(read_frame, SFF_CNG)) {
continue;
}
memset(read_frame->data, 0, read_frame->datalen);
switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
@ -1150,75 +1150,75 @@ static switch_bool_t cv_bug_callback(switch_media_bug_t *bug, void *user_data, s
switch_channel_t *channel = switch_core_session_get_channel(context->session);
switch (type) {
case SWITCH_ABC_TYPE_INIT:
{
switch (type) {
case SWITCH_ABC_TYPE_INIT:
{
switch_channel_set_flag_recursive(channel, CF_VIDEO_DECODED_READ);
}
break;
case SWITCH_ABC_TYPE_CLOSE:
{
}
break;
case SWITCH_ABC_TYPE_CLOSE:
{
switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock);
switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ);
uninit_context(context);
}
break;
case SWITCH_ABC_TYPE_READ_VIDEO_PING:
}
break;
case SWITCH_ABC_TYPE_READ_VIDEO_PING:
{
switch_frame_t *frame = switch_core_media_bug_get_video_ping_frame(bug);
video_thread_callback(context->session, frame, context);
}
break;
default:
break;
}
default:
break;
}
return SWITCH_TRUE;
return SWITCH_TRUE;
}
SWITCH_STANDARD_APP(cv_bug_start_function)
{
switch_media_bug_t *bug;
switch_status_t status;
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_media_bug_t *bug;
switch_status_t status;
switch_channel_t *channel = switch_core_session_get_channel(session);
cv_context_t *context;
char *lbuf = NULL;
int x, n;
char *argv[25] = { 0 };
int argc;
char *lbuf = NULL;
int x, n;
char *argv[25] = { 0 };
int argc;
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_cv_bug_"))) {
if (!zstr(data) && !strcasecmp(data, "stop")) {
switch_channel_set_private(channel, "_cv_bug_", NULL);
switch_core_media_bug_remove(session, &bug);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
}
return;
}
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_cv_bug_"))) {
if (!zstr(data) && !strcasecmp(data, "stop")) {
switch_channel_set_private(channel, "_cv_bug_", NULL);
switch_core_media_bug_remove(session, &bug);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
}
return;
}
switch_channel_wait_for_flag(channel, CF_VIDEO_READY, SWITCH_TRUE, 10000, NULL);
context = (cv_context_t *) switch_core_session_alloc(session, sizeof(*context));
assert(context != NULL);
context = (cv_context_t *) switch_core_session_alloc(session, sizeof(*context));
assert(context != NULL);
context->session = session;
init_context(context);
if (data && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (data && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
parse_params(context, 1, argc, argv);
}
switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock);
if ((status = switch_core_media_bug_add(session, "cv_bug", NULL, cv_bug_callback, context, 0, SMBF_READ_VIDEO_PING, &bug)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
if ((status = switch_core_media_bug_add(session, "cv_bug", NULL, cv_bug_callback, context, 0, SMBF_READ_VIDEO_PING, &bug)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock);
return;
}
return;
}
switch_channel_set_private(channel, "_cv_bug_", bug);
switch_channel_set_private(channel, "_cv_bug_", bug);
}
@ -1226,45 +1226,45 @@ SWITCH_STANDARD_APP(cv_bug_start_function)
#define CV_BUG_API_SYNTAX "<uuid> [start|stop]"
SWITCH_STANDARD_API(cv_bug_api_function)
{
switch_core_session_t *rsession = NULL;
switch_channel_t *channel = NULL;
switch_media_bug_t *bug;
switch_status_t status;
switch_core_session_t *rsession = NULL;
switch_channel_t *channel = NULL;
switch_media_bug_t *bug;
switch_status_t status;
cv_context_t *context;
char *mycmd = NULL;
int argc = 0;
char *argv[25] = { 0 };
char *uuid = NULL;
char *action = NULL;
char *mycmd = NULL;
int argc = 0;
char *argv[25] = { 0 };
char *uuid = NULL;
char *action = NULL;
char *cascade_path = NULL;
char *nested_cascade_path = NULL;
char *lbuf = NULL;
int x, n, i;
char *lbuf = NULL;
int x, n, i;
if (zstr(cmd)) {
goto usage;
}
if (zstr(cmd)) {
goto usage;
}
if (!(mycmd = strdup(cmd))) {
goto usage;
}
if (!(mycmd = strdup(cmd))) {
goto usage;
}
if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
goto usage;
}
if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
goto usage;
}
uuid = argv[0];
action = argv[1];
uuid = argv[0];
action = argv[1];
if (!(rsession = switch_core_session_locate(uuid))) {
stream->write_function(stream, "-ERR Cannot locate session!\n");
goto done;
}
if (!(rsession = switch_core_session_locate(uuid))) {
stream->write_function(stream, "-ERR Cannot locate session!\n");
goto done;
}
channel = switch_core_session_get_channel(rsession);
channel = switch_core_session_get_channel(rsession);
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_cv_bug_"))) {
if (!zstr(action)) {
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_cv_bug_"))) {
if (!zstr(action)) {
if (!strcasecmp(action, "stop")) {
switch_channel_set_private(channel, "_cv_bug_", NULL);
switch_core_media_bug_remove(rsession, &bug);
@ -1279,42 +1279,42 @@ SWITCH_STANDARD_API(cv_bug_api_function)
stream->write_function(stream, "-ERR Invalid action\n");
}
goto done;
}
}
if (!zstr(action) && strcasecmp(action, "start")) {
goto usage;
}
if (!zstr(action) && strcasecmp(action, "start")) {
goto usage;
}
context = (cv_context_t *) switch_core_session_alloc(rsession, sizeof(*context));
assert(context != NULL);
context->session = rsession;
context = (cv_context_t *) switch_core_session_alloc(rsession, sizeof(*context));
assert(context != NULL);
context->session = rsession;
init_context(context);
parse_params(context, 2, argc, argv);
switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock);
if ((status = switch_core_media_bug_add(rsession, "cv_bug", NULL, cv_bug_callback, context, 0, SMBF_READ_VIDEO_PING, &bug)) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Failure!\n");
if ((status = switch_core_media_bug_add(rsession, "cv_bug", NULL, cv_bug_callback, context, 0, SMBF_READ_VIDEO_PING, &bug)) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Failure!\n");
switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock);
goto done;
} else {
switch_channel_set_private(channel, "_cv_bug_", bug);
stream->write_function(stream, "+OK Success\n");
goto done;
}
goto done;
} else {
switch_channel_set_private(channel, "_cv_bug_", bug);
stream->write_function(stream, "+OK Success\n");
goto done;
}
usage:
stream->write_function(stream, "-USAGE: %s\n", CV_BUG_API_SYNTAX);
stream->write_function(stream, "-USAGE: %s\n", CV_BUG_API_SYNTAX);
done:
if (rsession) {
switch_core_session_rwunlock(rsession);
}
if (rsession) {
switch_core_session_rwunlock(rsession);
}
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}
///////
@ -1323,24 +1323,24 @@ SWITCH_STANDARD_API(cv_bug_api_function)
SWITCH_MODULE_LOAD_FUNCTION(mod_cv_load)
{
switch_application_interface_t *app_interface;
switch_api_interface_t *api_interface;
switch_api_interface_t *api_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
MODULE_INTERFACE = *module_interface;
MODULE_INTERFACE = *module_interface;
SWITCH_ADD_APP(app_interface, "cv", "", "", cv_start_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "cv", "", "", cv_start_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "cv_bug", "connect cv", "connect cv",
cv_bug_start_function, "[</path/to/haar.xml>]", SAF_NONE);
SWITCH_ADD_APP(app_interface, "cv_bug", "connect cv", "connect cv",
cv_bug_start_function, "[</path/to/haar.xml>]", SAF_NONE);
SWITCH_ADD_API(api_interface, "cv_bug", "cv_bug", cv_bug_api_function, CV_BUG_API_SYNTAX);
SWITCH_ADD_API(api_interface, "cv_bug", "cv_bug", cv_bug_api_function, CV_BUG_API_SYNTAX);
switch_console_set_complete("add cv_bug ::console::list_uuid ::[start:stop");
switch_console_set_complete("add cv_bug ::console::list_uuid ::[start:stop");
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cv_shutdown)
@ -1348,13 +1348,15 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cv_shutdown)
return SWITCH_STATUS_UNLOAD;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -779,7 +779,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_oreka_shutdown)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -466,7 +466,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_soundtouch_load)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -878,7 +878,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -164,7 +164,7 @@ switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const c
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -862,7 +862,7 @@ void mod_spandsp_dsp_shutdown(void)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -2359,7 +2359,7 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -1444,7 +1444,7 @@ void modem_global_shutdown(void)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -165,7 +165,7 @@ void modem_global_shutdown(void);
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -259,7 +259,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_stress_shutdown)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -1508,7 +1508,7 @@ switch_status_t FSMediaStream::write_frame(const switch_frame_t *frame, switch_i
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -322,7 +322,7 @@ class FSConnection : public OpalLocalConnection
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:

View File

@ -1165,12 +1165,12 @@ static void default_logger(const char *file, const char *func, int line, int lev
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/