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