OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "media/mojo/services/service_factory_impl.h" | 5 #include "media/mojo/services/service_factory_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" |
8 #include "media/base/media_log.h" | 9 #include "media/base/media_log.h" |
9 #include "media/mojo/services/mojo_media_client.h" | 10 #include "media/mojo/services/mojo_media_client.h" |
10 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 11 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
11 | 12 |
12 #if defined(ENABLE_MOJO_AUDIO_DECODER) | 13 #if defined(ENABLE_MOJO_AUDIO_DECODER) |
13 #include "media/mojo/services/mojo_audio_decoder_service.h" | 14 #include "media/mojo/services/mojo_audio_decoder_service.h" |
14 #endif // defined(ENABLE_MOJO_AUDIO_DECODER) | 15 #endif // defined(ENABLE_MOJO_AUDIO_DECODER) |
15 | 16 |
| 17 #if defined(ENABLE_MOJO_VIDEO_DECODER) |
| 18 #include "media/mojo/services/mojo_video_decoder_service.h" |
| 19 #endif // defined(ENABLE_MOJO_VIDEO_DECODER) |
| 20 |
16 #if defined(ENABLE_MOJO_RENDERER) | 21 #if defined(ENABLE_MOJO_RENDERER) |
17 #include "media/base/renderer_factory.h" | 22 #include "media/base/renderer_factory.h" |
18 #include "media/mojo/services/mojo_renderer_service.h" | 23 #include "media/mojo/services/mojo_renderer_service.h" |
19 #endif // defined(ENABLE_MOJO_RENDERER) | 24 #endif // defined(ENABLE_MOJO_RENDERER) |
20 | 25 |
21 #if defined(ENABLE_MOJO_CDM) | 26 #if defined(ENABLE_MOJO_CDM) |
22 #include "media/base/cdm_factory.h" | 27 #include "media/base/cdm_factory.h" |
23 #include "media/mojo/services/mojo_cdm_service.h" | 28 #include "media/mojo/services/mojo_cdm_service.h" |
24 #endif // defined(ENABLE_MOJO_CDM) | 29 #endif // defined(ENABLE_MOJO_CDM) |
25 | 30 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (!audio_decoder) { | 66 if (!audio_decoder) { |
62 LOG(ERROR) << "AudioDecoder creation failed."; | 67 LOG(ERROR) << "AudioDecoder creation failed."; |
63 return; | 68 return; |
64 } | 69 } |
65 | 70 |
66 new MojoAudioDecoderService(cdm_service_context_.GetWeakPtr(), | 71 new MojoAudioDecoderService(cdm_service_context_.GetWeakPtr(), |
67 std::move(audio_decoder), std::move(request)); | 72 std::move(audio_decoder), std::move(request)); |
68 #endif // defined(ENABLE_MOJO_AUDIO_DECODER) | 73 #endif // defined(ENABLE_MOJO_AUDIO_DECODER) |
69 } | 74 } |
70 | 75 |
| 76 void ServiceFactoryImpl::CreateVideoDecoder( |
| 77 mojom::VideoDecoderRequest request) { |
| 78 #if defined(ENABLE_MOJO_VIDEO_DECODER) |
| 79 new MojoVideoDecoderService(std::move(request), mojo_media_client_); |
| 80 #endif // defined(ENABLE_MOJO_VIDEO_DECODER) |
| 81 } |
| 82 |
71 void ServiceFactoryImpl::CreateRenderer( | 83 void ServiceFactoryImpl::CreateRenderer( |
72 mojo::InterfaceRequest<mojom::Renderer> request) { | 84 mojo::InterfaceRequest<mojom::Renderer> request) { |
73 #if defined(ENABLE_MOJO_RENDERER) | 85 #if defined(ENABLE_MOJO_RENDERER) |
74 // The created object is owned by the pipe. | 86 // The created object is owned by the pipe. |
75 // The audio and video sinks are owned by the client. | 87 // The audio and video sinks are owned by the client. |
76 scoped_refptr<base::SingleThreadTaskRunner> task_runner( | 88 scoped_refptr<base::SingleThreadTaskRunner> task_runner( |
77 base::MessageLoop::current()->task_runner()); | 89 base::MessageLoop::current()->task_runner()); |
78 AudioRendererSink* audio_renderer_sink = | 90 AudioRendererSink* audio_renderer_sink = |
79 mojo_media_client_->CreateAudioRendererSink(); | 91 mojo_media_client_->CreateAudioRendererSink(); |
80 VideoRendererSink* video_renderer_sink = | 92 VideoRendererSink* video_renderer_sink = |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 CdmFactory* ServiceFactoryImpl::GetCdmFactory() { | 136 CdmFactory* ServiceFactoryImpl::GetCdmFactory() { |
125 if (!cdm_factory_) { | 137 if (!cdm_factory_) { |
126 cdm_factory_ = mojo_media_client_->CreateCdmFactory(interfaces_); | 138 cdm_factory_ = mojo_media_client_->CreateCdmFactory(interfaces_); |
127 LOG_IF(ERROR, !cdm_factory_) << "CdmFactory not available."; | 139 LOG_IF(ERROR, !cdm_factory_) << "CdmFactory not available."; |
128 } | 140 } |
129 return cdm_factory_.get(); | 141 return cdm_factory_.get(); |
130 } | 142 } |
131 #endif // defined(ENABLE_MOJO_CDM) | 143 #endif // defined(ENABLE_MOJO_CDM) |
132 | 144 |
133 } // namespace media | 145 } // namespace media |
OLD | NEW |