9 #ifndef PACKAGER_MPD_BASE_ADAPTATION_SET_H_
10 #define PACKAGER_MPD_BASE_ADAPTATION_SET_H_
20 #include <packager/mpd/base/xml/xml_node.h>
21 #include "packager/mpd/base/media_info.pb.h"
28 struct ContentProtectionElement;
50 kRoleEnhancedAudioIntelligibility,
100 const std::string& pssh);
107 const std::string& value);
113 virtual void AddRole(Role role);
119 std::optional<xml::XmlNode>
GetXml();
144 bool has_id()
const {
return static_cast<bool>(id_); }
148 return index_.has_value() ? index_ : id_;
152 uint32_t id()
const {
return id_.value(); }
186 int32_t frame_duration,
194 const std::list<Representation*> GetRepresentations()
const;
200 const std::string&
codec()
const {
return codec_; }
226 return transfer_characteristics_;
237 return protected_content_;
251 bool content_protection_in_adaptation_set);
267 uint32_t* representation_counter);
274 friend class AdaptationSetTest;
283 enum SegmentAligmentStatus {
284 kSegmentAlignmentUnknown,
285 kSegmentAlignmentTrue,
286 kSegmentAlignmentFalse
295 typedef std::map<uint32_t, std::list<int64_t>> RepresentationTimeline;
298 void UpdateFromMediaInfo(
const MediaInfo& media_info);
308 void CheckDynamicSegmentAlignment(uint32_t representation_id,
314 void CheckStaticSegmentAlignment();
317 void RecordFrameRate(int32_t frame_duration, int32_t timescale);
319 std::list<ContentProtectionElement> content_protection_elements_;
322 std::map<uint32_t, std::unique_ptr<Representation>> representation_map_;
324 uint32_t*
const representation_counter_;
326 std::optional<uint32_t> id_;
327 const std::string language_;
328 const MpdOptions& mpd_options_;
331 std::vector<const AdaptationSet*> switchable_adaptation_sets_;
336 std::set<uint32_t> video_widths_;
337 std::set<uint32_t> video_heights_;
345 std::map<double, std::string> video_frame_rates_;
349 std::string content_type_;
362 std::set<std::string> picture_aspect_ratio_;
365 struct Accessibility {
369 std::vector<Accessibility> accessibilities_;
372 std::set<Role> roles_;
375 SegmentAligmentStatus segments_aligned_ = kSegmentAlignmentUnknown;
376 bool force_set_segment_alignment_ =
false;
379 uint8_t subsegment_start_with_sap_ = 0;
382 uint8_t start_with_sap_ = 0;
391 RepresentationTimeline representation_segment_start_times_;
397 std::vector<const AdaptationSet*> trick_play_references_;
400 uint32_t matrix_coefficients_ = 0;
402 uint32_t color_primaries_ = 0;
405 uint32_t transfer_characteristics_ = 0;
408 std::optional<uint32_t> index_;
414 MediaInfo::ProtectedContent* protected_content_;
uint32_t transfer_characteristics() const
void OnNewSegmentForRepresentation(uint32_t representation_id, int64_t start_time, int64_t duration)
virtual Representation * AddRepresentation(const MediaInfo &media_info)
virtual void AddAccessibility(const std::string &scheme, const std::string &value)
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
virtual void ForceStartwithSAP(uint32_t sap_value)
virtual void ForceSetSegmentAlignment(bool segment_alignment)
const std::string & codec() const
void OnSetFrameRateForRepresentation(uint32_t representation_id, int32_t frame_duration, int32_t timescale)
virtual Representation * CopyRepresentation(const Representation &representation)
void set_matrix_coefficients(const uint32_t &matrix_coefficients)
void set_color_primaries(const uint32_t &color_primaries)
virtual void ForceSubsegmentStartswithSAP(uint32_t sap_value)
bool MatchAdaptationSet(const MediaInfo &media_info, bool content_protection_in_adaptation_set)
virtual void AddTrickPlayReference(const AdaptationSet *adaptation_set)
virtual void AddAdaptationSetSwitching(const AdaptationSet *adaptation_set)
std::optional< uint32_t > SortIndex() const
std::optional< xml::XmlNode > GetXml()
AdaptationSet(const std::string &language, const MpdOptions &mpd_options, uint32_t *representation_counter)
uint32_t color_primaries() const
const MediaInfo::ProtectedContent * protected_content() const
Return ProtectedContent.
void set_protected_content(const MediaInfo &media_info)
uint32_t matrix_coefficients() const
void set_transfer_characteristics(const uint32_t &transfer_characteristics)
void set_codec(const std::string &codec)
bool SwitchableAdaptationSet(const AdaptationSet &adaptation_set)
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
virtual void AddRole(Role role)
All the methods that are virtual are virtual for mocking.