7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
8 #define PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
13 #include "packager/base/logging.h"
14 #include "packager/status.h"
26 struct SegmentReference;
37 Fragmenter(std::shared_ptr<const StreamInfo> info,
39 int64_t edit_list_offset);
60 void ClearFragmentFinalized() { fragment_finalized_ =
false; }
62 uint64_t fragment_duration()
const {
return fragment_duration_; }
63 uint64_t first_sap_time()
const {
return first_sap_time_; }
64 uint64_t earliest_presentation_time()
const {
65 return earliest_presentation_time_;
67 bool fragment_initialized()
const {
return fragment_initialized_; }
68 bool fragment_finalized()
const {
return fragment_finalized_; }
70 const std::vector<KeyFrameInfo>& key_frame_infos()
const {
71 return key_frame_infos_;
84 Status FinalizeFragmentForEncryption();
86 bool StartsWithSAP()
const;
88 std::shared_ptr<const StreamInfo> stream_info_;
90 int64_t edit_list_offset_ = 0;
91 int64_t seek_preroll_ = 0;
92 bool fragment_initialized_ =
false;
93 bool fragment_finalized_ =
false;
94 int64_t fragment_duration_ = 0;
95 int64_t earliest_presentation_time_ = 0;
96 int64_t first_sap_time_ = 0;
97 std::unique_ptr<BufferWriter> data_;
99 std::vector<KeyFrameInfo> key_frame_infos_;
104 template <
typename T>
108 DCHECK(default_value);
109 DCHECK(!entries->empty());
111 typename std::vector<T>::const_iterator it = entries->begin();
113 for (; it < entries->end(); ++it)
119 *default_value = value;
127 #endif // PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_