9 #ifndef PACKAGER_MEDIA_BASE_MUXER_H_
10 #define PACKAGER_MEDIA_BASE_MUXER_H_
15 #include "packager/base/time/clock.h"
16 #include "packager/media/base/media_handler.h"
17 #include "packager/media/base/muxer_options.h"
18 #include "packager/media/event/muxer_listener.h"
19 #include "packager/media/event/progress_listener.h"
20 #include "packager/status.h"
47 const std::vector<std::shared_ptr<const StreamInfo>>& streams()
const {
65 Status Process(std::unique_ptr<StreamData> stream_data)
override;
70 MuxerListener* muxer_listener() {
return muxer_listener_.get(); }
71 ProgressListener* progress_listener() {
return progress_listener_.get(); }
72 base::Clock* clock() {
return clock_; }
75 Muxer(
const Muxer&) =
delete;
76 Muxer& operator=(
const Muxer&) =
delete;
81 virtual Status InitializeMuxer() = 0;
84 virtual Status Finalize() = 0;
88 virtual Status AddMediaSample(
size_t stream_id,
const MediaSample& sample);
92 virtual Status AddTextSample(
size_t stream_id,
const TextSample& sample);
95 virtual Status FinalizeSegment(
97 const SegmentInfo& segment_info) = 0;
101 Status ReinitializeMuxer(int64_t timestamp);
103 MuxerOptions options_;
104 std::vector<std::shared_ptr<const StreamInfo>> streams_;
105 std::vector<uint8_t> current_key_id_;
106 bool encryption_started_ =
false;
107 bool cancelled_ =
false;
109 std::unique_ptr<MuxerListener> muxer_listener_;
110 std::unique_ptr<ProgressListener> progress_listener_;
112 base::Clock* clock_ =
nullptr;
116 std::string output_file_template_;
117 size_t output_file_index_ = 0;
123 #endif // PACKAGER_MEDIA_BASE_MUXER_H_