#include <HlsMediaPlaylist.h>
Definition at line 24 of file HlsMediaPlaylist.h.
◆ HlsMediaPlaylist() [1/2]
MBMS_RT::HlsMediaPlaylist::HlsMediaPlaylist |
( |
const std::string & |
content | ) |
|
Definition at line 24 of file HlsMediaPlaylist.cpp.
26 spdlog::debug(
"Parsing HLS media playlist: {}", content);
28 std::istringstream iss(content);
32 for (std::string line; std::getline(iss, line); idx++ )
34 boost::algorithm::trim(line);
37 if ( line !=
"#EXTM3U") {
38 throw(
"HLS playlist parsing failed: first line is not #EXTM3U");
44 size_t cpos = line.rfind(
':');
46 if (line.rfind(
"#EXT-X-VERSION", 0) == 0) {
48 throw(
"HLS playlist parsing failed: duplicate #EXT-X-VERSION");
50 if (cpos != std::string::npos) {
51 _version = atoi(line.substr(cpos+1).c_str());
53 }
else if (line.rfind(
"#EXT-X-TARGETDURATION", 0) == 0) {
54 if (cpos != std::string::npos) {
57 }
else if (line.rfind(
"#EXT-X-MEDIA-SEQUENCE", 0) == 0) {
58 if (cpos != std::string::npos) {
59 seq_nr = atoi(line.substr(cpos+1).c_str());
61 }
else if (line.rfind(
"#EXTINF", 0) == 0) {
62 if (cpos != std::string::npos) {
63 extinf = atof(line.substr(cpos+1).c_str());
65 }
else if (line.rfind(
'#', 0) == 0) {
66 spdlog::debug(
"HLS playlist parser ignoring unhandled line {}", line);
67 }
else if (line.size() > 0) {
68 _segments.push_back({line, seq_nr++, extinf});
◆ HlsMediaPlaylist() [2/2]
MBMS_RT::HlsMediaPlaylist::HlsMediaPlaylist |
( |
| ) |
|
|
default |
◆ ~HlsMediaPlaylist()
MBMS_RT::HlsMediaPlaylist::~HlsMediaPlaylist |
( |
| ) |
|
|
default |
◆ add_segment()
void MBMS_RT::HlsMediaPlaylist::add_segment |
( |
Segment |
segment | ) |
|
|
inline |
◆ segments()
const std::vector<Segment>& MBMS_RT::HlsMediaPlaylist::segments |
( |
| ) |
const |
|
inline |
◆ set_target_duration()
void MBMS_RT::HlsMediaPlaylist::set_target_duration |
( |
int |
duration | ) |
|
|
inline |
◆ target_duration()
int MBMS_RT::HlsMediaPlaylist::target_duration |
( |
| ) |
const |
|
inline |
◆ to_string()
auto MBMS_RT::HlsMediaPlaylist::to_string |
( |
| ) |
const |
Definition at line 74 of file HlsMediaPlaylist.cpp.
78 pl <<
"#EXTM3U" << std::endl;
79 pl <<
"#EXT-X-VERSION:3" << std::endl;
83 pl <<
"#EXT-X-MEDIA-SEQUENCE:" <<
_segments[0].seq << std::endl;
86 pl <<
"#EXTINF:" << seg.extinf << std::endl;
87 pl <<
"/" << seg.uri << std::endl;
89 return std::move(pl.str());
◆ _segments
std::vector<Segment> MBMS_RT::HlsMediaPlaylist::_segments = {} |
|
private |
◆ _targetduration
int MBMS_RT::HlsMediaPlaylist::_targetduration |
|
private |
◆ _version
int MBMS_RT::HlsMediaPlaylist::_version = -1 |
|
private |
The documentation for this class was generated from the following files: