提交 4c5125b5 authored 作者: Nimrod Astrahan's avatar Nimrod Astrahan

FS-7549 #resolve

Added an API for removing an active ladspa effect on a channel. For conformance reasons, the uuid_ladspa command now accepts 'stop' and 'start', while the previous functionality (without any verb) which will simply add ladspa remains intact.
上级 27510397
......@@ -583,15 +583,18 @@ SWITCH_STANDARD_APP(ladspa_run_function)
#define API_SYNTAX "<uuid>|<flags>|<plugin>|<label>|<params>"
#define API_SYNTAX "<uuid> [start|stop] <flags>|<plugin>|<label>|<params>"
SWITCH_STANDARD_API(ladspa_api)
{
char *uuid = NULL;
char *data;
char *p;
char *data = NULL;
char *p, *action;
switch_core_session_t *ksession = NULL;
if (!cmd) goto err;
if (!cmd) {
stream->write_function(stream, "-ERR Operation Failed\n");
goto done;
}
data = strdup(cmd);
......@@ -599,24 +602,32 @@ SWITCH_STANDARD_API(ladspa_api)
uuid = data;
*p++ = '\0';
if ((ksession = switch_core_session_locate(uuid))) {
ladspa_parse(ksession, p);
if (!(ksession = switch_core_session_locate(uuid))) {
stream->write_function(stream, "-ERR non-existant UUID\n");
goto done;
}
if ((action = strstr(cmd, "stop"))) {
stop_ladspa_session(ksession);
switch_core_session_rwunlock(ksession);
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "-ERR non-existant UUID\n");
goto done;
} else if ((action = strstr(cmd, "start"))) {
// Advance past 'start' conditional keyword and move on
p += 5 * sizeof(char);
*p++ = '\0';
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Tried to remove 'start' and now the string is \"%s\"\n", p);
}
ladspa_parse(ksession, p);
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "-ERR Usage %s\n", API_SYNTAX);
}
free(data);
return SWITCH_STATUS_SUCCESS;
}
err:
done:
stream->write_function(stream, "-ERR Operation Failed\n");
switch_safe_free(data);
return SWITCH_STATUS_SUCCESS;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论