| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "services/media/factory_service/media_demux_impl.h" | 8 #include "services/media/factory_service/media_demux_impl.h" |
| 9 #include "services/media/framework/parts/reader_cache.h" | 9 #include "services/media/framework/parts/reader_cache.h" |
| 10 #include "services/media/framework/util/callback_joiner.h" | 10 #include "services/media/framework/util/callback_joiner.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 for (size_t i = 0; i < streams_.size(); i++) { | 89 for (size_t i = 0; i < streams_.size(); i++) { |
| 90 MediaSourceStreamDescriptorPtr descriptor = | 90 MediaSourceStreamDescriptorPtr descriptor = |
| 91 MediaSourceStreamDescriptor::New(); | 91 MediaSourceStreamDescriptor::New(); |
| 92 result[i] = streams_[i]->media_type(); | 92 result[i] = streams_[i]->media_type(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 callback.Run(result.Pass()); | 95 callback.Run(result.Pass()); |
| 96 }); | 96 }); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void MediaDemuxImpl::GetProducer(uint32_t stream_index, | 99 void MediaDemuxImpl::GetPacketProducer( |
| 100 InterfaceRequest<MediaProducer> producer) { | 100 uint32_t stream_index, |
| 101 InterfaceRequest<MediaPacketProducer> producer) { |
| 101 RCHECK(init_complete_.occurred()); | 102 RCHECK(init_complete_.occurred()); |
| 102 | 103 |
| 103 if (stream_index >= streams_.size()) { | 104 if (stream_index >= streams_.size()) { |
| 104 return; | 105 return; |
| 105 } | 106 } |
| 106 | 107 |
| 107 streams_[stream_index]->GetProducer(producer.Pass()); | 108 streams_[stream_index]->GetPacketProducer(producer.Pass()); |
| 108 } | 109 } |
| 109 | 110 |
| 110 void MediaDemuxImpl::GetMetadata(uint64_t version_last_seen, | 111 void MediaDemuxImpl::GetMetadata(uint64_t version_last_seen, |
| 111 const GetMetadataCallback& callback) { | 112 const GetMetadataCallback& callback) { |
| 112 metadata_publisher_.Get(version_last_seen, callback); | 113 metadata_publisher_.Get(version_last_seen, callback); |
| 113 } | 114 } |
| 114 | 115 |
| 115 void MediaDemuxImpl::Prime(const PrimeCallback& callback) { | 116 void MediaDemuxImpl::Prime(const PrimeCallback& callback) { |
| 116 RCHECK(init_complete_.occurred()); | 117 RCHECK(init_complete_.occurred()); |
| 117 | 118 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 callback.Run(); | 152 callback.Run(); |
| 152 } | 153 } |
| 153 | 154 |
| 154 MediaDemuxImpl::Stream::Stream(OutputRef output, | 155 MediaDemuxImpl::Stream::Stream(OutputRef output, |
| 155 std::unique_ptr<StreamType> stream_type, | 156 std::unique_ptr<StreamType> stream_type, |
| 156 Graph* graph) | 157 Graph* graph) |
| 157 : stream_type_(std::move(stream_type)), graph_(graph), output_(output) { | 158 : stream_type_(std::move(stream_type)), graph_(graph), output_(output) { |
| 158 DCHECK(stream_type_); | 159 DCHECK(stream_type_); |
| 159 DCHECK(graph); | 160 DCHECK(graph); |
| 160 | 161 |
| 161 producer_ = MojoProducer::Create(); | 162 producer_ = MojoPacketProducer::Create(); |
| 162 graph_->ConnectOutputToPart(output_, graph_->Add(producer_)); | 163 graph_->ConnectOutputToPart(output_, graph_->Add(producer_)); |
| 163 } | 164 } |
| 164 | 165 |
| 165 MediaDemuxImpl::Stream::~Stream() {} | 166 MediaDemuxImpl::Stream::~Stream() {} |
| 166 | 167 |
| 167 MediaTypePtr MediaDemuxImpl::Stream::media_type() const { | 168 MediaTypePtr MediaDemuxImpl::Stream::media_type() const { |
| 168 return MediaType::From(stream_type_); | 169 return MediaType::From(stream_type_); |
| 169 } | 170 } |
| 170 | 171 |
| 171 void MediaDemuxImpl::Stream::GetProducer( | 172 void MediaDemuxImpl::Stream::GetPacketProducer( |
| 172 InterfaceRequest<MediaProducer> producer) { | 173 InterfaceRequest<MediaPacketProducer> producer) { |
| 173 DCHECK(producer_); | 174 DCHECK(producer_); |
| 174 producer_->AddBinding(producer.Pass()); | 175 producer_->AddBinding(producer.Pass()); |
| 175 } | 176 } |
| 176 | 177 |
| 177 void MediaDemuxImpl::Stream::PrimeConnection( | 178 void MediaDemuxImpl::Stream::PrimeConnection( |
| 178 const MojoProducer::PrimeConnectionCallback callback) { | 179 const MojoPacketProducer::PrimeConnectionCallback callback) { |
| 179 DCHECK(producer_); | 180 DCHECK(producer_); |
| 180 producer_->PrimeConnection(callback); | 181 producer_->PrimeConnection(callback); |
| 181 } | 182 } |
| 182 | 183 |
| 183 void MediaDemuxImpl::Stream::FlushConnection( | 184 void MediaDemuxImpl::Stream::FlushConnection( |
| 184 const MojoProducer::FlushConnectionCallback callback) { | 185 const MojoPacketProducer::FlushConnectionCallback callback) { |
| 185 DCHECK(producer_); | 186 DCHECK(producer_); |
| 186 producer_->FlushConnection(callback); | 187 producer_->FlushConnection(callback); |
| 187 } | 188 } |
| 188 | 189 |
| 189 } // namespace media | 190 } // namespace media |
| 190 } // namespace mojo | 191 } // namespace mojo |
| OLD | NEW |