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 #ifndef MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SOURCE_IMPL_H_ | 5 #ifndef MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SOURCE_IMPL_H_ |
6 #define MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SOURCE_IMPL_H_ | 6 #define MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SOURCE_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
12 #include "mojo/services/media/control/interfaces/media_source.mojom.h" | 12 #include "mojo/services/media/control/interfaces/media_source.mojom.h" |
13 #include "mojo/services/media/core/interfaces/seeking_reader.mojom.h" | 13 #include "mojo/services/media/core/interfaces/seeking_reader.mojom.h" |
14 #include "services/media/factory_service/factory_service.h" | 14 #include "services/media/factory_service/factory_service.h" |
15 #include "services/media/factory_service/mojo_publisher.h" | 15 #include "services/media/factory_service/mojo_publisher.h" |
16 #include "services/media/framework/graph.h" | 16 #include "services/media/framework/graph.h" |
17 #include "services/media/framework/parts/decoder.h" | 17 #include "services/media/framework/parts/decoder.h" |
18 #include "services/media/framework/parts/demux.h" | 18 #include "services/media/framework/parts/demux.h" |
19 #include "services/media/framework/parts/null_sink.h" | 19 #include "services/media/framework/parts/null_sink.h" |
20 #include "services/media/framework/parts/reader.h" | 20 #include "services/media/framework/parts/reader.h" |
21 #include "services/media/framework/util/incident.h" | 21 #include "services/media/framework/util/incident.h" |
22 #include "services/media/framework_mojo/mojo_producer.h" | 22 #include "services/media/framework_mojo/mojo_producer.h" |
23 #include "services/media/framework_mojo/mojo_pull_mode_producer.h" | 23 #include "services/media/framework_mojo/mojo_pull_mode_producer.h" |
24 | 24 |
25 namespace mojo { | 25 namespace mojo { |
26 namespace media { | 26 namespace media { |
27 | 27 |
28 // Mojo agent that produces streams from an origin specified by URL. | 28 // Mojo agent that produces streams from an origin specified by URL. |
29 class MediaSourceImpl : public MediaFactoryService::Product, | 29 class MediaSourceImpl : public MediaFactoryService::Product<MediaSource>, |
30 public MediaSource { | 30 public MediaSource { |
31 public: | 31 public: |
32 static std::shared_ptr<MediaSourceImpl> Create( | 32 static std::shared_ptr<MediaSourceImpl> Create( |
33 InterfaceHandle<SeekingReader> reader, | 33 InterfaceHandle<SeekingReader> reader, |
34 const Array<MediaTypeSetPtr>& allowed_media_types, | 34 const Array<MediaTypeSetPtr>& allowed_media_types, |
35 InterfaceRequest<MediaSource> request, | 35 InterfaceRequest<MediaSource> request, |
36 MediaFactoryService* owner); | 36 MediaFactoryService* owner); |
37 | 37 |
38 ~MediaSourceImpl() override; | 38 ~MediaSourceImpl() override; |
39 | 39 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 std::shared_ptr<NullSink> null_sink_; | 105 std::shared_ptr<NullSink> null_sink_; |
106 }; | 106 }; |
107 | 107 |
108 // Handles the completion of demux initialization. | 108 // Handles the completion of demux initialization. |
109 void OnDemuxInitialized(Result result); | 109 void OnDemuxInitialized(Result result); |
110 | 110 |
111 // Runs a seek callback. | 111 // Runs a seek callback. |
112 static void RunSeekCallback(const SeekCallback& callback); | 112 static void RunSeekCallback(const SeekCallback& callback); |
113 | 113 |
114 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 114 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
115 Binding<MediaSource> binding_; | |
116 Array<MediaTypeSetPtr> allowed_media_types_; | 115 Array<MediaTypeSetPtr> allowed_media_types_; |
117 Graph graph_; | 116 Graph graph_; |
118 PartRef demux_part_; | 117 PartRef demux_part_; |
119 std::shared_ptr<Demux> demux_; | 118 std::shared_ptr<Demux> demux_; |
120 Incident init_complete_; | 119 Incident init_complete_; |
121 std::vector<std::unique_ptr<Stream>> streams_; | 120 std::vector<std::unique_ptr<Stream>> streams_; |
122 MediaState state_ = MediaState::UNPREPARED; | 121 MediaState state_ = MediaState::UNPREPARED; |
123 MojoPublisher<GetStatusCallback> status_publisher_; | 122 MojoPublisher<GetStatusCallback> status_publisher_; |
124 }; | 123 }; |
125 | 124 |
126 } // namespace media | 125 } // namespace media |
127 } // namespace mojo | 126 } // namespace mojo |
128 | 127 |
129 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SOURCE_IMPL_H_ | 128 #endif // MOJO_SERVICES_MEDIA_FACTORY_MEDIA_SOURCE_IMPL_H_ |
OLD | NEW |