From 26afb604c6c2372bfc9a4776bacad845a3f2db35 Mon Sep 17 00:00:00 2001
From: Yann Diorcet <yann.diorcet@belledonne-communications.com>
Date: Mon, 25 Jun 2012 16:23:24 +0200
Subject: [PATCH] Add msfilter-add-fmtp command

---
 daemon/Makefile.am                   | 40 +++++++++++++++-------------
 daemon/commands/msfilter-add-fmtp.cc | 19 +++++++++++++
 daemon/commands/msfilter-add-fmtp.h  | 12 +++++++++
 daemon/daemon.cc                     |  2 ++
 4 files changed, 54 insertions(+), 19 deletions(-)
 create mode 100644 daemon/commands/msfilter-add-fmtp.cc
 create mode 100644 daemon/commands/msfilter-add-fmtp.h

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 59ff068a2c..30c417681c 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -15,6 +15,7 @@ linphone_daemon_SOURCES=daemon.cc \
 			commands/call-stats.cc \
 			commands/call-status.cc \
 			commands/help.cc \
+			commands/msfilter-add-fmtp.cc \
 			commands/pop-event.cc \
 			commands/ptime.cc \
 			commands/register.cc \
@@ -23,25 +24,26 @@ linphone_daemon_SOURCES=daemon.cc \
 			commands/unregister.cc \
 			commands/quit.cc \
 			daemon.h \
-                        commands/answer.h \
-                        commands/audio-codec-disable.h \
-                        commands/audio-codec-enable.h \
-                        commands/audio-codec-get.h \
-                        commands/audio-codec-move.h \
-                        commands/audio-codec-set.h \
-                        commands/audio-stream-start.h \
-                        commands/audio-stream-stop.h \
-                        commands/call.h \
-                        commands/call-stats.h \
-                        commands/call-status.h \
-                        commands/help.h \
-                        commands/pop-event.h \
-                        commands/ptime.h \
-                        commands/register.h \
-                        commands/register-status.h \
-                        commands/terminate.h \
-                        commands/unregister.h \
-                        commands/quit.h
+			commands/answer.h \
+			commands/audio-codec-disable.h \
+			commands/audio-codec-enable.h \
+			commands/audio-codec-get.h \
+			commands/audio-codec-move.h \
+			commands/audio-codec-set.h \
+			commands/audio-stream-start.h \
+			commands/audio-stream-stop.h \
+			commands/call.h \
+			commands/call-stats.h \
+			commands/call-status.h \
+			commands/help.h \
+			commands/msfilter-add-fmtp.h \
+			commands/pop-event.h \
+			commands/ptime.h \
+			commands/register.h \
+			commands/register-status.h \
+			commands/terminate.h \
+			commands/unregister.h \
+			commands/quit.h
 
 linphone_daemon_pipetest_SOURCES=daemon-pipetest.c
 
diff --git a/daemon/commands/msfilter-add-fmtp.cc b/daemon/commands/msfilter-add-fmtp.cc
new file mode 100644
index 0000000000..41e0c104fa
--- /dev/null
+++ b/daemon/commands/msfilter-add-fmtp.cc
@@ -0,0 +1,19 @@
+#include "msfilter-add-fmtp.h"
+#include <mediastreamer2/msfilter.h>
+#include <private.h>
+
+using namespace std;
+
+MSFilterAddFmtpCommand::MSFilterAddFmtpCommand() :
+		DaemonCommand("msfilter-add-fmtp", "msfilter-add-fmtp <fmtp>", "Add fmtp to current encoder") {
+}
+
+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;
+	}
+	ms_filter_call_method(call->audiostream->encoder, MS_FILTER_ADD_FMTP, (void*) args);
+}
diff --git a/daemon/commands/msfilter-add-fmtp.h b/daemon/commands/msfilter-add-fmtp.h
new file mode 100644
index 0000000000..c7a5b01b59
--- /dev/null
+++ b/daemon/commands/msfilter-add-fmtp.h
@@ -0,0 +1,12 @@
+#ifndef COMMAND_MSFILTER_ADD_FMTP
+#define COMMAND_MSFILTER_ADD_FMTP
+
+#include "../daemon.h"
+
+class MSFilterAddFmtpCommand : public DaemonCommand {
+public:
+	MSFilterAddFmtpCommand();
+	virtual void exec(Daemon *app, const char *args);
+};
+
+#endif /* COMMAND_MSFILTER_ADD_FMTP */
diff --git a/daemon/daemon.cc b/daemon/daemon.cc
index 0bee63c3f3..cfdc3a114c 100644
--- a/daemon/daemon.cc
+++ b/daemon/daemon.cc
@@ -22,6 +22,7 @@
 #include "commands/call-stats.h"
 #include "commands/call-status.h"
 #include "commands/help.h"
+#include "commands/msfilter-add-fmtp.h"
 #include "commands/pop-event.h"
 #include "commands/ptime.h"
 #include "commands/register.h"
@@ -297,6 +298,7 @@ void Daemon::initCommands() {
 	mCommands.push_back(new AudioCodecSetCommand());
 	mCommands.push_back(new AudioStreamStartCommand());
 	mCommands.push_back(new AudioStreamStopCommand());
+	mCommands.push_back(new MSFilterAddFmtpCommand());
 	mCommands.push_back(new PtimeCommand());
 	mCommands.push_back(new QuitCommand());
 	mCommands.push_back(new HelpCommand());
-- 
GitLab