agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [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 | 5aa3965 | 2020-08-11 18:18:04 -0400 | [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 | */ |
| 20 | |
| 21 | #include <iostream> |
| 22 | #include <string.h> |
| 23 | #include <thread> |
| 24 | #include <memory> |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 25 | |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 26 | #include <plugin/jamiplugin.h> |
| 27 | #include "pluginMediaHandler.h" |
| 28 | |
| 29 | #ifdef WIN32 |
agsantos | ac1940d | 2020-09-17 10:18:40 -0400 | [diff] [blame] | 30 | #define EXPORT_PLUGIN __declspec(dllexport) |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 31 | #else |
| 32 | #define EXPORT_PLUGIN |
| 33 | #endif |
| 34 | |
agsantos | dd6a62a | 2021-03-29 17:13:27 -0400 | [diff] [blame] | 35 | #define GreenScreen_VERSION_MAJOR 2 |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 36 | #define GreenScreen_VERSION_MINOR 0 |
agsantos | dd6a62a | 2021-03-29 17:13:27 -0400 | [diff] [blame] | 37 | #define GreenScreen_VERSION_PATCH 0 |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 38 | |
agsantos | ac1940d | 2020-09-17 10:18:40 -0400 | [diff] [blame] | 39 | extern "C" { |
| 40 | void |
| 41 | pluginExit(void) |
| 42 | {} |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 43 | |
| 44 | EXPORT_PLUGIN JAMI_PluginExitFunc |
| 45 | JAMI_dynPluginInit(const JAMI_PluginAPI* api) |
| 46 | { |
agsantos | dd6a62a | 2021-03-29 17:13:27 -0400 | [diff] [blame] | 47 | std::cout << "*******************" << std::endl; |
| 48 | std::cout << "** GREENSCREEN **" << std::endl; |
| 49 | std::cout << "*******************" << std::endl << std::endl; |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 50 | std::cout << "Version " << GreenScreen_VERSION_MAJOR << "." << GreenScreen_VERSION_MINOR << "." |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 51 | << GreenScreen_VERSION_PATCH << std::endl; |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 52 | |
| 53 | // If invokeService doesn't return an error |
agsantos | ac1940d | 2020-09-17 10:18:40 -0400 | [diff] [blame] | 54 | if (api) { |
agsantos | 82678f3 | 2020-12-09 15:03:24 -0500 | [diff] [blame] | 55 | std::map<std::string, std::string> preferences; |
| 56 | api->invokeService(api, "getPluginPreferences", &preferences); |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 57 | std::string dataPath; |
| 58 | api->invokeService(api, "getPluginDataPath", &dataPath); |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 59 | auto fmp = std::make_unique<jami::PluginMediaHandler>(std::move(preferences), |
| 60 | std::move(dataPath)); |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 61 | |
agsantos | ac1940d | 2020-09-17 10:18:40 -0400 | [diff] [blame] | 62 | if (!api->manageComponent(api, "CallMediaHandlerManager", fmp.release())) { |
agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame] | 63 | return pluginExit; |
| 64 | } |
| 65 | } |
| 66 | return nullptr; |
| 67 | } |
| 68 | } |