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 #ifndef MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_ |
6 #define MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_ | 6 #define MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_ |
7 | 7 |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "media/base/audio_decoder.h" | 11 #include "media/base/audio_decoder.h" |
12 #include "media/base/audio_hardware_config.h" | 12 #include "media/base/audio_hardware_config.h" |
13 #include "media/base/audio_renderer_sink.h" | 13 #include "media/base/audio_renderer_sink.h" |
14 #include "media/base/media_log.h" | 14 #include "media/base/media_log.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
| 18 // Interface class which clients will extend to override (at compile time) the |
| 19 // default audio or video rendering configurations for MojoRendererService. |
18 class PlatformRendererConfig { | 20 class PlatformRendererConfig { |
19 public: | 21 public: |
20 virtual ~PlatformRendererConfig() {}; | 22 virtual ~PlatformRendererConfig() {}; |
21 | 23 |
| 24 // The list of audio decoders for use with the AudioRenderer. Ownership of |
| 25 // the decoders is passed to the caller. The methods on each decoder will |
| 26 // only be called on |media_task_runner|. |media_log_cb| should be used to |
| 27 // log errors or important status information. |
22 virtual ScopedVector<AudioDecoder> GetAudioDecoders( | 28 virtual ScopedVector<AudioDecoder> GetAudioDecoders( |
23 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 29 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
24 const LogCB& media_log_cb) = 0; | 30 const LogCB& media_log_cb) = 0; |
| 31 |
| 32 // The audio output sink used for rendering audio. |
25 virtual scoped_refptr<AudioRendererSink> GetAudioRendererSink() = 0; | 33 virtual scoped_refptr<AudioRendererSink> GetAudioRendererSink() = 0; |
| 34 |
| 35 // The platform's audio hardware configuration. Note, this must remain |
| 36 // constant for the lifetime of the PlatformRendererConfig. |
26 virtual const AudioHardwareConfig& GetAudioHardwareConfig() = 0; | 37 virtual const AudioHardwareConfig& GetAudioHardwareConfig() = 0; |
| 38 |
| 39 // TODO(dalecurtis): Expose methods for retrieving the video decoders. |
27 }; | 40 }; |
28 | 41 |
29 class RendererConfig { | 42 class RendererConfig { |
30 public: | 43 public: |
| 44 // Returns an instance of the RenderConfig object. Only one instance will |
| 45 // exist per process. |
31 static RendererConfig* Get(); | 46 static RendererConfig* Get(); |
32 | 47 |
| 48 // Copy of the PlatformRendererConfig interface. |
33 ScopedVector<AudioDecoder> GetAudioDecoders( | 49 ScopedVector<AudioDecoder> GetAudioDecoders( |
34 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 50 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
35 const LogCB& media_log_cb); | 51 const LogCB& media_log_cb); |
36 scoped_refptr<AudioRendererSink> GetAudioRendererSink(); | 52 scoped_refptr<AudioRendererSink> GetAudioRendererSink(); |
37 const AudioHardwareConfig& GetAudioHardwareConfig(); | 53 const AudioHardwareConfig& GetAudioHardwareConfig(); |
38 | 54 |
39 private: | 55 private: |
40 friend struct base::DefaultLazyInstanceTraits<RendererConfig>; | 56 friend struct base::DefaultLazyInstanceTraits<RendererConfig>; |
41 | 57 |
42 RendererConfig(); | 58 RendererConfig(); |
43 ~RendererConfig(); | 59 ~RendererConfig(); |
44 | 60 |
45 scoped_ptr<PlatformRendererConfig> renderer_config_; | 61 scoped_ptr<PlatformRendererConfig> renderer_config_; |
46 | 62 |
47 DISALLOW_COPY_AND_ASSIGN(RendererConfig); | 63 DISALLOW_COPY_AND_ASSIGN(RendererConfig); |
48 }; | 64 }; |
49 | 65 |
50 } // namespace media | 66 } // namespace media |
51 | 67 |
52 #endif // MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_ | 68 #endif // MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_ |
OLD | NEW |