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