5G-MAG Reference Tools - MBMS Middleware
Service.h
Go to the documentation of this file.
1 // 5G-MAG Reference Tools
2 // MBMS Middleware Process
3 //
4 // Copyright (C) 2021 Klaus Kühnhammer (Österreichische Rundfunksender GmbH & Co KG)
5 //
6 // Licensed under the License terms and conditions for use, reproduction, and
7 // distribution of 5G-MAG software (the “License”). You may not use this file
8 // except in compliance with the License. You may obtain a copy of the License at
9 // https://www.5g-mag.com/reference-tools. Unless required by applicable law or
10 // agreed to in writing, software distributed under the License is distributed on
11 // an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 // or implied.
13 //
14 // See the License for the specific language governing permissions and limitations
15 // under the License.
16 //
17 #pragma once
18 
19 #include <string>
20 #include <thread>
21 #include <libconfig.h++>
22 #include "HlsPrimaryPlaylist.h"
23 #include "DashManifest.h"
24 #include "File.h"
25 #include "Receiver.h"
26 #include "ContentStream.h"
27 #include "DeliveryProtocols.h"
28 
29 namespace MBMS_RT {
30  class Service {
31  public:
33  : _cache(cache) {};
34  virtual ~Service() = default;
35 
36  void add_name(const std::string& name, const std::string& lang);
37  void add_and_start_content_stream(std::shared_ptr<ContentStream> s);
38  void read_master_manifest(const std::string& manifest, const std::string& base_path);
39 
40  const std::map<std::string, std::string>& names() const { return _names; };
41  const std::map<std::string, std::shared_ptr<ContentStream>>& content_streams() const { return _content_streams; };
42 
44  std::string delivery_protocol_string() const { return _delivery_protocol == DeliveryProtocol::HLS ? "HLS" :
45  (_delivery_protocol == DeliveryProtocol::DASH ? "DASH" : "RTP"); };
46  void set_delivery_protocol_from_mime_type(const std::string& mime_type);
47 
48  const std::string& manifest_path() const { return _manifest_path; };
49 
50  private:
53  std::map<std::string, std::shared_ptr<ContentStream>> _content_streams;
54  std::map<std::string, std::string> _names;
55 
58  std::string _manifest;
59  std::string _manifest_path;
60  };
61 }
std::map< std::string, std::shared_ptr< ContentStream > > _content_streams
Definition: Service.h:53
CacheManagement & _cache
Definition: Service.h:48
DashManifest _dash_manifest
Definition: Service.h:57
void add_name(const std::string &name, const std::string &lang)
Definition: Service.cpp:31
const std::string & manifest_path() const
Definition: Service.h:48
virtual ~Service()=default
const std::map< std::string, std::string > & names() const
Definition: Service.h:40
std::string _manifest_path
Definition: Service.h:59
DeliveryProtocol _delivery_protocol
Definition: Service.h:52
void set_delivery_protocol_from_mime_type(const std::string &mime_type)
Definition: Service.cpp:92
std::string delivery_protocol_string() const
Definition: Service.h:44
void read_master_manifest(const std::string &manifest, const std::string &base_path)
Definition: Service.cpp:36
HlsPrimaryPlaylist _hls_primary_playlist
Definition: Service.h:56
DeliveryProtocol delivery_protocol() const
Definition: Service.h:43
std::map< std::string, std::string > _names
Definition: Service.h:54
std::string _manifest
Definition: Service.h:58
const std::map< std::string, std::shared_ptr< ContentStream > > & content_streams() const
Definition: Service.h:41
Service(CacheManagement &cache)
Definition: Service.h:32
void add_and_start_content_stream(std::shared_ptr< ContentStream > s)
Definition: Service.cpp:56