11 #ifndef MPD_BASE_MPD_BUILDER_H_
12 #define MPD_BASE_MPD_BUILDER_H_
20 #include <libxml/tree.h>
22 #include <packager/macros/classes.h>
23 #include <packager/mpd/base/mpd_options.h>
24 #include <packager/mpd/base/xml/xml_node.h>
25 #include <packager/utils/clock.h>
60 [[nodiscard]]
virtual bool ToString(std::string* output);
68 MediaInfo* media_info);
73 clock_ = std::move(clock);
82 friend class LiveMpdBuilderTest;
83 template <DashProfile profile>
84 friend class MpdBuilderTest;
89 std::optional<xml::XmlNode> GenerateMpd();
93 [[nodiscard]]
bool AddCommonMpdInfo(
xml::XmlNode* mpd_node);
97 [[nodiscard]]
bool AddStaticMpdInfo(
xml::XmlNode* mpd_node);
100 [[nodiscard]]
bool AddDynamicMpdInfo(
xml::XmlNode* mpd_node);
103 [[nodiscard]]
bool AddUtcTiming(
xml::XmlNode* mpd_node);
105 float GetStaticMpdDuration();
113 [[nodiscard]]
bool GetEarliestTimestamp(
double* timestamp_seconds);
116 void UpdatePeriodDurationAndPresentationTimestamp();
119 std::list<std::unique_ptr<Period>> periods_;
121 std::list<std::string> base_urls_;
122 std::string availability_start_time_;
124 uint32_t period_counter_ = 0;
125 uint32_t representation_counter_ = 0;
129 std::unique_ptr<Clock> clock_;
This class generates DASH MPDs (Media Presentation Descriptions).
static void MakePathsRelativeToMpd(const std::string &mpd_path, MediaInfo *media_info)
MpdBuilder(const MpdOptions &mpd_options)
void AddBaseUrl(const std::string &base_url)
virtual Period * GetOrCreatePeriod(double start_time_in_seconds)
void InjectClockForTesting(std::unique_ptr< Clock > clock)
This is for testing.
virtual bool ToString(std::string *output)
All the methods that are virtual are virtual for mocking.