Revert of Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320) (patchset...
[chromium-blink-merge.git] / media / mojo / services / renderer_config.h
blob08b7e0bbc84fcf70deb15285151c1f592d7b6eec
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_
6 #define MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_
8 #include "base/lazy_instance.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/single_thread_task_runner.h"
11 #include "media/base/audio_decoder.h"
12 #include "media/base/audio_hardware_config.h"
13 #include "media/base/audio_renderer_sink.h"
14 #include "media/base/media_log.h"
15 #include "media/base/video_decoder.h"
17 namespace media {
19 // Interface class which clients will extend to override (at compile time) the
20 // default audio or video rendering configurations for MojoRendererService.
21 class PlatformRendererConfig {
22 public:
23 virtual ~PlatformRendererConfig() {};
25 // The list of audio or video decoders for use with the AudioRenderer or
26 // VideoRenderer respectively. Ownership of the decoders is passed to the
27 // caller. The methods on each decoder will only be called on
28 // |media_task_runner|. |media_log_cb| should be used to log errors or
29 // important status information.
30 virtual ScopedVector<AudioDecoder> GetAudioDecoders(
31 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
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;
37 // The audio output sink used for rendering audio.
38 virtual scoped_refptr<AudioRendererSink> GetAudioRendererSink() = 0;
40 // The platform's audio hardware configuration. Note, this must remain
41 // constant for the lifetime of the PlatformRendererConfig.
42 virtual const AudioHardwareConfig& GetAudioHardwareConfig() = 0;
46 class RendererConfig {
47 public:
48 // Returns an instance of the RenderConfig object. Only one instance will
49 // exist per process.
50 static RendererConfig* Get();
52 // Copy of the PlatformRendererConfig interface.
53 ScopedVector<AudioDecoder> GetAudioDecoders(
54 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
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);
59 scoped_refptr<AudioRendererSink> GetAudioRendererSink();
60 const AudioHardwareConfig& GetAudioHardwareConfig();
62 private:
63 friend struct base::DefaultLazyInstanceTraits<RendererConfig>;
65 RendererConfig();
66 ~RendererConfig();
68 scoped_ptr<PlatformRendererConfig> renderer_config_;
70 DISALLOW_COPY_AND_ASSIGN(RendererConfig);
73 } // namespace media
75 #endif // MEDIA_MOJO_SERVICES_RENDERER_CONFIG_H_