agsantos | 5aa3965 | 2020-08-11 18:18:04 -0400 | [diff] [blame^] | 1 | /** |
| 2 | * Copyright (C) 2020 Savoir-faire Linux Inc. |
| 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> |
| 25 | #include <plugin/jamiplugin.h> |
| 26 | #include "pluginMediaHandler.h" |
| 27 | |
| 28 | #ifdef WIN32 |
| 29 | #define EXPORT_PLUGIN __declspec (dllexport) |
| 30 | #else |
| 31 | #define EXPORT_PLUGIN |
| 32 | #endif |
| 33 | |
| 34 | #define GreenScreen_VERSION_MAJOR 1 |
| 35 | #define GreenScreen_VERSION_MINOR 0 |
| 36 | |
| 37 | extern "C" |
| 38 | { |
| 39 | void pluginExit(void) { } |
| 40 | |
| 41 | EXPORT_PLUGIN JAMI_PluginExitFunc |
| 42 | JAMI_dynPluginInit(const JAMI_PluginAPI* api) |
| 43 | { |
| 44 | std::cout << "**************************" << std::endl << std::endl; |
| 45 | std::cout << "** GREENSCREEN PLUGIN **" << std::endl; |
| 46 | std::cout << "**************************" << std::endl << std::endl; |
| 47 | std::cout << " Version " << GreenScreen_VERSION_MAJOR << "." << GreenScreen_VERSION_MINOR << std::endl; |
| 48 | |
| 49 | // If invokeService doesn't return an error |
| 50 | if(api) |
| 51 | { |
| 52 | std::map<std::string, std::string> ppm; |
| 53 | api->invokeService(api, "getPluginPreferences", &ppm); |
| 54 | std::string dataPath; |
| 55 | api->invokeService(api, "getPluginDataPath", &dataPath); |
| 56 | auto fmp = std::make_unique<jami::PluginMediaHandler>(std::move(ppm), std::move(dataPath)); |
| 57 | |
| 58 | if(!api->manageComponent(api,"CallMediaHandlerManager", fmp.release())) { |
| 59 | return pluginExit; |
| 60 | } |
| 61 | } |
| 62 | return nullptr; |
| 63 | } |
| 64 | } |