7 #ifndef PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
8 #define PACKAGER_MEDIA_FORMATS_MP4_FRAGMENTER_H_
13 #include <absl/log/check.h>
14 #include <absl/log/log.h>
16 #include <packager/macros/classes.h>
17 #include <packager/status.h>
29 struct SegmentReference;
40 Fragmenter(std::shared_ptr<const StreamInfo> info,
42 int64_t edit_list_offset);
63 void ClearFragmentFinalized() { fragment_finalized_ =
false; }
65 int64_t fragment_duration()
const {
return fragment_duration_; }
66 int64_t first_sap_time()
const {
return first_sap_time_; }
67 int64_t earliest_presentation_time()
const {
68 return earliest_presentation_time_;
70 bool fragment_initialized()
const {
return fragment_initialized_; }
71 bool fragment_finalized()
const {
return fragment_finalized_; }
73 const std::vector<KeyFrameInfo>& key_frame_infos()
const {
74 return key_frame_infos_;
87 Status FinalizeFragmentForEncryption();
89 bool StartsWithSAP()
const;
91 std::shared_ptr<const StreamInfo> stream_info_;
93 int64_t edit_list_offset_ = 0;
94 int64_t seek_preroll_ = 0;
95 bool fragment_initialized_ =
false;
96 bool fragment_finalized_ =
false;
97 int64_t fragment_duration_ = 0;
98 int64_t earliest_presentation_time_ = 0;
99 int64_t first_sap_time_ = 0;
100 std::unique_ptr<BufferWriter> data_;
102 std::vector<KeyFrameInfo> key_frame_infos_;
107 template <
typename T>
111 DCHECK(default_value);
112 DCHECK(!entries->empty());
114 typename std::vector<T>::const_iterator it = entries->begin();
116 for (; it < entries->end(); ++it)
122 *default_value = value;
All the methods that are virtual are virtual for mocking.