7 #ifndef MEDIA_BASE_DEMUXER_H_
8 #define MEDIA_BASE_DEMUXER_H_
14 #include "packager/base/compiler_specific.h"
15 #include "packager/media/base/container_names.h"
16 #include "packager/media/base/media_handler.h"
17 #include "packager/status.h"
39 explicit Demuxer(
const std::string& file_name);
46 void SetKeySource(std::unique_ptr<KeySource> key_source);
64 Status
SetHandler(
const std::string& stream_label,
65 std::shared_ptr<MediaHandler> handler);
73 const std::string& language_override);
75 void set_dump_stream_info(
bool dump_stream_info) {
76 dump_stream_info_ = dump_stream_info;
83 Status
Process(std::unique_ptr<StreamData> stream_data)
override {
84 return Status(error::INTERNAL_ERROR,
85 "Demuxer should not be the downstream handler.");
99 QueuedSample(uint32_t track_id, std::shared_ptr<MediaSample> sample);
103 std::shared_ptr<MediaSample> sample;
109 Status InitializeParser();
112 void ParserInitEvent(
const std::vector<std::shared_ptr<StreamInfo>>& streams);
116 bool NewSampleEvent(uint32_t track_id,
117 const std::shared_ptr<MediaSample>& sample);
119 bool PushSample(uint32_t track_id,
120 const std::shared_ptr<MediaSample>& sample);
125 std::string file_name_;
126 File* media_file_ =
nullptr;
128 bool all_streams_ready_ =
false;
130 std::deque<QueuedSample> queued_samples_;
131 std::unique_ptr<MediaParser> parser_;
133 std::map<uint32_t, size_t> track_id_to_stream_index_map_;
136 std::vector<size_t> stream_indexes_;
138 std::map<size_t, std::string> language_overrides_;
139 MediaContainerName container_name_ = CONTAINER_UNKNOWN;
140 std::unique_ptr<uint8_t[]> buffer_;
141 std::unique_ptr<KeySource> key_source_;
142 bool cancelled_ =
false;
144 bool dump_stream_info_ =
false;
145 Status init_event_status_;
151 #endif // MEDIA_BASE_DEMUXER_H_