| 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 MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "media/base/cdm_factory.h" | |
| 22 #include "media/base/pipeline.h" | 21 #include "media/base/pipeline.h" |
| 23 #include "media/base/renderer_factory.h" | 22 #include "media/base/renderer_factory.h" |
| 24 #include "media/base/surface_manager.h" | 23 #include "media/base/surface_manager.h" |
| 25 #include "media/base/text_track.h" | 24 #include "media/base/text_track.h" |
| 26 #include "media/blink/buffered_data_source.h" | 25 #include "media/blink/buffered_data_source.h" |
| 27 #include "media/blink/buffered_data_source_host_impl.h" | 26 #include "media/blink/buffered_data_source_host_impl.h" |
| 28 #include "media/blink/encrypted_media_player_support.h" | |
| 29 #include "media/blink/media_blink_export.h" | 27 #include "media/blink/media_blink_export.h" |
| 30 #include "media/blink/multibuffer_data_source.h" | 28 #include "media/blink/multibuffer_data_source.h" |
| 31 #include "media/blink/video_frame_compositor.h" | 29 #include "media/blink/video_frame_compositor.h" |
| 32 #include "media/blink/webmediaplayer_delegate.h" | 30 #include "media/blink/webmediaplayer_delegate.h" |
| 33 #include "media/blink/webmediaplayer_params.h" | 31 #include "media/blink/webmediaplayer_params.h" |
| 34 #include "media/blink/webmediaplayer_util.h" | 32 #include "media/blink/webmediaplayer_util.h" |
| 35 #include "media/renderers/skcanvas_video_renderer.h" | 33 #include "media/renderers/skcanvas_video_renderer.h" |
| 36 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" | 34 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" |
| 37 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 35 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 38 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 36 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 77 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
| 80 public: | 78 public: |
| 81 // Constructs a WebMediaPlayer implementation using Chromium's media stack. | 79 // Constructs a WebMediaPlayer implementation using Chromium's media stack. |
| 82 // |delegate| may be null. |renderer_factory| must not be null. | 80 // |delegate| may be null. |renderer_factory| must not be null. |
| 83 WebMediaPlayerImpl( | 81 WebMediaPlayerImpl( |
| 84 blink::WebLocalFrame* frame, | 82 blink::WebLocalFrame* frame, |
| 85 blink::WebMediaPlayerClient* client, | 83 blink::WebMediaPlayerClient* client, |
| 86 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 84 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
| 87 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 85 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
| 88 scoped_ptr<RendererFactory> renderer_factory, | 86 scoped_ptr<RendererFactory> renderer_factory, |
| 89 CdmFactory* cdm_factory, | |
| 90 linked_ptr<UrlIndex> url_index, | 87 linked_ptr<UrlIndex> url_index, |
| 91 const WebMediaPlayerParams& params); | 88 const WebMediaPlayerParams& params); |
| 92 ~WebMediaPlayerImpl() override; | 89 ~WebMediaPlayerImpl() override; |
| 93 | 90 |
| 94 void load(LoadType load_type, | 91 void load(LoadType load_type, |
| 95 const blink::WebURL& url, | 92 const blink::WebURL& url, |
| 96 CORSMode cors_mode) override; | 93 CORSMode cors_mode) override; |
| 97 | 94 |
| 98 // Playback controls. | 95 // Playback controls. |
| 99 void play() override; | 96 void play() override; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 bool copyVideoTextureToPlatformTexture( | 151 bool copyVideoTextureToPlatformTexture( |
| 155 blink::WebGraphicsContext3D* web_graphics_context, | 152 blink::WebGraphicsContext3D* web_graphics_context, |
| 156 unsigned int texture, | 153 unsigned int texture, |
| 157 unsigned int internal_format, | 154 unsigned int internal_format, |
| 158 unsigned int type, | 155 unsigned int type, |
| 159 bool premultiply_alpha, | 156 bool premultiply_alpha, |
| 160 bool flip_y) override; | 157 bool flip_y) override; |
| 161 | 158 |
| 162 blink::WebAudioSourceProvider* audioSourceProvider() override; | 159 blink::WebAudioSourceProvider* audioSourceProvider() override; |
| 163 | 160 |
| 164 MediaKeyException generateKeyRequest( | |
| 165 const blink::WebString& key_system, | |
| 166 const unsigned char* init_data, | |
| 167 unsigned init_data_length) override; | |
| 168 | |
| 169 MediaKeyException addKey(const blink::WebString& key_system, | |
| 170 const unsigned char* key, | |
| 171 unsigned key_length, | |
| 172 const unsigned char* init_data, | |
| 173 unsigned init_data_length, | |
| 174 const blink::WebString& session_id) override; | |
| 175 | |
| 176 MediaKeyException cancelKeyRequest( | |
| 177 const blink::WebString& key_system, | |
| 178 const blink::WebString& session_id) override; | |
| 179 | |
| 180 void setContentDecryptionModule( | 161 void setContentDecryptionModule( |
| 181 blink::WebContentDecryptionModule* cdm, | 162 blink::WebContentDecryptionModule* cdm, |
| 182 blink::WebContentDecryptionModuleResult result) override; | 163 blink::WebContentDecryptionModuleResult result) override; |
| 183 | 164 |
| 184 void enteredFullscreen() override; | 165 void enteredFullscreen() override; |
| 185 void exitedFullscreen() override; | 166 void exitedFullscreen() override; |
| 186 | 167 |
| 187 void OnPipelineSeeked(bool time_changed, PipelineStatus status); | 168 void OnPipelineSeeked(bool time_changed, PipelineStatus status); |
| 188 void OnPipelineSuspended(PipelineStatus status); | 169 void OnPipelineSuspended(PipelineStatus status); |
| 189 void OnPipelineEnded(); | 170 void OnPipelineEnded(); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 425 |
| 445 // Video rendering members. | 426 // Video rendering members. |
| 446 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 427 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 447 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. | 428 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. |
| 448 SkCanvasVideoRenderer skcanvas_video_renderer_; | 429 SkCanvasVideoRenderer skcanvas_video_renderer_; |
| 449 | 430 |
| 450 // The compositor layer for displaying the video content when using composited | 431 // The compositor layer for displaying the video content when using composited |
| 451 // playback. | 432 // playback. |
| 452 scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_; | 433 scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_; |
| 453 | 434 |
| 454 EncryptedMediaPlayerSupport encrypted_media_support_; | |
| 455 | |
| 456 scoped_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; | 435 scoped_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; |
| 457 | 436 |
| 458 // Whether a CDM has been successfully attached. | 437 // Whether a CDM has been successfully attached. |
| 459 bool is_cdm_attached_; | 438 bool is_cdm_attached_; |
| 460 | 439 |
| 461 #if defined(OS_ANDROID) // WMPI_CAST | 440 #if defined(OS_ANDROID) // WMPI_CAST |
| 462 WebMediaPlayerCast cast_impl_; | 441 WebMediaPlayerCast cast_impl_; |
| 463 #endif | 442 #endif |
| 464 | 443 |
| 465 // The last volume received by setVolume() and the last volume multiplier from | 444 // The last volume received by setVolume() and the last volume multiplier from |
| 466 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less | 445 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less |
| 467 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) | 446 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) |
| 468 // for a transient sound. Playout volume is derived by volume * multiplier. | 447 // for a transient sound. Playout volume is derived by volume * multiplier. |
| 469 double volume_; | 448 double volume_; |
| 470 double volume_multiplier_; | 449 double volume_multiplier_; |
| 471 | 450 |
| 472 scoped_ptr<RendererFactory> renderer_factory_; | 451 scoped_ptr<RendererFactory> renderer_factory_; |
| 473 | 452 |
| 474 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. | 453 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. |
| 475 // This will be null everywhere but Android. | 454 // This will be null everywhere but Android. |
| 476 SurfaceManager* surface_manager_; | 455 SurfaceManager* surface_manager_; |
| 477 | 456 |
| 478 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 457 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 479 }; | 458 }; |
| 480 | 459 |
| 481 } // namespace media | 460 } // namespace media |
| 482 | 461 |
| 483 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 462 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |