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