libmpd++
DASH MPD parsing and manipulation library
 
Loading...
Searching...
No Matches
SegmentList.hh
Go to the documentation of this file.
1#ifndef _BBC_PARSE_DASH_MPD_SEGMENT_LIST_HH_
2#define _BBC_PARSE_DASH_MPD_SEGMENT_LIST_HH_
3/*****************************************************************************
4 * DASH MPD parsing library in C++: SegmentList class
5 *****************************************************************************
6 * Copyright: (C) 2025 British Broadcasting Corporation
7 * Author(s): David Waring <david.waring2@bbc.co.uk>
8 * License: LGPLv3
9 *
10 * For full license terms please see the LICENSE file distributed with this
11 * library or refer to: https://www.gnu.org/licenses/lgpl-3.0.txt.
12 */
13#include <optional>
14
15#include "macros.hh"
17#include "SegmentURL.hh"
18#include "XLink.hh"
19
22// Forward declarations for types only used by pointer or reference
23namespace xmlpp {
24 class Element;
25 class Node;
26}
29
31
32class Period;
33class AdaptationSet;
34class Representation;
35
42public:
44
47 ,m_xLink()
48 ,m_segmentURLs()
49 {};
52 ,m_xLink(other.m_xLink)
53 ,m_segmentURLs(other.m_segmentURLs)
54 {};
56 :MultipleSegmentBase(std::move(other))
57 ,m_xLink(std::move(other.m_xLink))
58 ,m_segmentURLs(std::move(other.m_segmentURLs))
59 {};
60
61 virtual ~SegmentList() {};
62
65 m_xLink = other.m_xLink;
66 m_segmentURLs = other.m_segmentURLs;
67 return *this;
68 }
70 MultipleSegmentBase::operator=(std::move(other));
71 m_xLink = std::move(other.m_xLink);
72 m_segmentURLs = std::move(other.m_segmentURLs);
73 return *this;
74 }
75
76 bool operator==(const SegmentList &other) const {
77 if (m_xLink.has_value() != other.m_xLink.has_value()) return false;
78 if (m_xLink && !(m_xLink.value() == other.m_xLink.value())) return false;
79 if (m_segmentURLs != other.m_segmentURLs) return false;
81 };
82
83 bool hasXLink() const { return m_xLink.has_value(); };
84 const std::optional<XLink> &xLink() const { return m_xLink; };
85 SegmentList &xLink(const std::nullopt_t&) { m_xLink.reset(); return *this; };
86 SegmentList &xLink(const XLink &val) { m_xLink = val; return *this; };
87 SegmentList &xLink(XLink &&val) { m_xLink = std::move(val); return *this; };
88
89 const std::list<SegmentURL> &segmentURLs() const { return m_segmentURLs; };
90 std::list<SegmentURL>::const_iterator segmentURLsBegin() const { return m_segmentURLs.cbegin(); };
91 std::list<SegmentURL>::const_iterator segmentURLsEnd() const { return m_segmentURLs.cend(); };
92 std::list<SegmentURL>::iterator segmentURLsBegin() { return m_segmentURLs.begin(); };
93 std::list<SegmentURL>::iterator segmentURLsEnd() { return m_segmentURLs.end(); };
94 SegmentList &segmentURLAdd(const SegmentURL &val) { m_segmentURLs.push_back(val); return *this; };
95 SegmentList &segmentURLAdd(SegmentURL &&val) { m_segmentURLs.push_back(std::move(val)); return *this; };
96 SegmentList &segmentURLRemove(const SegmentURL &val) { m_segmentURLs.remove(val); return *this; };
97 SegmentList &segmentURLRemove(const std::list<SegmentURL>::const_iterator &it) { m_segmentURLs.erase(it); return *this; };
98 SegmentList &segmentURLRemove(const std::list<SegmentURL>::iterator &it) { m_segmentURLs.erase(it); return *this; };
99
100 const std::string &getMediaURLForSegment(unsigned long segment_number) const;
101 const std::string &getMediaURLForSegmentTime(unsigned long time) const;
102 const std::string &getMediaURLForSegmentTime(const duration_type &time) const;
103 const std::string &getInitializationURL() const;
104
106protected:
107 friend class Period;
108 friend class Representation;
109 friend class AdaptationSet;
110 SegmentList(xmlpp::Node&);
111 void setXMLElement(xmlpp::Element&) const;
113
114private:
115 // SegmentList derived from XML schema in ISO 23009-1:2022 Clause 5.3.9.3.3
116 // Attributes
117 std::optional<XLink> m_xLink;
118 // Elements
119 std::list<SegmentURL> m_segmentURLs;
120};
121
123
124/* vim:ts=8:sts=4:sw=4:expandtab:
125 */
126#endif /*_BBC_PARSE_DASH_MPD_SEGMENT_LIST_HH_*/
AdaptationSet class.
Definition AdaptationSet.hh:60
bool operator==(const MultipleSegmentBase &other) const
MultipleSegmentBase & operator=(const MultipleSegmentBase &other)
SegmentBase::duration_type duration_type
Definition MultipleSegmentBase.hh:41
Definition Period.hh:53
Definition Representation.hh:55
bool operator==(const SegmentList &other) const
Definition SegmentList.hh:76
SegmentList(SegmentList &&other)
Definition SegmentList.hh:55
SegmentList & operator=(const SegmentList &other)
Definition SegmentList.hh:63
std::list< SegmentURL >::iterator segmentURLsEnd()
Definition SegmentList.hh:93
SegmentList & segmentURLRemove(const std::list< SegmentURL >::const_iterator &it)
Definition SegmentList.hh:97
MultipleSegmentBase::duration_type duration_type
Definition SegmentList.hh:43
SegmentList & xLink(const std::nullopt_t &)
Definition SegmentList.hh:85
std::list< SegmentURL >::const_iterator segmentURLsBegin() const
Definition SegmentList.hh:90
bool hasXLink() const
Definition SegmentList.hh:83
SegmentList & xLink(const XLink &val)
Definition SegmentList.hh:86
const std::string & getMediaURLForSegmentTime(unsigned long time) const
virtual ~SegmentList()
Definition SegmentList.hh:61
const std::list< SegmentURL > & segmentURLs() const
Definition SegmentList.hh:89
SegmentList & segmentURLAdd(const SegmentURL &val)
Definition SegmentList.hh:94
const std::string & getMediaURLForSegment(unsigned long segment_number) const
const std::optional< XLink > & xLink() const
Definition SegmentList.hh:84
SegmentList & segmentURLAdd(SegmentURL &&val)
Definition SegmentList.hh:95
std::list< SegmentURL >::const_iterator segmentURLsEnd() const
Definition SegmentList.hh:91
const std::string & getMediaURLForSegmentTime(const duration_type &time) const
std::list< SegmentURL >::iterator segmentURLsBegin()
Definition SegmentList.hh:92
SegmentList(const SegmentList &other)
Definition SegmentList.hh:50
SegmentList & segmentURLRemove(const std::list< SegmentURL >::iterator &it)
Definition SegmentList.hh:98
SegmentList & segmentURLRemove(const SegmentURL &val)
Definition SegmentList.hh:96
const std::string & getInitializationURL() const
SegmentList()
Definition SegmentList.hh:45
SegmentList & xLink(XLink &&val)
Definition SegmentList.hh:87
SegmentList & operator=(SegmentList &&other)
Definition SegmentList.hh:69
Definition SegmentURL.hh:37
#define LIBMPDPP_NAMESPACE_END
Definition macros.hh:54
#define LIBMPDPP_PUBLIC_API
Used to mark something as part of the public API.
Definition macros.hh:21
#define LIBMPDPP_NAMESPACE_BEGIN
Definition macros.hh:50
Definition SegmentAvailability.hh:87