blob: 078e0a1fdd2db56b399fec838520867ae8fb8609 [file] [log] [blame]
agsantosc9181b42020-11-26 12:03:04 -05001/**
Sébastien Blincb783e32021-02-12 11:34:10 -05002 * Copyright (C) 2020-2021 Savoir-faire Linux Inc.
agsantosc9181b42020-11-26 12:03:04 -05003 *
4 * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
agsantos520da842020-12-01 16:39:06 -050020
agsantosc9181b42020-11-26 12:03:04 -050021#include <iostream>
22#include <string.h>
23#include <thread>
24#include <memory>
25#include <plugin/jamiplugin.h>
26
agsantos82678f32020-12-09 15:03:24 -050027#include "FilterMediaHandler.h"
agsantosc9181b42020-11-26 12:03:04 -050028
29#ifdef WIN32
30#define EXPORT_PLUGIN __declspec(dllexport)
31#else
32#define EXPORT_PLUGIN
33#endif
34
35#define AudioFilter_VERSION_MAJOR 0
36#define AudioFilter_VERSION_MINOR 1
37#define AudioFilter_VERSION_PATCH 0
38
39extern "C" {
40
41void
42pluginExit(void)
43{}
44
45EXPORT_PLUGIN JAMI_PluginExitFunc
46JAMI_dynPluginInit(const JAMI_PluginAPI* api)
47{
agsantos520da842020-12-01 16:39:06 -050048 std::cout << "*******************" << std::endl << std::endl;
agsantosc9181b42020-11-26 12:03:04 -050049 std::cout << "** AudioFilter **" << std::endl;
agsantos520da842020-12-01 16:39:06 -050050 std::cout << "*******************" << std::endl << std::endl;
agsantosc9181b42020-11-26 12:03:04 -050051 std::cout << " Version " << AudioFilter_VERSION_MAJOR << "." << AudioFilter_VERSION_MINOR << "."
52 << AudioFilter_VERSION_PATCH << std::endl;
53
54 // If invokeService doesn't return an error
55 if (api) {
agsantos82678f32020-12-09 15:03:24 -050056 std::map<std::string, std::string> preferences;
57 api->invokeService(api, "getPluginPreferences", &preferences);
agsantosc9181b42020-11-26 12:03:04 -050058 std::string dataPath;
59 api->invokeService(api, "getPluginDataPath", &dataPath);
60
agsantos82678f32020-12-09 15:03:24 -050061 auto fmpFilterMediaHandler = std::make_unique<jami::FilterMediaHandler>(std::move(preferences),
agsantos520da842020-12-01 16:39:06 -050062 std::move(dataPath));
agsantos82678f32020-12-09 15:03:24 -050063 if (api->manageComponent(api, "CallMediaHandlerManager", fmpFilterMediaHandler.release())) {
agsantosc9181b42020-11-26 12:03:04 -050064 return nullptr;
65 }
agsantosc9181b42020-11-26 12:03:04 -050066 }
67 return pluginExit;
68}
69}