| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "content/public/renderer/render_frame_observer.h" | 21 #include "content/public/renderer/render_frame_observer.h" |
| 22 #include "content/renderer/media/android/media_info_loader.h" | 22 #include "content/renderer/media/android/media_info_loader.h" |
| 23 #include "content/renderer/media/android/media_source_delegate.h" | 23 #include "content/renderer/media/android/media_source_delegate.h" |
| 24 #include "content/renderer/media/android/stream_texture_factory.h" | 24 #include "content/renderer/media/android/stream_texture_factory.h" |
| 25 #include "content/renderer/media/crypto/proxy_decryptor.h" | 25 #include "content/renderer/media/crypto/proxy_decryptor.h" |
| 26 #include "gpu/command_buffer/common/mailbox.h" | 26 #include "gpu/command_buffer/common/mailbox.h" |
| 27 #include "media/base/android/media_player_android.h" | 27 #include "media/base/android/media_player_android.h" |
| 28 #include "media/base/demuxer_stream.h" | 28 #include "media/base/demuxer_stream.h" |
| 29 #include "media/base/media_keys.h" | 29 #include "media/base/media_keys.h" |
| 30 #include "media/base/time_delta_interpolator.h" | 30 #include "media/base/time_delta_interpolator.h" |
| 31 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 31 #include "media/filters/skcanvas_video_renderer.h" |
| 32 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 32 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 33 #include "third_party/WebKit/public/platform/WebSize.h" | 33 #include "third_party/WebKit/public/platform/WebSize.h" |
| 34 #include "third_party/WebKit/public/platform/WebURL.h" | 34 #include "third_party/WebKit/public/platform/WebURL.h" |
| 35 #include "third_party/skia/include/core/SkBitmap.h" | |
| 36 #include "third_party/skia/include/gpu/GrContext.h" | |
| 37 #include "third_party/skia/include/gpu/SkGrPixelRef.h" | |
| 38 #include "ui/gfx/rect_f.h" | 35 #include "ui/gfx/rect_f.h" |
| 39 | 36 |
| 40 namespace base { | 37 namespace base { |
| 41 class SingleThreadTaskRunner; | 38 class SingleThreadTaskRunner; |
| 42 } | 39 } |
| 43 | 40 |
| 44 namespace blink { | 41 namespace blink { |
| 45 class WebContentDecryptionModule; | 42 class WebContentDecryptionModule; |
| 46 class WebContentDecryptionModuleResult; | 43 class WebContentDecryptionModuleResult; |
| 47 class WebFrame; | 44 class WebFrame; |
| 45 class WebGraphicsContext3D; |
| 48 class WebURL; | 46 class WebURL; |
| 49 } | 47 } |
| 50 | 48 |
| 51 namespace cc_blink { | 49 namespace cc_blink { |
| 52 class WebLayerImpl; | 50 class WebLayerImpl; |
| 53 } | 51 } |
| 54 | 52 |
| 55 namespace gpu { | 53 namespace gpu { |
| 56 struct MailboxHolder; | 54 struct MailboxHolder; |
| 57 } | 55 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 virtual void setVolume(double volume); | 109 virtual void setVolume(double volume); |
| 112 virtual void requestRemotePlayback(); | 110 virtual void requestRemotePlayback(); |
| 113 virtual void requestRemotePlaybackControl(); | 111 virtual void requestRemotePlaybackControl(); |
| 114 virtual blink::WebTimeRanges buffered() const; | 112 virtual blink::WebTimeRanges buffered() const; |
| 115 virtual blink::WebTimeRanges seekable() const; | 113 virtual blink::WebTimeRanges seekable() const; |
| 116 | 114 |
| 117 // Poster image, as defined in the <video> element. | 115 // Poster image, as defined in the <video> element. |
| 118 virtual void setPoster(const blink::WebURL& poster) override; | 116 virtual void setPoster(const blink::WebURL& poster) override; |
| 119 | 117 |
| 120 // Methods for painting. | 118 // Methods for painting. |
| 121 // FIXME: This path "only works" on Android. It is a workaround for the | |
| 122 // issue that Skia could not handle Android's GL_TEXTURE_EXTERNAL_OES texture | |
| 123 // internally. It should be removed and replaced by the normal paint path. | |
| 124 // https://code.google.com/p/skia/issues/detail?id=1189 | |
| 125 virtual void paint(blink::WebCanvas* canvas, | 119 virtual void paint(blink::WebCanvas* canvas, |
| 126 const blink::WebRect& rect, | 120 const blink::WebRect& rect, |
| 127 unsigned char alpha, | 121 unsigned char alpha, |
| 128 SkXfermode::Mode mode); | 122 SkXfermode::Mode mode); |
| 129 | 123 |
| 130 virtual bool copyVideoTextureToPlatformTexture( | 124 virtual bool copyVideoTextureToPlatformTexture( |
| 131 blink::WebGraphicsContext3D* web_graphics_context, | 125 blink::WebGraphicsContext3D* web_graphics_context, |
| 132 unsigned int texture, | 126 unsigned int texture, |
| 133 unsigned int level, | 127 unsigned int level, |
| 134 unsigned int internal_format, | 128 unsigned int internal_format, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // If |decryptor_ready_cb| is null, the existing callback will be fired with | 309 // If |decryptor_ready_cb| is null, the existing callback will be fired with |
| 316 // NULL immediately and reset. | 310 // NULL immediately and reset. |
| 317 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); | 311 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); |
| 318 | 312 |
| 319 // Called when the ContentDecryptionModule has been attached to the | 313 // Called when the ContentDecryptionModule has been attached to the |
| 320 // pipeline/decoders. | 314 // pipeline/decoders. |
| 321 void ContentDecryptionModuleAttached( | 315 void ContentDecryptionModuleAttached( |
| 322 blink::WebContentDecryptionModuleResult result, | 316 blink::WebContentDecryptionModuleResult result, |
| 323 bool success); | 317 bool success); |
| 324 | 318 |
| 325 bool EnsureTextureBackedSkBitmap(GrContext* gr, SkBitmap& bitmap, | |
| 326 const blink::WebSize& size, | |
| 327 GrSurfaceOrigin origin, | |
| 328 GrPixelConfig config); | |
| 329 | |
| 330 bool IsHLSStream() const; | 319 bool IsHLSStream() const; |
| 331 | 320 |
| 332 blink::WebFrame* const frame_; | 321 blink::WebFrame* const frame_; |
| 333 | 322 |
| 334 blink::WebMediaPlayerClient* const client_; | 323 blink::WebMediaPlayerClient* const client_; |
| 335 | 324 |
| 336 // |delegate_| is used to notify the browser process of the player status, so | 325 // |delegate_| is used to notify the browser process of the player status, so |
| 337 // that the browser process can control screen locks. | 326 // that the browser process can control screen locks. |
| 338 // TODO(qinmin): Currently android mediaplayer takes care of the screen | 327 // TODO(qinmin): Currently android mediaplayer takes care of the screen |
| 339 // lock. So this is only used for media source. Will apply this to regular | 328 // lock. So this is only used for media source. Will apply this to regular |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // Non-owned pointer to the CDM. Updated via calls to | 465 // Non-owned pointer to the CDM. Updated via calls to |
| 477 // setContentDecryptionModule(). | 466 // setContentDecryptionModule(). |
| 478 WebContentDecryptionModuleImpl* web_cdm_; | 467 WebContentDecryptionModuleImpl* web_cdm_; |
| 479 | 468 |
| 480 // This is only Used by Clear Key key system implementation, where a renderer | 469 // This is only Used by Clear Key key system implementation, where a renderer |
| 481 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key | 470 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key |
| 482 // systems, a browser side CDM will be used and we set CDM by calling | 471 // systems, a browser side CDM will be used and we set CDM by calling |
| 483 // player_manager_->SetCdm() directly. | 472 // player_manager_->SetCdm() directly. |
| 484 media::DecryptorReadyCB decryptor_ready_cb_; | 473 media::DecryptorReadyCB decryptor_ready_cb_; |
| 485 | 474 |
| 486 SkBitmap bitmap_; | 475 media::SkCanvasVideoRenderer skcanvas_video_renderer_; |
| 487 | 476 |
| 488 // Whether stored credentials are allowed to be passed to the server. | 477 // Whether stored credentials are allowed to be passed to the server. |
| 489 bool allow_stored_credentials_; | 478 bool allow_stored_credentials_; |
| 490 | 479 |
| 491 // Whether the resource is local. | 480 // Whether the resource is local. |
| 492 bool is_local_resource_; | 481 bool is_local_resource_; |
| 493 | 482 |
| 494 // base::TickClock used by |interpolator_|. | 483 // base::TickClock used by |interpolator_|. |
| 495 base::DefaultTickClock default_tick_clock_; | 484 base::DefaultTickClock default_tick_clock_; |
| 496 | 485 |
| 497 // Tracks the most recent media time update and provides interpolated values | 486 // Tracks the most recent media time update and provides interpolated values |
| 498 // as playback progresses. | 487 // as playback progresses. |
| 499 media::TimeDeltaInterpolator interpolator_; | 488 media::TimeDeltaInterpolator interpolator_; |
| 500 | 489 |
| 501 scoped_ptr<MediaSourceDelegate> media_source_delegate_; | 490 scoped_ptr<MediaSourceDelegate> media_source_delegate_; |
| 502 | 491 |
| 503 // NOTE: Weak pointers must be invalidated before all other member variables. | 492 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 504 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 493 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
| 505 | 494 |
| 506 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 495 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
| 507 }; | 496 }; |
| 508 | 497 |
| 509 } // namespace content | 498 } // namespace content |
| 510 | 499 |
| 511 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 500 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| OLD | NEW |