7 #ifndef PACKAGER_MEDIA_BASE_DEMUXER_H_ 8 #define PACKAGER_MEDIA_BASE_DEMUXER_H_ 14 #include "packager/base/compiler_specific.h" 15 #include "packager/media/base/container_names.h" 16 #include "packager/media/origin/origin_handler.h" 17 #include "packager/status.h" 38 explicit Demuxer(
const std::string& file_name);
45 void SetKeySource(std::unique_ptr<KeySource> key_source);
64 std::shared_ptr<MediaHandler> handler);
72 const std::string& language_override);
74 void set_dump_stream_info(
bool dump_stream_info) {
75 dump_stream_info_ = dump_stream_info;
83 return Status(error::INTERNAL_ERROR,
84 "Demuxer should not be the downstream handler.");
98 QueuedSample(uint32_t track_id, std::shared_ptr<MediaSample> sample);
102 std::shared_ptr<MediaSample> sample;
108 Status InitializeParser();
111 void ParserInitEvent(
const std::vector<std::shared_ptr<StreamInfo>>& streams);
115 bool NewSampleEvent(uint32_t track_id,
116 const std::shared_ptr<MediaSample>& sample);
118 bool PushSample(uint32_t track_id,
119 const std::shared_ptr<MediaSample>& sample);
124 std::string file_name_;
125 File* media_file_ =
nullptr;
127 bool all_streams_ready_ =
false;
129 std::deque<QueuedSample> queued_samples_;
130 std::unique_ptr<MediaParser> parser_;
132 std::map<uint32_t, size_t> track_id_to_stream_index_map_;
135 std::vector<size_t> stream_indexes_;
137 std::map<size_t, std::string> language_overrides_;
138 MediaContainerName container_name_ = CONTAINER_UNKNOWN;
139 std::unique_ptr<uint8_t[]> buffer_;
140 std::unique_ptr<KeySource> key_source_;
141 bool cancelled_ =
false;
143 bool dump_stream_info_ =
false;
144 Status init_event_status_;
150 #endif // PACKAGER_MEDIA_BASE_DEMUXER_H_
Define an abstract file interface.
All the methods that are virtual are virtual for mocking.