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_MOJO_MEDIA_CLIENT_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_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/renderer_factory.h" |
15 #include "media/base/video_decoder.h" | 16 #include "media/base/video_decoder.h" |
16 #include "media/base/video_renderer_sink.h" | 17 #include "media/base/video_renderer_sink.h" |
17 | 18 |
18 namespace media { | 19 namespace media { |
19 | 20 |
20 // Interface class which clients will extend to override (at compile time) the | 21 // Interface class which clients will extend to override (at compile time) the |
21 // default configurations for mojo media services. | 22 // default configurations for mojo media services. |
22 class PlatformMojoMediaClient { | 23 class PlatformMojoMediaClient { |
23 public: | 24 public: |
24 virtual ~PlatformMojoMediaClient() {}; | 25 virtual ~PlatformMojoMediaClient() {}; |
25 | 26 |
26 // The list of audio or video decoders for use with the AudioRenderer or | 27 // Returns the RendererFactory to be used by MojoRendererService. If returns |
27 // VideoRenderer respectively. Ownership of the decoders is passed to the | 28 // null, a RendererImpl will be used with audio/video decoders provided in |
28 // caller. The methods on each decoder will only be called on | 29 // GetAudioDecoders() and GetVideoDecoders(). |
29 // |media_task_runner|. |media_log_cb| should be used to log errors or | 30 virtual scoped_ptr<RendererFactory> GetRendererFactory( |
30 // important status information. | 31 const scoped_refptr<MediaLog>& media_log) = 0; |
| 32 |
| 33 // The list of audio or video decoders for use with RendererImpl when |
| 34 // GetRendererFactory() returns null. Ownership of the decoders is passed to |
| 35 // the caller. The methods on each decoder will only be called on |
| 36 // |media_task_runner|. |media_log| should be used to log errors or important |
| 37 // status information. |
31 virtual ScopedVector<AudioDecoder> GetAudioDecoders( | 38 virtual ScopedVector<AudioDecoder> GetAudioDecoders( |
32 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 39 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
33 const LogCB& media_log_cb) = 0; | 40 const scoped_refptr<MediaLog>& media_log) = 0; |
34 virtual ScopedVector<VideoDecoder> GetVideoDecoders( | 41 virtual ScopedVector<VideoDecoder> GetVideoDecoders( |
35 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 42 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
36 const LogCB& media_log_cb) = 0; | 43 const scoped_refptr<MediaLog>& media_log) = 0; |
37 | 44 |
38 // The output sink used for rendering audio or video respectively. | 45 // The output sink used for rendering audio or video respectively. |
39 virtual scoped_refptr<AudioRendererSink> GetAudioRendererSink() = 0; | 46 virtual scoped_refptr<AudioRendererSink> GetAudioRendererSink() = 0; |
40 virtual scoped_ptr<VideoRendererSink> GetVideoRendererSink( | 47 virtual scoped_ptr<VideoRendererSink> GetVideoRendererSink( |
41 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) = 0; | 48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) = 0; |
42 | 49 |
43 // The platform's audio hardware configuration. Note, this must remain | 50 // The platform's audio hardware configuration. Note, this must remain |
44 // constant for the lifetime of the PlatformMojoMediaClient. | 51 // constant for the lifetime of the PlatformMojoMediaClient. |
45 virtual const AudioHardwareConfig& GetAudioHardwareConfig() = 0; | 52 virtual const AudioHardwareConfig& GetAudioHardwareConfig() = 0; |
46 }; | 53 }; |
47 | 54 |
48 class MojoMediaClient { | 55 class MojoMediaClient { |
49 public: | 56 public: |
50 // Returns an instance of the MojoMediaClient object. Only one instance will | 57 // Returns an instance of the MojoMediaClient object. Only one instance will |
51 // exist per process. | 58 // exist per process. |
52 static MojoMediaClient* Get(); | 59 static MojoMediaClient* Get(); |
53 | 60 |
54 // Copy of the PlatformMojoMediaClient interface. | 61 // Copy of the PlatformMojoMediaClient interface. |
| 62 scoped_ptr<RendererFactory> GetRendererFactory( |
| 63 const scoped_refptr<MediaLog>& media_log); |
55 ScopedVector<AudioDecoder> GetAudioDecoders( | 64 ScopedVector<AudioDecoder> GetAudioDecoders( |
56 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 65 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
57 const LogCB& media_log_cb); | 66 const scoped_refptr<MediaLog>& media_log); |
58 ScopedVector<VideoDecoder> GetVideoDecoders( | 67 ScopedVector<VideoDecoder> GetVideoDecoders( |
59 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 68 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
60 const LogCB& media_log_cb); | 69 const scoped_refptr<MediaLog>& media_log); |
61 scoped_refptr<AudioRendererSink> GetAudioRendererSink(); | 70 scoped_refptr<AudioRendererSink> GetAudioRendererSink(); |
62 scoped_ptr<VideoRendererSink> GetVideoRendererSink( | 71 scoped_ptr<VideoRendererSink> GetVideoRendererSink( |
63 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 72 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
64 const AudioHardwareConfig& GetAudioHardwareConfig(); | 73 const AudioHardwareConfig& GetAudioHardwareConfig(); |
65 | 74 |
66 private: | 75 private: |
67 friend struct base::DefaultLazyInstanceTraits<MojoMediaClient>; | 76 friend struct base::DefaultLazyInstanceTraits<MojoMediaClient>; |
68 | 77 |
69 MojoMediaClient(); | 78 MojoMediaClient(); |
70 ~MojoMediaClient(); | 79 ~MojoMediaClient(); |
71 | 80 |
72 scoped_ptr<PlatformMojoMediaClient> mojo_media_client_; | 81 scoped_ptr<PlatformMojoMediaClient> mojo_media_client_; |
73 | 82 |
74 DISALLOW_COPY_AND_ASSIGN(MojoMediaClient); | 83 DISALLOW_COPY_AND_ASSIGN(MojoMediaClient); |
75 }; | 84 }; |
76 | 85 |
77 } // namespace media | 86 } // namespace media |
78 | 87 |
79 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ | 88 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ |
OLD | NEW |