Ring Daemon 16.0.0
Loading...
Searching...
No Matches
mediahandler.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include "streamdata.h"
20#include "observer.h"
21
22#include <string>
23#include <memory>
24#include <map>
25
26extern "C" {
27struct AVFrame;
28}
29
30namespace jami {
31
32using avSubjectPtr = std::shared_ptr<Observable<AVFrame*>>;
33
39{
40public:
41 virtual ~MediaHandler() = default;
42
46 std::string id() const { return id_; }
47
52 virtual void setId(const std::string& id) final { id_ = id; }
53
54private:
55 // Must be set with plugin's dataPath.
56 std::string id_;
57};
58
66{
67public:
73 virtual void notifyAVFrameSubject(const StreamData& data, avSubjectPtr subject) = 0;
74
83 virtual std::map<std::string, std::string> getCallMediaHandlerDetails() = 0;
84
88 virtual void detach() = 0;
89
96 virtual void setPreferenceAttribute(const std::string& key, const std::string& value) = 0;
97
104 virtual bool preferenceMapHasKey(const std::string& key) = 0;
105};
106} // namespace jami
This abstract class is an API we need to implement from plugin side.
virtual void detach()=0
Should detach the plugin data process (Observer).
virtual void setPreferenceAttribute(const std::string &key, const std::string &value)=0
If a preference can be changed without the need to reload the plugin, it should be done through this ...
virtual std::map< std::string, std::string > getCallMediaHandlerDetails()=0
Should return a map with handler's name, iconPath, pluginId, attached, and dataType.
virtual void notifyAVFrameSubject(const StreamData &data, avSubjectPtr subject)=0
Should attach a AVSubject (Observable) to the plugin data process (Observer).
virtual bool preferenceMapHasKey(const std::string &key)=0
If a preference can be changed without the need to reload the plugin, this function should return Tru...
It's the base object of the CallMediaHandler.
virtual void setId(const std::string &id) final
Should be called by the MediaHandler creator to set the plugins id_ variable with dataPath.
virtual ~MediaHandler()=default
std::string id() const
Returns the dataPath of the plugin that created this MediaHandler.
void emitSignal(Args... args)
Definition ring_signal.h:64
std::shared_ptr< Observable< AVFrame * > > avSubjectPtr
Contains information about an AV subject.
Definition streamdata.h:29