mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 06:08:07 +00:00
Improve msfilter-add-fmtp command
This commit is contained in:
parent
26afb604c6
commit
ad48fe0098
1 changed files with 25 additions and 7 deletions
|
|
@ -5,15 +5,33 @@
|
|||
using namespace std;
|
||||
|
||||
MSFilterAddFmtpCommand::MSFilterAddFmtpCommand() :
|
||||
DaemonCommand("msfilter-add-fmtp", "msfilter-add-fmtp <fmtp>", "Add fmtp to current encoder") {
|
||||
DaemonCommand("msfilter-add-fmtp", "msfilter-add-fmtp <call/stream> <id> <fmtp>", "Add fmtp to the encoder of a call or a stream") {
|
||||
}
|
||||
|
||||
void MSFilterAddFmtpCommand::exec(Daemon *app, const char *args) {
|
||||
LinphoneCore *lc = app->getCore();
|
||||
LinphoneCall *call = linphone_core_get_current_call(lc);
|
||||
if (call == NULL) {
|
||||
app->sendResponse(Response("No current call available."));
|
||||
return;
|
||||
char type[256], fmtp[256];
|
||||
int id;
|
||||
|
||||
if (sscanf(args, "%255s %d %255s", type, &id, fmtp) == 3) {
|
||||
if(strcmp(type, "call") == 0) {
|
||||
LinphoneCall *call = app->findCall(id);
|
||||
if (call == NULL) {
|
||||
app->sendResponse(Response("No Call with such id."));
|
||||
return;
|
||||
}
|
||||
ms_filter_call_method(call->audiostream->encoder, MS_FILTER_ADD_FMTP, (void*) args);
|
||||
} else if(strcmp(type, "stream") == 0) {
|
||||
AudioStream *stream = app->findAudioStream(id);
|
||||
if (stream == NULL) {
|
||||
app->sendResponse(Response("No Audio Stream with such id."));
|
||||
return;
|
||||
}
|
||||
ms_filter_call_method(stream->encoder, MS_FILTER_ADD_FMTP, (void*) args);
|
||||
} else {
|
||||
app->sendResponse(Response("Incorrect parameter(s)."));
|
||||
}
|
||||
app->sendResponse(Response());
|
||||
} else {
|
||||
app->sendResponse(Response("Missing/Incorrect parameter(s)."));
|
||||
}
|
||||
ms_filter_call_method(call->audiostream->encoder, MS_FILTER_ADD_FMTP, (void*) args);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue