OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_PARAMS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_PARAMS_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_PARAMS_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_PARAMS_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/renderer/media/crypto/encrypted_media_player_support.h" |
| 11 |
| 12 namespace base { |
| 13 class SingleThreadTaskRunner; |
| 14 } |
| 15 |
| 16 namespace blink { |
| 17 class WebMediaPlayerClient; |
| 18 } |
10 | 19 |
11 namespace media { | 20 namespace media { |
| 21 class AudioHardwareConfig; |
12 class AudioRendererSink; | 22 class AudioRendererSink; |
| 23 class GpuVideoAcceleratorFactories; |
| 24 class MediaLog; |
13 } | 25 } |
14 | 26 |
15 namespace content { | 27 namespace content { |
16 | 28 |
17 // Holds parameters for constructing WebMediaPlayerImpl without having | 29 // Holds parameters for constructing WebMediaPlayerImpl without having |
18 // to plumb arguments through various abstraction layers. | 30 // to plumb arguments through various abstraction layers. |
19 class WebMediaPlayerParams { | 31 class WebMediaPlayerParams { |
20 public: | 32 public: |
21 // Parameters may be null. | 33 // Callback used to create EncryptedMediaPlayerSupport instances. This |
| 34 // callback must always return a valid EncryptedMediaPlayerSupport object. |
| 35 typedef base::Callback<scoped_ptr<EncryptedMediaPlayerSupport>( |
| 36 blink::WebMediaPlayerClient*)> EncryptedMediaPlayerSupportCreateCB; |
| 37 |
| 38 // |defer_load_cb|, |audio_renderer_sink|, and |compositor_task_runner| may be |
| 39 // null. |
22 WebMediaPlayerParams( | 40 WebMediaPlayerParams( |
23 const base::Callback<void(const base::Closure&)>& defer_load_cb, | 41 const base::Callback<void(const base::Closure&)>& defer_load_cb, |
24 const scoped_refptr<media::AudioRendererSink>& audio_renderer_sink); | 42 const scoped_refptr<media::AudioRendererSink>& audio_renderer_sink, |
| 43 const media::AudioHardwareConfig& audio_hardware_config, |
| 44 const scoped_refptr<media::MediaLog>& media_log, |
| 45 const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories, |
| 46 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 47 media_task_runner, |
| 48 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 49 compositor_task_runner, |
| 50 const EncryptedMediaPlayerSupportCreateCB& |
| 51 encrypted_media_player_support_cb); |
| 52 |
25 ~WebMediaPlayerParams(); | 53 ~WebMediaPlayerParams(); |
26 | 54 |
27 base::Callback<void(const base::Closure&)> defer_load_cb() const { | 55 base::Callback<void(const base::Closure&)> defer_load_cb() const { |
28 return defer_load_cb_; | 56 return defer_load_cb_; |
29 } | 57 } |
30 | 58 |
31 const scoped_refptr<media::AudioRendererSink>& audio_renderer_sink() const { | 59 const scoped_refptr<media::AudioRendererSink>& audio_renderer_sink() const { |
32 return audio_renderer_sink_; | 60 return audio_renderer_sink_; |
33 } | 61 } |
34 | 62 |
| 63 const media::AudioHardwareConfig& audio_hardware_config() const { |
| 64 return audio_hardware_config_; |
| 65 } |
| 66 |
| 67 const scoped_refptr<media::MediaLog>& media_log() const { |
| 68 return media_log_; |
| 69 } |
| 70 |
| 71 const scoped_refptr<media::GpuVideoAcceleratorFactories>& |
| 72 gpu_factories() const { |
| 73 return gpu_factories_; |
| 74 } |
| 75 |
| 76 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 77 media_task_runner() const { |
| 78 return media_task_runner_; |
| 79 } |
| 80 |
| 81 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 82 compositor_task_runner() const { |
| 83 return compositor_task_runner_; |
| 84 } |
| 85 |
| 86 scoped_ptr<EncryptedMediaPlayerSupport> |
| 87 CreateEncryptedMediaPlayerSupport(blink::WebMediaPlayerClient* client) const; |
| 88 |
35 private: | 89 private: |
36 base::Callback<void(const base::Closure&)> defer_load_cb_; | 90 base::Callback<void(const base::Closure&)> defer_load_cb_; |
37 scoped_refptr<media::AudioRendererSink> audio_renderer_sink_; | 91 scoped_refptr<media::AudioRendererSink> audio_renderer_sink_; |
| 92 const media::AudioHardwareConfig& audio_hardware_config_; |
| 93 scoped_refptr<media::MediaLog> media_log_; |
| 94 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories_; |
| 95 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 96 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 97 EncryptedMediaPlayerSupportCreateCB encrypted_media_player_support_cb_; |
38 | 98 |
39 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams); | 99 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams); |
40 }; | 100 }; |
41 | 101 |
42 } // namespace content | 102 } // namespace content |
43 | 103 |
44 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_PARAMS_H_ | 104 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_PARAMS_H_ |
OLD | NEW |