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