| 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 |
| 27 class DefaultRendererConfig : public PlatformRendererConfig { | 41 class DefaultRendererConfig : public PlatformRendererConfig { |
| 28 public: | 42 public: |
| 29 DefaultRendererConfig() { | 43 DefaultRendererConfig() { |
| 30 // TODO(dalecurtis): This will not work if the process is sandboxed... | 44 // TODO(dalecurtis): This will not work if the process is sandboxed... |
| 31 if (!media::IsMediaLibraryInitialized()) { | 45 if (!media::IsMediaLibraryInitialized()) { |
| 32 base::FilePath module_dir; | 46 base::FilePath module_dir; |
| 33 CHECK(PathService::Get(base::DIR_EXE, &module_dir)); | 47 CHECK(PathService::Get(base::DIR_EXE, &module_dir)); |
| 34 CHECK(media::InitializeMediaLibrary(module_dir)); | 48 CHECK(media::InitializeMediaLibrary(module_dir)); |
| 35 } | 49 } |
| 36 | 50 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 video_decoders.push_back(new FFmpegVideoDecoder(media_task_runner)); | 94 video_decoders.push_back(new FFmpegVideoDecoder(media_task_runner)); |
| 81 #endif | 95 #endif |
| 82 | 96 |
| 83 return video_decoders.Pass(); | 97 return video_decoders.Pass(); |
| 84 } | 98 } |
| 85 | 99 |
| 86 scoped_refptr<AudioRendererSink> GetAudioRendererSink() override { | 100 scoped_refptr<AudioRendererSink> GetAudioRendererSink() override { |
| 87 return new AudioOutputStreamSink(); | 101 return new AudioOutputStreamSink(); |
| 88 } | 102 } |
| 89 | 103 |
| 104 scoped_ptr<VideoRendererSink> GetVideoRendererSink() override { |
| 105 return make_scoped_ptr(new DummyVideoRendererSink()); |
| 106 } |
| 107 |
| 90 const AudioHardwareConfig& GetAudioHardwareConfig() override { | 108 const AudioHardwareConfig& GetAudioHardwareConfig() override { |
| 91 return *audio_hardware_config_; | 109 return *audio_hardware_config_; |
| 92 } | 110 } |
| 93 | 111 |
| 94 private: | 112 private: |
| 95 FakeAudioLogFactory fake_audio_log_factory_; | 113 FakeAudioLogFactory fake_audio_log_factory_; |
| 96 scoped_ptr<AudioHardwareConfig> audio_hardware_config_; | 114 scoped_ptr<AudioHardwareConfig> audio_hardware_config_; |
| 97 | 115 |
| 98 DISALLOW_COPY_AND_ASSIGN(DefaultRendererConfig); | 116 DISALLOW_COPY_AND_ASSIGN(DefaultRendererConfig); |
| 99 }; | 117 }; |
| 100 | 118 |
| 101 scoped_ptr<PlatformRendererConfig> CreatePlatformRendererConfig() { | 119 scoped_ptr<PlatformRendererConfig> CreatePlatformRendererConfig() { |
| 102 return make_scoped_ptr(new DefaultRendererConfig()); | 120 return make_scoped_ptr(new DefaultRendererConfig()); |
| 103 } | 121 } |
| 104 | 122 |
| 105 } // namespace internal | 123 } // namespace internal |
| 106 } // namespace media | 124 } // namespace media |
| OLD | NEW |