19 #include <boost/algorithm/string/split.hpp>
20 #include <boost/algorithm/string/classification.hpp>
27 #include "spdlog/spdlog.h"
28 #include "gmime/gmime.h"
32 spdlog::debug(
"Service name added: {} ({})", name, lang);
37 spdlog::debug(
"service: master manifest contents:\n{}, base path {}", manifest, base_path);
45 _delivery_protocol ==
DeliveryProtocol::HLS ? base_path +
"manifest.m3u8" : base_path +
"manifest.mpd",
46 _cache.add_item(std::make_shared<CachedPlaylist>(
49 [&]() ->
const std::string & {
50 spdlog::debug(
"Service: master manifest requested");
58 spdlog::debug(
"adding stream with playlist path {}", s->playlist_path());
60 for (
const auto &stream: _hls_primary_playlist.streams()) {
61 if (stream.uri == s->playlist_path()) {
62 spdlog::debug(
"matched hls entry with uri {}", stream.uri);
63 s->set_resolution(stream.resolution);
64 s->set_codecs(stream.codecs);
65 s->set_bandwidth(stream.bandwidth);
66 s->set_frame_rate(stream.frame_rate);
70 _content_streams[s->playlist_path()] = s;
76 for (
const auto &stream: _content_streams) {
78 "/" + stream.second->playlist_path(),
80 stream.second->codecs(),
81 stream.second->bandwidth(),
82 stream.second->frame_rate()
88 _manifest = _dash_manifest.content;
94 std::vector<std::string> strs;
95 boost::split(strs, mime_type, boost::is_any_of(
";"));
96 std::string adjusted_mime_type = strs.front();
100 spdlog::info(
"Setting delivery type {} from MIME type {}", _delivery_protocol ==
DeliveryProtocol::HLS ?
"HLS" : (
void add_stream(Stream stream)
std::string to_string() const
void add_name(const std::string &name, const std::string &lang)
void set_delivery_protocol_from_mime_type(const std::string &mime_type)
void read_master_manifest(const std::string &manifest, const std::string &base_path)
void add_and_start_content_stream(std::shared_ptr< ContentStream > s)