9 #ifndef MEDIA_BASE_MUXER_H_
10 #define 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<StreamInfo>>& streams()
const {
65 Status
Process(std::unique_ptr<StreamData> stream_data)
override;
66 Status
OnFlushRequest(
size_t input_stream_index)
override {
return Finalize(); }
70 MuxerListener* muxer_listener() {
return muxer_listener_.get(); }
71 ProgressListener* progress_listener() {
return progress_listener_.get(); }
72 base::Clock* clock() {
return clock_; }
76 virtual Status InitializeMuxer() = 0;
79 virtual Status Finalize() = 0;
82 virtual Status AddSample(
size_t stream_id,
83 std::shared_ptr<MediaSample> sample) = 0;
86 virtual Status FinalizeSegment(
size_t stream_id,
87 std::shared_ptr<SegmentInfo> segment_info) = 0;
89 MuxerOptions options_;
90 std::vector<std::shared_ptr<StreamInfo>> streams_;
91 std::vector<uint8_t> current_key_id_;
92 bool encryption_started_ =
false;
95 std::unique_ptr<MuxerListener> muxer_listener_;
96 std::unique_ptr<ProgressListener> progress_listener_;
100 DISALLOW_COPY_AND_ASSIGN(Muxer);
106 #endif // MEDIA_BASE_MUXER_H_