9 #ifndef PACKAGER_MPD_BASE_REPRESENTATION_H_ 10 #define PACKAGER_MPD_BASE_REPRESENTATION_H_ 12 #include "packager/mpd/base/bandwidth_estimator.h" 13 #include "packager/mpd/base/media_info.pb.h" 14 #include "packager/mpd/base/segment_info.h" 15 #include "packager/mpd/base/xml/scoped_xml_ptr.h" 24 struct ContentProtectionElement;
29 class RepresentationXmlNode;
41 virtual void OnNewSegmentForRepresentation(uint64_t start_time,
42 uint64_t duration) = 0;
48 virtual void OnSetFrameRateForRepresentation(uint32_t frame_duration,
49 uint32_t timescale) = 0;
59 kSuppressFrameRate = 4,
79 virtual void AddContentProtectionElement(
93 virtual void UpdateContentProtectionPssh(
const std::string& drm_uuid,
94 const std::string& pssh);
104 virtual void AddNewSegment(uint64_t start_time,
113 virtual void SetSampleDuration(uint32_t sample_duration);
116 virtual const MediaInfo& GetMediaInfo()
const;
119 xml::scoped_xml_ptr<xmlNode> GetXml();
129 void SuppressOnce(SuppressFlag flag);
132 void SetPresentationTimeOffset(
double presentation_time_offset);
142 bool GetStartAndEndTimestamps(
double* start_timestamp_seconds,
143 double* end_timestamp_seconds)
const;
146 uint32_t
id()
const {
return id_; }
148 void set_media_info(
const MediaInfo& media_info) { media_info_ = media_info; }
160 const MediaInfo& media_info,
162 uint32_t representation_id,
163 std::unique_ptr<RepresentationStateChangeListener> state_change_listener);
170 std::unique_ptr<RepresentationStateChangeListener> state_change_listener);
177 friend class RepresentationTest;
181 bool HasRequiredMediaInfoFields()
const;
185 void AddSegmentInfo(uint64_t start_time, uint64_t duration);
190 bool ApproximiatelyEqual(uint64_t time1, uint64_t time2)
const;
194 uint64_t AdjustDuration(uint64_t duration)
const;
201 void RemoveSegments(uint64_t start_time,
203 uint64_t num_segments);
207 std::string GetVideoMimeType()
const;
208 std::string GetAudioMimeType()
const;
209 std::string GetTextMimeType()
const;
213 MediaInfo media_info_;
214 std::list<ContentProtectionElement> content_protection_elements_;
216 std::list<SegmentInfo> segment_infos_;
219 std::list<std::string> segments_to_be_removed_;
222 std::string mime_type_;
229 uint32_t start_number_ = 1;
233 std::unique_ptr<RepresentationStateChangeListener> state_change_listener_;
236 int output_suppression_flags_ = 0;
240 const bool allow_approximate_segment_timeline_ =
false;
243 uint32_t frame_duration_ = 0;
248 #endif // PACKAGER_MPD_BASE_REPRESENTATION_H_
All the methods that are virtual are virtual for mocking.