9 #ifndef PACKAGER_MPD_BASE_REPRESENTATION_H_
10 #define PACKAGER_MPD_BASE_REPRESENTATION_H_
17 #include "packager/base/optional.h"
18 #include "packager/mpd/base/bandwidth_estimator.h"
19 #include "packager/mpd/base/media_info.pb.h"
20 #include "packager/mpd/base/segment_info.h"
21 #include "packager/mpd/base/xml/xml_node.h"
25 struct ContentProtectionElement;
38 int64_t duration) = 0;
45 uint32_t timescale) = 0;
55 kSuppressFrameRate = 4,
90 const std::string& pssh);
115 base::Optional<xml::XmlNode>
GetXml();
139 double* end_timestamp_seconds)
const;
142 uint32_t
id()
const {
return id_; }
144 void set_media_info(
const MediaInfo& media_info) { media_info_ = media_info; }
156 const MediaInfo& media_info,
157 const MpdOptions& mpd_options,
158 uint32_t representation_id,
159 std::unique_ptr<RepresentationStateChangeListener> state_change_listener);
166 std::unique_ptr<RepresentationStateChangeListener> state_change_listener);
172 friend class AdaptationSet;
173 friend class RepresentationTest;
177 bool HasRequiredMediaInfoFields()
const;
181 void AddSegmentInfo(int64_t start_time, int64_t duration);
186 bool ApproximiatelyEqual(int64_t time1, int64_t time2)
const;
190 int64_t AdjustDuration(int64_t duration)
const;
197 void RemoveOldSegment(SegmentInfo* segment_info);
201 std::string GetVideoMimeType()
const;
202 std::string GetAudioMimeType()
const;
203 std::string GetTextMimeType()
const;
206 std::string RepresentationAsString()
const;
210 MediaInfo media_info_;
211 std::list<ContentProtectionElement> content_protection_elements_;
213 int64_t current_buffer_depth_ = 0;
215 std::list<SegmentInfo> segment_infos_;
218 std::list<std::string> segments_to_be_removed_;
221 std::string mime_type_;
223 BandwidthEstimator bandwidth_estimator_;
224 const MpdOptions& mpd_options_;
228 uint32_t start_number_ = 1;
232 std::unique_ptr<RepresentationStateChangeListener> state_change_listener_;
235 int output_suppression_flags_ = 0;
239 const bool allow_approximate_segment_timeline_ =
false;
242 uint32_t frame_duration_ = 0;
virtual void OnSetFrameRateForRepresentation(uint32_t frame_duration, uint32_t timescale)=0
virtual void OnNewSegmentForRepresentation(int64_t start_time, int64_t duration)=0
virtual void SetSampleDuration(uint32_t sample_duration)
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
void SuppressOnce(SuppressFlag flag)
virtual const MediaInfo & GetMediaInfo() const
bool GetStartAndEndTimestamps(double *start_timestamp_seconds, double *end_timestamp_seconds) const
Representation(const MediaInfo &media_info, const MpdOptions &mpd_options, uint32_t representation_id, std::unique_ptr< RepresentationStateChangeListener > state_change_listener)
void SetPresentationTimeOffset(double presentation_time_offset)
Set @presentationTimeOffset in SegmentBase / SegmentTemplate.
base::Optional< xml::XmlNode > GetXml()
virtual void AddNewSegment(int64_t start_time, int64_t duration, uint64_t size)
All the methods that are virtual are virtual for mocking.