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