libmpd++
DASH MPD parsing and manipulation library
 
Loading...
Searching...
No Matches
SegmentURL.hh
Go to the documentation of this file.
1#ifndef _BBC_PARSE_DASH_MPD_SEGMENT_URL_HH_
2#define _BBC_PARSE_DASH_MPD_SEGMENT_URL_HH_
3/*****************************************************************************
4 * DASH MPD parsing library in C++: SegmentURL 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 <chrono>
14#include <optional>
15
16#include "macros.hh"
17#include "SingleRFC7233Range.hh"
18#include "URI.hh"
19
22// Forward declarations for types only used by pointer or reference
23namespace xmlpp {
24 class Element;
25 class Node;
26}
29
31
38public:
40 SegmentURL(const SegmentURL &other);
42
43 virtual ~SegmentURL() {};
44
47
48 bool operator==(const SegmentURL &other) const;
49
50 // @media
51 bool hasMedia() const { return m_media.has_value(); };
52 const std::optional<URI> &media() const { return m_media; };
53 SegmentURL &media(const std::nullopt_t&) { m_media.reset(); return *this; };
54 SegmentURL &media(const URI &val) { m_media = val; return *this; };
55 SegmentURL &media(URI &&val) { m_media = std::move(val); return *this; };
56
57 // @mediaRange
58 bool hasMediaRange() const { return m_mediaRange.has_value(); };
59 const std::optional<SingleRFC7233Range> &mediaRange() const { return m_mediaRange; };
60 SegmentURL &mediaRange(const std::nullopt_t&) { m_mediaRange.reset(); return *this; };
61 SegmentURL &mediaRange(const SingleRFC7233Range &val) { m_mediaRange = val; return *this; };
62 SegmentURL &mediaRange(SingleRFC7233Range &&val) { m_mediaRange = std::move(val); return *this; };
63
64 // @index
65 bool hasIndex() const { return m_index.has_value(); };
66 const std::optional<URI> &index() const { return m_index; };
67 SegmentURL &index(const std::nullopt_t&) { m_index.reset(); return *this; };
68 SegmentURL &index(const URI &val) { m_index = val; return *this; };
69 SegmentURL &index(URI &&val) { m_index = std::move(val); return *this; };
70
71 // @indexRange
72 bool hasIndexRange() const { return m_indexRange.has_value(); };
73 const std::optional<SingleRFC7233Range> &indexRange() const { return m_indexRange; };
74 SegmentURL &indexRange(const std::nullopt_t&) { m_indexRange.reset(); return *this; };
75 SegmentURL &indexRange(const SingleRFC7233Range &val) { m_indexRange = val; return *this; };
76 SegmentURL &indexRange(SingleRFC7233Range &&val) { m_indexRange = std::move(val); return *this; };
77
79protected:
80 friend class Period;
81 SegmentURL(xmlpp::Node&);
82 void setXMLElement(xmlpp::Element&) const;
84
85private:
86 // SegmentURL element from ISO 23009-1:2022 Clause 5.3.9.3.3
87 // Attributes
88 std::optional<URI> m_media;
89 std::optional<SingleRFC7233Range> m_mediaRange;
90 std::optional<URI> m_index;
91 std::optional<SingleRFC7233Range> m_indexRange;
92};
93
95
96/* vim:ts=8:sts=4:sw=4:expandtab:
97 */
98#endif /*_BBC_PARSE_DASH_MPD_SEGMENT_URL_HH_*/
Definition Period.hh:53
Definition SegmentURL.hh:37
SegmentURL & indexRange(const SingleRFC7233Range &val)
Definition SegmentURL.hh:75
SegmentURL & mediaRange(SingleRFC7233Range &&val)
Definition SegmentURL.hh:62
SegmentURL & operator=(const SegmentURL &other)
const std::optional< URI > & media() const
Definition SegmentURL.hh:52
SegmentURL & index(const URI &val)
Definition SegmentURL.hh:68
SegmentURL & mediaRange(const SingleRFC7233Range &val)
Definition SegmentURL.hh:61
SegmentURL & media(const URI &val)
Definition SegmentURL.hh:54
virtual ~SegmentURL()
Definition SegmentURL.hh:43
SegmentURL & index(URI &&val)
Definition SegmentURL.hh:69
bool hasIndex() const
Definition SegmentURL.hh:65
SegmentURL & media(const std::nullopt_t &)
Definition SegmentURL.hh:53
SegmentURL & indexRange(SingleRFC7233Range &&val)
Definition SegmentURL.hh:76
bool hasMedia() const
Definition SegmentURL.hh:51
SegmentURL & media(URI &&val)
Definition SegmentURL.hh:55
bool hasMediaRange() const
Definition SegmentURL.hh:58
const std::optional< SingleRFC7233Range > & mediaRange() const
Definition SegmentURL.hh:59
SegmentURL & mediaRange(const std::nullopt_t &)
Definition SegmentURL.hh:60
const std::optional< URI > & index() const
Definition SegmentURL.hh:66
bool operator==(const SegmentURL &other) const
SegmentURL & index(const std::nullopt_t &)
Definition SegmentURL.hh:67
const std::optional< SingleRFC7233Range > & indexRange() const
Definition SegmentURL.hh:73
SegmentURL & indexRange(const std::nullopt_t &)
Definition SegmentURL.hh:74
SegmentURL(const SegmentURL &other)
SegmentURL(SegmentURL &&other)
bool hasIndexRange() const
Definition SegmentURL.hh:72
SegmentURL & operator=(SegmentURL &&other)
Definition SingleRFC7233Range.hh:35
Definition URI.hh:40
#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