OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_config.h" | 5 #include "media/mojo/services/renderer_config.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "media/audio/audio_manager_base.h" | 9 #include "media/audio/audio_manager_base.h" |
10 #include "media/audio/audio_output_stream_sink.h" | 10 #include "media/audio/audio_output_stream_sink.h" |
11 #include "media/audio/fake_audio_log_factory.h" | 11 #include "media/audio/fake_audio_log_factory.h" |
12 #include "media/base/media.h" | 12 #include "media/base/media.h" |
13 #include "media/filters/opus_audio_decoder.h" | 13 #include "media/filters/opus_audio_decoder.h" |
14 | 14 |
15 #if !defined(MEDIA_DISABLE_FFMPEG) | 15 #if !defined(MEDIA_DISABLE_FFMPEG) |
16 #include "media/filters/ffmpeg_audio_decoder.h" | 16 #include "media/filters/ffmpeg_audio_decoder.h" |
17 #include "media/filters/ffmpeg_video_decoder.h" | 17 #include "media/filters/ffmpeg_video_decoder.h" |
18 #endif | 18 #endif |
19 | 19 |
20 #if !defined(MEDIA_DISABLE_LIBVPX) | 20 #if !defined(MEDIA_DISABLE_LIBVPX) |
21 #include "media/filters/vpx_video_decoder.h" | 21 #include "media/filters/vpx_video_decoder.h" |
22 #endif | 22 #endif |
23 | 23 |
24 namespace media { | 24 namespace media { |
25 namespace internal { | 25 namespace internal { |
26 | 26 |
27 class DummyVideoRendererSink : public VideoRendererSink { | |
28 public: | |
29 DummyVideoRendererSink() {} | |
30 ~DummyVideoRendererSink() override {} | |
31 | |
32 void Start(RenderCallback* callback) override {} | |
33 void Stop() override {} | |
34 void PaintFrameUsingOldRenderingPath( | |
35 const scoped_refptr<VideoFrame>& frame) override {} | |
36 | |
37 private: | |
38 DISALLOW_COPY_AND_ASSIGN(DummyVideoRendererSink); | |
39 }; | |
40 | |
41 class DefaultRendererConfig : public PlatformRendererConfig { | 27 class DefaultRendererConfig : public PlatformRendererConfig { |
42 public: | 28 public: |
43 DefaultRendererConfig() { | 29 DefaultRendererConfig() { |
44 // TODO(dalecurtis): This will not work if the process is sandboxed... | 30 // TODO(dalecurtis): This will not work if the process is sandboxed... |
45 if (!media::IsMediaLibraryInitialized()) { | 31 if (!media::IsMediaLibraryInitialized()) { |
46 base::FilePath module_dir; | 32 base::FilePath module_dir; |
47 CHECK(PathService::Get(base::DIR_EXE, &module_dir)); | 33 CHECK(PathService::Get(base::DIR_EXE, &module_dir)); |
48 CHECK(media::InitializeMediaLibrary(module_dir)); | 34 CHECK(media::InitializeMediaLibrary(module_dir)); |
49 } | 35 } |
50 | 36 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 video_decoders.push_back(new FFmpegVideoDecoder(media_task_runner)); | 80 video_decoders.push_back(new FFmpegVideoDecoder(media_task_runner)); |
95 #endif | 81 #endif |
96 | 82 |
97 return video_decoders.Pass(); | 83 return video_decoders.Pass(); |
98 } | 84 } |
99 | 85 |
100 scoped_refptr<AudioRendererSink> GetAudioRendererSink() override { | 86 scoped_refptr<AudioRendererSink> GetAudioRendererSink() override { |
101 return new AudioOutputStreamSink(); | 87 return new AudioOutputStreamSink(); |
102 } | 88 } |
103 | 89 |
104 scoped_ptr<VideoRendererSink> GetVideoRendererSink() override { | |
105 return make_scoped_ptr(new DummyVideoRendererSink()); | |
106 } | |
107 | |
108 const AudioHardwareConfig& GetAudioHardwareConfig() override { | 90 const AudioHardwareConfig& GetAudioHardwareConfig() override { |
109 return *audio_hardware_config_; | 91 return *audio_hardware_config_; |
110 } | 92 } |
111 | 93 |
112 private: | 94 private: |
113 FakeAudioLogFactory fake_audio_log_factory_; | 95 FakeAudioLogFactory fake_audio_log_factory_; |
114 scoped_ptr<AudioHardwareConfig> audio_hardware_config_; | 96 scoped_ptr<AudioHardwareConfig> audio_hardware_config_; |
115 | 97 |
116 DISALLOW_COPY_AND_ASSIGN(DefaultRendererConfig); | 98 DISALLOW_COPY_AND_ASSIGN(DefaultRendererConfig); |
117 }; | 99 }; |
118 | 100 |
119 scoped_ptr<PlatformRendererConfig> CreatePlatformRendererConfig() { | 101 scoped_ptr<PlatformRendererConfig> CreatePlatformRendererConfig() { |
120 return make_scoped_ptr(new DefaultRendererConfig()); | 102 return make_scoped_ptr(new DefaultRendererConfig()); |
121 } | 103 } |
122 | 104 |
123 } // namespace internal | 105 } // namespace internal |
124 } // namespace media | 106 } // namespace media |
OLD | NEW |