9 #ifndef PACKAGER_MPD_BASE_REPRESENTATION_H_
10 #define PACKAGER_MPD_BASE_REPRESENTATION_H_
17 #include <packager/mpd/base/bandwidth_estimator.h>
18 #include <packager/mpd/base/media_info.pb.h>
19 #include <packager/mpd/base/segment_info.h>
20 #include <packager/mpd/base/xml/xml_node.h>
24 struct ContentProtectionElement;
37 int64_t duration) = 0;
44 int32_t timescale) = 0;
54 kSuppressFrameRate = 4,
89 const std::string& pssh);
106 int64_t segment_number);
129 std::optional<xml::XmlNode>
GetXml();
161 double* end_timestamp_seconds)
const;
164 uint32_t
id()
const {
return id_; }
166 void set_media_info(
const MediaInfo& media_info) { media_info_ = media_info; }
178 const MediaInfo& media_info,
179 const MpdOptions& mpd_options,
180 uint32_t representation_id,
181 std::unique_ptr<RepresentationStateChangeListener> state_change_listener);
188 std::unique_ptr<RepresentationStateChangeListener> state_change_listener);
194 friend class AdaptationSet;
195 friend class RepresentationTest;
199 bool HasRequiredMediaInfoFields()
const;
203 void AddSegmentInfo(int64_t start_time,
205 int64_t segment_number);
210 void UpdateSegmentInfo(int64_t duration);
215 bool ApproximiatelyEqual(int64_t time1, int64_t time2)
const;
219 int64_t AdjustDuration(int64_t duration)
const;
226 void RemoveOldSegment(SegmentInfo* segment_info);
230 std::string GetVideoMimeType()
const;
231 std::string GetAudioMimeType()
const;
232 std::string GetTextMimeType()
const;
235 std::string RepresentationAsString()
const;
239 MediaInfo media_info_;
240 std::list<ContentProtectionElement> content_protection_elements_;
242 int64_t current_buffer_depth_ = 0;
244 std::list<SegmentInfo> segment_infos_;
247 std::list<std::string> segments_to_be_removed_;
250 std::string mime_type_;
252 std::string supplemental_codecs_;
253 std::string supplemental_profiles_;
254 BandwidthEstimator bandwidth_estimator_;
255 const MpdOptions& mpd_options_;
259 std::unique_ptr<RepresentationStateChangeListener> state_change_listener_;
262 int output_suppression_flags_ = 0;
266 const bool allow_approximate_segment_timeline_ =
false;
269 int32_t frame_duration_ = 0;
virtual void OnSetFrameRateForRepresentation(int32_t frame_duration, int32_t timescale)=0
virtual void OnNewSegmentForRepresentation(int64_t start_time, int64_t duration)=0
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
virtual void AddNewSegment(int64_t start_time, int64_t duration, uint64_t size, int64_t segment_number)
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
virtual void UpdateCompletedSegment(int64_t duration, uint64_t size)
void SuppressOnce(SuppressFlag flag)
virtual const MediaInfo & GetMediaInfo() const
void SetAvailabilityTimeOffset()
virtual void SetSampleDuration(int32_t sample_duration)
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)
std::optional< xml::XmlNode > GetXml()
void SetPresentationTimeOffset(double presentation_time_offset)
Set @presentationTimeOffset in SegmentBase / SegmentTemplate.
void SetSegmentDuration()
All the methods that are virtual are virtual for mocking.