agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 1 | /** |
Sébastien Blin | cb783e3 | 2021-02-12 11:34:10 -0500 | [diff] [blame] | 2 | * Copyright (C) 2020-2021 Savoir-faire Linux Inc. |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 3 | * |
| 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 | */ |
agsantos | 520da84 | 2020-12-01 16:39:06 -0500 | [diff] [blame] | 20 | |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 21 | #include <iostream> |
| 22 | #include <string.h> |
| 23 | #include <thread> |
| 24 | #include <memory> |
| 25 | #include <plugin/jamiplugin.h> |
| 26 | |
agsantos | 82678f3 | 2020-12-09 15:03:24 -0500 | [diff] [blame] | 27 | #include "FilterMediaHandler.h" |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 28 | |
| 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 | |
| 39 | extern "C" { |
| 40 | |
| 41 | void |
| 42 | pluginExit(void) |
| 43 | {} |
| 44 | |
| 45 | EXPORT_PLUGIN JAMI_PluginExitFunc |
| 46 | JAMI_dynPluginInit(const JAMI_PluginAPI* api) |
| 47 | { |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 48 | std::cout << "*******************" << std::endl; |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 49 | std::cout << "** AudioFilter **" << std::endl; |
agsantos | 520da84 | 2020-12-01 16:39:06 -0500 | [diff] [blame] | 50 | std::cout << "*******************" << std::endl << std::endl; |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 51 | std::cout << "Version " << AudioFilter_VERSION_MAJOR << "." << AudioFilter_VERSION_MINOR << "." |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 52 | << AudioFilter_VERSION_PATCH << std::endl; |
| 53 | |
| 54 | // If invokeService doesn't return an error |
| 55 | if (api) { |
agsantos | 82678f3 | 2020-12-09 15:03:24 -0500 | [diff] [blame] | 56 | std::map<std::string, std::string> preferences; |
| 57 | api->invokeService(api, "getPluginPreferences", &preferences); |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 58 | std::string dataPath; |
| 59 | api->invokeService(api, "getPluginDataPath", &dataPath); |
| 60 | |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 61 | auto fmpFilterMediaHandler = std::make_unique<jami::FilterMediaHandler>(std::move( |
| 62 | preferences), |
agsantos | 520da84 | 2020-12-01 16:39:06 -0500 | [diff] [blame] | 63 | std::move(dataPath)); |
agsantos | 82678f3 | 2020-12-09 15:03:24 -0500 | [diff] [blame] | 64 | if (api->manageComponent(api, "CallMediaHandlerManager", fmpFilterMediaHandler.release())) { |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 65 | return nullptr; |
| 66 | } |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 67 | } |
| 68 | return pluginExit; |
| 69 | } |
| 70 | } |