SkyWay for Linux
読み取り中…
検索中…
一致する文字列を見つけられません
domain.hpp
1//
2// domain.hpp
3// skyway
4//
5// Created by sandabu on 2021/12/21.
6// Copyright © 2021 NTT Communications. All rights reserved.
7//
8
9#ifndef SKYWAY_MODEL_DOMAIN_HPP_
10#define SKYWAY_MODEL_DOMAIN_HPP_
11
12#include <boost/optional.hpp>
13#include <json.hpp>
14
15namespace skyway {
16namespace model {
17
18enum class Side { kLocal, kRemote };
19enum class MemberType { kPerson, kBot };
20enum class ContentType { kAudio, kVideo, kData };
21
22std::string ToString(Side side);
23std::string ToString(MemberType type);
24std::string ToString(ContentType type);
25
26boost::optional<Side> ToSide(const std::string& side);
27boost::optional<MemberType> ToMemberType(const std::string& type);
28boost::optional<ContentType> ToContentType(const std::string& type);
29
31struct Codec {
33 struct Parameters {
34 boost::optional<bool> use_dtx;
35 };
37 std::string mime_type;
40};
41
43struct Encoding {
45 boost::optional<std::string> id;
47 boost::optional<int> max_bitrate;
49 boost::optional<double> scale_resolution_down_by;
51 boost::optional<double> max_framerate;
52};
54struct Member {
56 struct Init {
58 MemberType type;
60 std::string subtype;
62 boost::optional<std::string> name;
64 boost::optional<std::string> metadata;
66 boost::optional<int> keepalive_interval_sec;
68 boost::optional<int> keepalive_interval_gap_sec;
69 };
71 std::string id;
73 boost::optional<std::string> name;
75 MemberType type;
77 std::string subtype;
79 boost::optional<std::string> metadata;
80 // the `name` can be retrieved from `init` but set the value returned by server.
81 Member() {}
82 Member(const std::string& id, const boost::optional<std::string>& name, const Init& init) {
83 this->id = id;
84 this->name = name;
85 type = init.type;
86 subtype = init.subtype;
87 metadata = init.metadata;
88 }
89};
90
93 struct Init {
94 std::string channel_id;
95 std::string publisher_id;
96 ContentType content_type;
97 boost::optional<std::string> origin;
98 boost::optional<std::string> metadata;
99 std::vector<Codec> codec_capabilities = {};
100 std::vector<Encoding> encodings = {};
101 bool is_enabled;
102 };
104 std::string id;
106 std::string publisher_id;
108 boost::optional<std::string> origin;
110 ContentType content_type;
112 boost::optional<std::string> metadata;
114 std::vector<Codec> codec_capabilities;
116 std::vector<Encoding> encodings;
119 Publication() {}
120 Publication(const std::string& id, const Init& init) {
121 this->id = id;
122 publisher_id = init.publisher_id;
123 origin = init.origin;
124 content_type = init.content_type;
125 metadata = init.metadata;
126 codec_capabilities = init.codec_capabilities;
127 encodings = init.encodings;
128 is_enabled = init.is_enabled;
129 }
130};
131
134 struct Init {
135 std::string channel_id;
136 std::string publication_id;
137 std::string subscriber_id;
138 bool is_enabled;
139 };
141 std::string id;
143 std::string publication_id;
145 std::string subscriber_id;
148 Subscription() {}
149 Subscription(const std::string& id, const Init& init) {
150 this->id = id;
151 publication_id = init.publication_id;
152 subscriber_id = init.subscriber_id;
153 is_enabled = init.is_enabled;
154 }
155};
156
158struct Channel {
160 struct Init {
162 boost::optional<std::string> name;
164 boost::optional<std::string> metadata;
165 };
167 struct Query {
169 boost::optional<std::string> name;
171 boost::optional<std::string> id;
172 };
174 std::string id;
176 boost::optional<std::string> name;
178 boost::optional<std::string> metadata;
180 std::vector<Member> members;
182 std::vector<Publication> publications;
184 std::vector<Subscription> subscriptions;
186 uint64_t version;
187};
188
191struct [[deprecated]] WebRTCStatsReport {
193 std::string id;
195 std::string type;
197 std::unordered_map<std::string, nlohmann::json> params;
198};
199
202struct [[deprecated]] WebRTCStats {
204 std::vector<WebRTCStatsReport> reports;
205};
206
207void from_json(const nlohmann::json& j, Codec& codec);
208void from_json(const nlohmann::json& j, Encoding& encoding);
209void from_json(const nlohmann::json& j, Channel& channel);
210void from_json(const nlohmann::json& j, Member& member);
211void from_json(const nlohmann::json& j, Publication& publication);
212void from_json(const nlohmann::json& j, Subscription& subscription);
214[[deprecated]] void from_json(const nlohmann::json& j, WebRTCStats& stats);
215
216void to_json(nlohmann::json& j, const Codec& codec);
217void to_json(nlohmann::json& j, const Encoding& encoding);
218
219} // namespace model
220} // namespace skyway
221
222#endif /* SKYWAY_MODEL_DOMAIN_HPP_ */
CreateもしくはFindOrCreateで指定する情報
Definition domain.hpp:160
boost::optional< std::string > metadata
ChannelのMetadata
Definition domain.hpp:164
boost::optional< std::string > name
Channelの名前
Definition domain.hpp:162
FindもしくはFindOrCreateで指定する情報
Definition domain.hpp:167
boost::optional< std::string > name
Channelの名前
Definition domain.hpp:169
boost::optional< std::string > id
ChannelのId
Definition domain.hpp:171
Channel情報
Definition domain.hpp:158
boost::optional< std::string > metadata
Metadata
Definition domain.hpp:178
std::string id
Id
Definition domain.hpp:174
std::vector< Member > members
このChannelの存在するメンバーの一覧
Definition domain.hpp:180
std::vector< Subscription > subscriptions
このChannelの存在するSubscriptionの一覧
Definition domain.hpp:184
boost::optional< std::string > name
名前
Definition domain.hpp:176
std::vector< Publication > publications
このChannelの存在するPublicationの一覧
Definition domain.hpp:182
uint64_t version
バージョン
Definition domain.hpp:186
Dtxオプションを適応するかのオプション
Definition domain.hpp:33
コーデック情報
Definition domain.hpp:31
std::string mime_type
mimetype
Definition domain.hpp:37
Parameters parameters
パラメーター
Definition domain.hpp:39
エンコーディング設定
Definition domain.hpp:43
boost::optional< double > scale_resolution_down_by
解像度の倍率
Definition domain.hpp:49
boost::optional< double > max_framerate
最大フレームレート
Definition domain.hpp:51
boost::optional< int > max_bitrate
最大ビットレート
Definition domain.hpp:47
boost::optional< std::string > id
Id
Definition domain.hpp:45
Join時に使用するメンバー情報
Definition domain.hpp:56
boost::optional< std::string > metadata
Metadata
Definition domain.hpp:64
boost::optional< int > keepalive_interval_gap_sec
生存確認の間隔を超えてChannelからMemberが削除されるまでの時間
Definition domain.hpp:68
std::string subtype
サブタイプ
Definition domain.hpp:60
boost::optional< std::string > name
名前
Definition domain.hpp:62
boost::optional< int > keepalive_interval_sec
生存確認の間隔
Definition domain.hpp:66
MemberType type
種類
Definition domain.hpp:58
メンバー情報
Definition domain.hpp:54
boost::optional< std::string > metadata
Metadata
Definition domain.hpp:79
std::string subtype
サブタイプ
Definition domain.hpp:77
MemberType type
種類
Definition domain.hpp:75
boost::optional< std::string > name
名前
Definition domain.hpp:73
std::string id
Id
Definition domain.hpp:71
Definition domain.hpp:93
Publication情報
Definition domain.hpp:92
boost::optional< std::string > metadata
Metadata
Definition domain.hpp:112
std::string publisher_id
PublishしたメンバーのId
Definition domain.hpp:106
std::vector< Encoding > encodings
エンコーディング一覧
Definition domain.hpp:116
std::string id
Id
Definition domain.hpp:104
ContentType content_type
コンテンツの種類
Definition domain.hpp:110
std::vector< Codec > codec_capabilities
コーデック一覧
Definition domain.hpp:114
bool is_enabled
有効か無効か
Definition domain.hpp:118
boost::optional< std::string > origin
Origin
Definition domain.hpp:108
Definition domain.hpp:134
Subscription情報
Definition domain.hpp:133
std::string publication_id
このSubscriptionに紐づくPublicationのId
Definition domain.hpp:143
std::string subscriber_id
このSubscriptionをSubscribeしているメンバーのId
Definition domain.hpp:145
std::string id
Id
Definition domain.hpp:141
bool is_enabled
有効か無効か
Definition domain.hpp:147
統計情報
Definition domain.hpp:202
std::vector< WebRTCStatsReport > reports
統計情報の一覧
Definition domain.hpp:204
統計情報の詳細
Definition domain.hpp:191
std::string id
Id
Definition domain.hpp:193
std::unordered_map< std::string, nlohmann::json > params
各パラメーターに対応するJson
Definition domain.hpp:197
std::string type
種類
Definition domain.hpp:195