7 #include "packager/media/base/media_handler.h" 13 std::shared_ptr<MediaHandler> handler) {
14 if (output_handlers_.find(output_stream_index) != output_handlers_.end()) {
15 return Status(error::ALREADY_EXISTS,
16 "The handler at the specified index already exists.");
18 output_handlers_[output_stream_index] =
19 std::make_pair(handler, handler->num_input_streams_++);
20 next_output_stream_index_ = output_stream_index + 1;
30 for (
auto& pair : output_handlers_) {
32 return Status(error::INVALID_ARGUMENT,
"Invalid output stream index");
33 status = pair.second.first->Initialize();
44 const size_t output_stream_index = input_stream_index;
49 return stream_index < num_input_streams_;
53 size_t output_stream_index = stream_data->stream_index;
54 auto handler_it = output_handlers_.find(output_stream_index);
55 if (handler_it == output_handlers_.end()) {
56 return Status(error::NOT_FOUND,
57 "No output handler exist at the specified index.");
59 stream_data->stream_index = handler_it->second.second;
60 return handler_it->second.first->Process(std::move(stream_data));
64 auto handler_it = output_handlers_.find(output_stream_index);
65 if (handler_it == output_handlers_.end()) {
66 return Status(error::NOT_FOUND,
67 "No output handler exist at the specified index.");
69 return handler_it->second.first->OnFlushRequest(handler_it->second.second);
73 for (
const auto& pair : output_handlers_) {
74 Status status = pair.second.first->OnFlushRequest(pair.second.second);
All the methods that are virtual are virtual for mocking.