| 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_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "cc/layers/video_frame_provider.h" | 17 #include "cc/layers/video_frame_provider.h" |
| 18 #include "content/common/media/media_player_messages_enums_android.h" | 18 #include "content/common/media/media_player_messages_enums_android.h" |
| 19 #include "content/public/renderer/render_frame_observer.h" | 19 #include "content/public/renderer/render_frame_observer.h" |
| 20 #include "content/renderer/media/android/media_info_loader.h" | 20 #include "content/renderer/media/android/media_info_loader.h" |
| 21 #include "content/renderer/media/android/media_source_delegate.h" | 21 #include "content/renderer/media/android/media_source_delegate.h" |
| 22 #include "content/renderer/media/android/stream_texture_factory.h" | 22 #include "content/renderer/media/android/stream_texture_factory.h" |
| 23 #include "content/renderer/media/crypto/proxy_decryptor.h" | 23 #include "content/renderer/media/crypto/proxy_decryptor.h" |
| 24 #include "gpu/command_buffer/common/mailbox.h" | 24 #include "gpu/command_buffer/common/mailbox.h" |
| 25 #include "media/base/android/media_player_android.h" | 25 #include "media/base/android/media_player_android.h" |
| 26 #include "media/base/demuxer_stream.h" | 26 #include "media/base/demuxer_stream.h" |
| 27 #include "media/base/media_keys.h" | 27 #include "media/base/media_keys.h" |
| 28 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 28 #include "media/filters/skcanvas_video_renderer.h" |
| 29 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 29 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 30 #include "third_party/WebKit/public/platform/WebSize.h" | 30 #include "third_party/WebKit/public/platform/WebSize.h" |
| 31 #include "third_party/WebKit/public/platform/WebURL.h" | 31 #include "third_party/WebKit/public/platform/WebURL.h" |
| 32 #include "third_party/skia/include/core/SkBitmap.h" | |
| 33 #include "third_party/skia/include/gpu/GrContext.h" | |
| 34 #include "third_party/skia/include/gpu/SkGrPixelRef.h" | |
| 35 #include "ui/gfx/rect_f.h" | 32 #include "ui/gfx/rect_f.h" |
| 36 | 33 |
| 37 namespace base { | 34 namespace base { |
| 38 class MessageLoopProxy; | 35 class MessageLoopProxy; |
| 39 } | 36 } |
| 40 | 37 |
| 41 namespace blink { | 38 namespace blink { |
| 42 class WebContentDecryptionModule; | 39 class WebContentDecryptionModule; |
| 43 class WebContentDecryptionModuleResult; | 40 class WebContentDecryptionModuleResult; |
| 44 class WebFrame; | 41 class WebFrame; |
| 42 class WebGraphicsContext3D; |
| 45 class WebURL; | 43 class WebURL; |
| 46 } | 44 } |
| 47 | 45 |
| 48 namespace cc_blink { | 46 namespace cc_blink { |
| 49 class WebLayerImpl; | 47 class WebLayerImpl; |
| 50 } | 48 } |
| 51 | 49 |
| 52 namespace gpu { | 50 namespace gpu { |
| 53 struct MailboxHolder; | 51 struct MailboxHolder; |
| 54 } | 52 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 virtual bool supportsSave() const; | 101 virtual bool supportsSave() const; |
| 104 virtual void setRate(double rate); | 102 virtual void setRate(double rate); |
| 105 virtual void setVolume(double volume); | 103 virtual void setVolume(double volume); |
| 106 virtual blink::WebTimeRanges buffered() const; | 104 virtual blink::WebTimeRanges buffered() const; |
| 107 virtual double maxTimeSeekable() const; | 105 virtual double maxTimeSeekable() const; |
| 108 | 106 |
| 109 // Poster image, as defined in the <video> element. | 107 // Poster image, as defined in the <video> element. |
| 110 virtual void setPoster(const blink::WebURL& poster) OVERRIDE; | 108 virtual void setPoster(const blink::WebURL& poster) OVERRIDE; |
| 111 | 109 |
| 112 // Methods for painting. | 110 // Methods for painting. |
| 113 // FIXME: This path "only works" on Android. It is a workaround for the | |
| 114 // issue that Skia could not handle Android's GL_TEXTURE_EXTERNAL_OES texture | |
| 115 // internally. It should be removed and replaced by the normal paint path. | |
| 116 // https://code.google.com/p/skia/issues/detail?id=1189 | |
| 117 virtual void paint(blink::WebCanvas* canvas, | 111 virtual void paint(blink::WebCanvas* canvas, |
| 118 const blink::WebRect& rect, | 112 const blink::WebRect& rect, |
| 119 unsigned char alpha, | 113 unsigned char alpha, |
| 120 SkXfermode::Mode mode); | 114 SkXfermode::Mode mode); |
| 121 // TODO(dshwang): remove it because above method replaces. crbug.com/401027 | 115 // TODO(dshwang): remove it because above method replaces. crbug.com/401027 |
| 122 virtual void paint(blink::WebCanvas* canvas, | 116 virtual void paint(blink::WebCanvas* canvas, |
| 123 const blink::WebRect& rect, | 117 const blink::WebRect& rect, |
| 124 unsigned char alpha); | 118 unsigned char alpha); |
| 125 | 119 |
| 126 virtual bool copyVideoTextureToPlatformTexture( | 120 virtual bool copyVideoTextureToPlatformTexture( |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // If |decryptor_ready_cb| is null, the existing callback will be fired with | 299 // If |decryptor_ready_cb| is null, the existing callback will be fired with |
| 306 // NULL immediately and reset. | 300 // NULL immediately and reset. |
| 307 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); | 301 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); |
| 308 | 302 |
| 309 // Called when the ContentDecryptionModule has been attached to the | 303 // Called when the ContentDecryptionModule has been attached to the |
| 310 // pipeline/decoders. | 304 // pipeline/decoders. |
| 311 void ContentDecryptionModuleAttached( | 305 void ContentDecryptionModuleAttached( |
| 312 blink::WebContentDecryptionModuleResult result, | 306 blink::WebContentDecryptionModuleResult result, |
| 313 bool success); | 307 bool success); |
| 314 | 308 |
| 315 bool EnsureTextureBackedSkBitmap(GrContext* gr, SkBitmap& bitmap, | |
| 316 const blink::WebSize& size, | |
| 317 GrSurfaceOrigin origin, | |
| 318 GrPixelConfig config); | |
| 319 | |
| 320 bool IsHLSStream() const; | 309 bool IsHLSStream() const; |
| 321 | 310 |
| 322 blink::WebFrame* const frame_; | 311 blink::WebFrame* const frame_; |
| 323 | 312 |
| 324 blink::WebMediaPlayerClient* const client_; | 313 blink::WebMediaPlayerClient* const client_; |
| 325 | 314 |
| 326 // |delegate_| is used to notify the browser process of the player status, so | 315 // |delegate_| is used to notify the browser process of the player status, so |
| 327 // that the browser process can control screen locks. | 316 // that the browser process can control screen locks. |
| 328 // TODO(qinmin): Currently android mediaplayer takes care of the screen | 317 // TODO(qinmin): Currently android mediaplayer takes care of the screen |
| 329 // lock. So this is only used for media source. Will apply this to regular | 318 // lock. So this is only used for media source. Will apply this to regular |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 // Non-owned pointer to the CDM. Updated via calls to | 460 // Non-owned pointer to the CDM. Updated via calls to |
| 472 // setContentDecryptionModule(). | 461 // setContentDecryptionModule(). |
| 473 WebContentDecryptionModuleImpl* web_cdm_; | 462 WebContentDecryptionModuleImpl* web_cdm_; |
| 474 | 463 |
| 475 // This is only Used by Clear Key key system implementation, where a renderer | 464 // This is only Used by Clear Key key system implementation, where a renderer |
| 476 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key | 465 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key |
| 477 // systems, a browser side CDM will be used and we set CDM by calling | 466 // systems, a browser side CDM will be used and we set CDM by calling |
| 478 // player_manager_->SetCdm() directly. | 467 // player_manager_->SetCdm() directly. |
| 479 media::DecryptorReadyCB decryptor_ready_cb_; | 468 media::DecryptorReadyCB decryptor_ready_cb_; |
| 480 | 469 |
| 481 SkBitmap bitmap_; | 470 media::SkCanvasVideoRenderer skcanvas_video_renderer_; |
| 482 | 471 |
| 483 // Whether stored credentials are allowed to be passed to the server. | 472 // Whether stored credentials are allowed to be passed to the server. |
| 484 bool allow_stored_credentials_; | 473 bool allow_stored_credentials_; |
| 485 | 474 |
| 486 // NOTE: Weak pointers must be invalidated before all other member variables. | 475 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 487 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 476 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
| 488 | 477 |
| 489 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 478 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
| 490 }; | 479 }; |
| 491 | 480 |
| 492 } // namespace content | 481 } // namespace content |
| 493 | 482 |
| 494 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 483 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| OLD | NEW |