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 | |
dshwang
2014/10/13 17:07:42
Remove the stale comment. Currently, blink uses We
| |
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 // TODO(dshwang): remove it because above method replaces. crbug.com/401027 | 123 // TODO(dshwang): remove it because above method replaces. crbug.com/401027 |
130 virtual void paint(blink::WebCanvas* canvas, | 124 virtual void paint(blink::WebCanvas* canvas, |
131 const blink::WebRect& rect, | 125 const blink::WebRect& rect, |
132 unsigned char alpha); | 126 unsigned char alpha); |
133 | 127 |
134 virtual bool copyVideoTextureToPlatformTexture( | 128 virtual bool copyVideoTextureToPlatformTexture( |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 // If |decryptor_ready_cb| is null, the existing callback will be fired with | 313 // If |decryptor_ready_cb| is null, the existing callback will be fired with |
320 // NULL immediately and reset. | 314 // NULL immediately and reset. |
321 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); | 315 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); |
322 | 316 |
323 // Called when the ContentDecryptionModule has been attached to the | 317 // Called when the ContentDecryptionModule has been attached to the |
324 // pipeline/decoders. | 318 // pipeline/decoders. |
325 void ContentDecryptionModuleAttached( | 319 void ContentDecryptionModuleAttached( |
326 blink::WebContentDecryptionModuleResult result, | 320 blink::WebContentDecryptionModuleResult result, |
327 bool success); | 321 bool success); |
328 | 322 |
329 bool EnsureTextureBackedSkBitmap(GrContext* gr, SkBitmap& bitmap, | |
330 const blink::WebSize& size, | |
331 GrSurfaceOrigin origin, | |
332 GrPixelConfig config); | |
333 | |
334 bool IsHLSStream() const; | 323 bool IsHLSStream() const; |
335 | 324 |
336 blink::WebFrame* const frame_; | 325 blink::WebFrame* const frame_; |
337 | 326 |
338 blink::WebMediaPlayerClient* const client_; | 327 blink::WebMediaPlayerClient* const client_; |
339 | 328 |
340 // |delegate_| is used to notify the browser process of the player status, so | 329 // |delegate_| is used to notify the browser process of the player status, so |
341 // that the browser process can control screen locks. | 330 // that the browser process can control screen locks. |
342 // TODO(qinmin): Currently android mediaplayer takes care of the screen | 331 // TODO(qinmin): Currently android mediaplayer takes care of the screen |
343 // lock. So this is only used for media source. Will apply this to regular | 332 // 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... | |
480 // Non-owned pointer to the CDM. Updated via calls to | 469 // Non-owned pointer to the CDM. Updated via calls to |
481 // setContentDecryptionModule(). | 470 // setContentDecryptionModule(). |
482 WebContentDecryptionModuleImpl* web_cdm_; | 471 WebContentDecryptionModuleImpl* web_cdm_; |
483 | 472 |
484 // This is only Used by Clear Key key system implementation, where a renderer | 473 // This is only Used by Clear Key key system implementation, where a renderer |
485 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key | 474 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key |
486 // systems, a browser side CDM will be used and we set CDM by calling | 475 // systems, a browser side CDM will be used and we set CDM by calling |
487 // player_manager_->SetCdm() directly. | 476 // player_manager_->SetCdm() directly. |
488 media::DecryptorReadyCB decryptor_ready_cb_; | 477 media::DecryptorReadyCB decryptor_ready_cb_; |
489 | 478 |
490 SkBitmap bitmap_; | 479 media::SkCanvasVideoRenderer skcanvas_video_renderer_; |
491 | 480 |
492 // Whether stored credentials are allowed to be passed to the server. | 481 // Whether stored credentials are allowed to be passed to the server. |
493 bool allow_stored_credentials_; | 482 bool allow_stored_credentials_; |
494 | 483 |
495 // Whether the resource is local. | 484 // Whether the resource is local. |
496 bool is_local_resource_; | 485 bool is_local_resource_; |
497 | 486 |
498 // base::TickClock used by |interpolator_|. | 487 // base::TickClock used by |interpolator_|. |
499 base::DefaultTickClock default_tick_clock_; | 488 base::DefaultTickClock default_tick_clock_; |
500 | 489 |
501 // Tracks the most recent media time update and provides interpolated values | 490 // Tracks the most recent media time update and provides interpolated values |
502 // as playback progresses. | 491 // as playback progresses. |
503 media::TimeDeltaInterpolator interpolator_; | 492 media::TimeDeltaInterpolator interpolator_; |
504 | 493 |
505 scoped_ptr<MediaSourceDelegate> media_source_delegate_; | 494 scoped_ptr<MediaSourceDelegate> media_source_delegate_; |
506 | 495 |
507 // NOTE: Weak pointers must be invalidated before all other member variables. | 496 // NOTE: Weak pointers must be invalidated before all other member variables. |
508 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 497 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
509 | 498 |
510 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 499 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
511 }; | 500 }; |
512 | 501 |
513 } // namespace content | 502 } // namespace content |
514 | 503 |
515 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 504 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |