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/media/base/status.h"
37 explicit Demuxer(
const std::string& file_name);
44 void SetKeySource(std::unique_ptr<KeySource> key_source);
63 std::shared_ptr<MediaHandler> handler);
71 const std::string& language_override);
73 void set_dump_stream_info(
bool dump_stream_info) {
74 dump_stream_info_ = dump_stream_info;
82 return Status(error::INTERNAL_ERROR,
83 "Demuxer should not be the downstream handler.");
97 QueuedSample(uint32_t track_id, std::shared_ptr<MediaSample> sample);
101 std::shared_ptr<MediaSample> sample;
107 Status InitializeParser();
110 void ParserInitEvent(
const std::vector<std::shared_ptr<StreamInfo>>& streams);
114 bool NewSampleEvent(uint32_t track_id,
115 const std::shared_ptr<MediaSample>& sample);
117 bool PushSample(uint32_t track_id,
118 const std::shared_ptr<MediaSample>& sample);
123 std::string file_name_;
124 File* media_file_ =
nullptr;
126 bool all_streams_ready_ =
false;
128 std::deque<QueuedSample> queued_samples_;
129 std::unique_ptr<MediaParser> parser_;
131 std::map<uint32_t, size_t> track_id_to_stream_index_map_;
134 std::vector<size_t> stream_indexes_;
136 std::map<size_t, std::string> language_overrides_;
137 MediaContainerName container_name_ = CONTAINER_UNKNOWN;
138 std::unique_ptr<uint8_t[]> buffer_;
139 std::unique_ptr<KeySource> key_source_;
140 bool cancelled_ =
false;
142 bool dump_stream_info_ =
false;
143 Status init_event_status_;
149 #endif // MEDIA_BASE_DEMUXER_H_