blob: 4e924f00d3c7f3a316dea39f9847ff6fa53a21c4 [file] [log] [blame]
agsantosd09cc6d2020-11-06 17:34:46 -05001/**
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
27#include "CenterCircleMediaHandler.h"
28#include "CoinCircleMediaHandler.h"
29
30#ifdef WIN32
31#define EXPORT_PLUGIN __declspec(dllexport)
32#else
33#define EXPORT_PLUGIN
34#endif
agsantosc9181b42020-11-26 12:03:04 -050035
agsantosd09cc6d2020-11-06 17:34:46 -050036#define HelloWorld_VERSION_MAJOR 1
37#define HelloWorld_VERSION_MINOR 0
agsantosc9181b42020-11-26 12:03:04 -050038#define HelloWorld_VERSION_PATCH 1
39
agsantosd09cc6d2020-11-06 17:34:46 -050040extern "C" {
41void
42pluginExit(void)
43{}
44
45EXPORT_PLUGIN JAMI_PluginExitFunc
46JAMI_dynPluginInit(const JAMI_PluginAPI* api)
47{
agsantos520da842020-12-01 16:39:06 -050048 std::cout << "******************" << std::endl << std::endl;
agsantosd09cc6d2020-11-06 17:34:46 -050049 std::cout << "** HelloWorld **" << std::endl;
agsantos520da842020-12-01 16:39:06 -050050 std::cout << "******************" << std::endl << std::endl;
agsantosd09cc6d2020-11-06 17:34:46 -050051 std::cout << " Version " << HelloWorld_VERSION_MAJOR << "." << HelloWorld_VERSION_MINOR << "."
52 << HelloWorld_VERSION_PATCH << std::endl;
53
54 // If invokeService doesn't return an error
55 if (api) {
56 std::map<std::string, std::string> ppm;
57 api->invokeService(api, "getPluginPreferences", &ppm);
58 std::string dataPath;
59 api->invokeService(api, "getPluginDataPath", &dataPath);
60
61 auto fmpCenterCircleMediaHandler
62 = std::make_unique<jami::CenterCircleMediaHandler>(std::move(ppm), std::move(dataPath));
63 if (api->manageComponent(api,
64 "CallMediaHandlerManager",
65 fmpCenterCircleMediaHandler.release())) {
66 return nullptr;
67 }
68
69 auto fmpCoinCircleMediaHandler
70 = std::make_unique<jami::CoinCircleMediaHandler>(std::move(ppm), std::move(dataPath));
71 if (api->manageComponent(api,
72 "CallMediaHandlerManager",
73 fmpCoinCircleMediaHandler.release())) {
74 return nullptr;
75 }
76 }
77 return pluginExit;
78}
79}