blob: bc4a479ba96809056b6f448d6af619da7c1ed629 [file] [log] [blame]
agsantos5aa39652020-08-11 18:18:04 -04001/**
Sébastien Blincb783e32021-02-12 11:34:10 -05002 * Copyright (C) 2020-2021 Savoir-faire Linux Inc.
agsantos5aa39652020-08-11 18:18:04 -04003 *
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
agsantosac1940d2020-09-17 10:18:40 -040018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA.
agsantos5aa39652020-08-11 18:18:04 -040020 */
21
22#pragma once
23
agsantos5aa39652020-08-11 18:18:04 -040024#include "videoSubscriber.h"
25
agsantosdd6a62a2021-03-29 17:13:27 -040026#include <plugin/jamiplugin.h>
27#include <plugin/mediahandler.h>
agsantos5aa39652020-08-11 18:18:04 -040028
29using avSubjectPtr = std::weak_ptr<jami::Observable<AVFrame*>>;
30
31namespace jami {
32
agsantosac1940d2020-09-17 10:18:40 -040033class PluginMediaHandler : public jami::CallMediaHandler
34{
agsantos5aa39652020-08-11 18:18:04 -040035public:
agsantos82678f32020-12-09 15:03:24 -050036 PluginMediaHandler(std::map<std::string, std::string>&& preferences, std::string&& dataPath);
agsantosc9181b42020-11-26 12:03:04 -050037 ~PluginMediaHandler();
agsantos5aa39652020-08-11 18:18:04 -040038
agsantosac1940d2020-09-17 10:18:40 -040039 virtual void notifyAVFrameSubject(const StreamData& data, avSubjectPtr subject) override;
40 virtual std::map<std::string, std::string> getCallMediaHandlerDetails() override;
agsantos5aa39652020-08-11 18:18:04 -040041
agsantosac1940d2020-09-17 10:18:40 -040042 virtual void detach() override;
43 virtual void setPreferenceAttribute(const std::string& key, const std::string& value) override;
44 virtual bool preferenceMapHasKey(const std::string& key) override;
agsantos5aa39652020-08-11 18:18:04 -040045
agsantosac1940d2020-09-17 10:18:40 -040046 std::shared_ptr<VideoSubscriber> mVS;
agsantos364bbae2020-08-17 11:29:56 -040047
agsantos5aa39652020-08-11 18:18:04 -040048private:
agsantosdd6a62a2021-03-29 17:13:27 -040049 const std::string dataPath_;
agsantos82678f32020-12-09 15:03:24 -050050 std::map<std::string, std::string> preferences_;
agsantosc9181b42020-11-26 12:03:04 -050051 std::string attached_ {'0'};
agsantos5aa39652020-08-11 18:18:04 -040052};
agsantosac1940d2020-09-17 10:18:40 -040053} // namespace jami