blob: 406c7ced48889b3568cc71413b10dc6bb886bfc7 [file] [log] [blame]
agsantos5aa39652020-08-11 18:18:04 -04001/**
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>
agsantosc9181b42020-11-26 12:03:04 -050025
agsantos5aa39652020-08-11 18:18:04 -040026#include <plugin/jamiplugin.h>
27#include "pluginMediaHandler.h"
28
29#ifdef WIN32
agsantosac1940d2020-09-17 10:18:40 -040030#define EXPORT_PLUGIN __declspec(dllexport)
agsantos5aa39652020-08-11 18:18:04 -040031#else
32#define EXPORT_PLUGIN
33#endif
34
35#define GreenScreen_VERSION_MAJOR 1
36#define GreenScreen_VERSION_MINOR 0
agsantosc9181b42020-11-26 12:03:04 -050037#define GreenScreen_VERSION_PATCH 2
agsantos5aa39652020-08-11 18:18:04 -040038
agsantosac1940d2020-09-17 10:18:40 -040039extern "C" {
40void
41pluginExit(void)
42{}
agsantos5aa39652020-08-11 18:18:04 -040043
44EXPORT_PLUGIN JAMI_PluginExitFunc
45JAMI_dynPluginInit(const JAMI_PluginAPI* api)
46{
47 std::cout << "**************************" << std::endl << std::endl;
48 std::cout << "** GREENSCREEN PLUGIN **" << std::endl;
49 std::cout << "**************************" << std::endl << std::endl;
agsantosc9181b42020-11-26 12:03:04 -050050 std::cout << " Version " << GreenScreen_VERSION_MAJOR << "." << GreenScreen_VERSION_MINOR << "."
51 << GreenScreen_VERSION_PATCH << std::endl;
agsantos5aa39652020-08-11 18:18:04 -040052
53 // If invokeService doesn't return an error
agsantosac1940d2020-09-17 10:18:40 -040054 if (api) {
agsantos82678f32020-12-09 15:03:24 -050055 std::map<std::string, std::string> preferences;
56 api->invokeService(api, "getPluginPreferences", &preferences);
agsantos5aa39652020-08-11 18:18:04 -040057 std::string dataPath;
58 api->invokeService(api, "getPluginDataPath", &dataPath);
agsantos82678f32020-12-09 15:03:24 -050059 auto fmp = std::make_unique<jami::PluginMediaHandler>(std::move(preferences), std::move(dataPath));
agsantos5aa39652020-08-11 18:18:04 -040060
agsantosac1940d2020-09-17 10:18:40 -040061 if (!api->manageComponent(api, "CallMediaHandlerManager", fmp.release())) {
agsantos5aa39652020-08-11 18:18:04 -040062 return pluginExit;
63 }
64 }
65 return nullptr;
66}
67}