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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/public/renderer/render_frame_observer.h" | 22 #include "content/public/renderer/render_frame_observer.h" |
23 #include "content/renderer/media/android/media_info_loader.h" | 23 #include "content/renderer/media/android/media_info_loader.h" |
24 #include "content/renderer/media/android/media_source_delegate.h" | 24 #include "content/renderer/media/android/media_source_delegate.h" |
25 #include "content/renderer/media/android/stream_texture_factory.h" | 25 #include "content/renderer/media/android/stream_texture_factory.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/cdm_context.h" | 28 #include "media/base/cdm_context.h" |
29 #include "media/base/demuxer_stream.h" | 29 #include "media/base/demuxer_stream.h" |
30 #include "media/base/media_keys.h" | 30 #include "media/base/media_keys.h" |
31 #include "media/base/time_delta_interpolator.h" | 31 #include "media/base/time_delta_interpolator.h" |
| 32 #include "media/blink/webmediaplayer_delegate.h" |
32 #include "media/blink/webmediaplayer_params.h" | 33 #include "media/blink/webmediaplayer_params.h" |
33 #include "media/cdm/proxy_decryptor.h" | 34 #include "media/cdm/proxy_decryptor.h" |
34 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 35 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
35 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 36 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
36 #include "third_party/WebKit/public/platform/WebSetSinkIdCallbacks.h" | 37 #include "third_party/WebKit/public/platform/WebSetSinkIdCallbacks.h" |
37 #include "third_party/WebKit/public/platform/WebSize.h" | 38 #include "third_party/WebKit/public/platform/WebSize.h" |
38 #include "third_party/WebKit/public/platform/WebURL.h" | 39 #include "third_party/WebKit/public/platform/WebURL.h" |
39 #include "third_party/skia/include/core/SkBitmap.h" | 40 #include "third_party/skia/include/core/SkBitmap.h" |
40 #include "ui/gfx/geometry/rect_f.h" | 41 #include "ui/gfx/geometry/rect_f.h" |
41 | 42 |
(...skipping 17 matching lines...) Expand all Loading... |
59 namespace gpu { | 60 namespace gpu { |
60 struct MailboxHolder; | 61 struct MailboxHolder; |
61 } | 62 } |
62 | 63 |
63 namespace media { | 64 namespace media { |
64 class CdmContext; | 65 class CdmContext; |
65 class CdmFactory; | 66 class CdmFactory; |
66 class MediaLog; | 67 class MediaLog; |
67 class MediaPermission; | 68 class MediaPermission; |
68 class WebContentDecryptionModuleImpl; | 69 class WebContentDecryptionModuleImpl; |
69 class WebMediaPlayerDelegate; | |
70 } | 70 } |
71 | 71 |
72 namespace content { | 72 namespace content { |
73 | 73 |
74 class RendererCdmManager; | 74 class RendererCdmManager; |
75 class RendererMediaPlayerManager; | 75 class RendererMediaPlayerManager; |
76 | 76 |
77 // This class implements blink::WebMediaPlayer by keeping the android | 77 // This class implements blink::WebMediaPlayer by keeping the android |
78 // media player in the browser process. It listens to all the status changes | 78 // media player in the browser process. It listens to all the status changes |
79 // sent from the browser process and sends playback controls to the media | 79 // sent from the browser process and sends playback controls to the media |
80 // player. | 80 // player. |
81 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, | 81 class WebMediaPlayerAndroid |
82 public cc::VideoFrameProvider, | 82 : public blink::WebMediaPlayer, |
83 public RenderFrameObserver, | 83 public cc::VideoFrameProvider, |
84 public StreamTextureFactoryContextObserver { | 84 public RenderFrameObserver, |
| 85 public NON_EXPORTED_BASE(media::WebMediaPlayerDelegate::Observer), |
| 86 public StreamTextureFactoryContextObserver { |
85 public: | 87 public: |
86 // Construct a WebMediaPlayerAndroid object. This class communicates with the | 88 // Construct a WebMediaPlayerAndroid object. This class communicates with the |
87 // MediaPlayerAndroid object in the browser process through |proxy|. | 89 // MediaPlayerAndroid object in the browser process through |proxy|. |
88 // TODO(qinmin): |frame| argument is used to determine whether the current | 90 // TODO(qinmin): |frame| argument is used to determine whether the current |
89 // player can enter fullscreen. This logic should probably be moved into | 91 // player can enter fullscreen. This logic should probably be moved into |
90 // blink, so that enterFullscreen() will not be called if another video is | 92 // blink, so that enterFullscreen() will not be called if another video is |
91 // already in fullscreen. | 93 // already in fullscreen. |
92 WebMediaPlayerAndroid( | 94 WebMediaPlayerAndroid( |
93 blink::WebFrame* frame, | 95 blink::WebFrame* frame, |
94 blink::WebMediaPlayerClient* client, | 96 blink::WebMediaPlayerClient* client, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 264 |
263 void OnMediaSourceOpened(blink::WebMediaSource* web_media_source); | 265 void OnMediaSourceOpened(blink::WebMediaSource* web_media_source); |
264 | 266 |
265 void OnEncryptedMediaInitData(media::EmeInitDataType init_data_type, | 267 void OnEncryptedMediaInitData(media::EmeInitDataType init_data_type, |
266 const std::vector<uint8_t>& init_data); | 268 const std::vector<uint8_t>& init_data); |
267 | 269 |
268 // Called when a decoder detects that the key needed to decrypt the stream | 270 // Called when a decoder detects that the key needed to decrypt the stream |
269 // is not available. | 271 // is not available. |
270 void OnWaitingForDecryptionKey(); | 272 void OnWaitingForDecryptionKey(); |
271 | 273 |
| 274 // WebMediaPlayerDelegate::Observer implementation. |
| 275 blink::WebMediaPlayer* GetPlayer() override; |
| 276 void OnHidden() override; |
| 277 void OnShown() override; |
| 278 void OnPlay() override; |
| 279 void OnPause() override; |
| 280 |
272 protected: | 281 protected: |
273 // Helper method to update the playing state. | 282 // Helper method to update the playing state. |
274 void UpdatePlayingState(bool is_playing_); | 283 void UpdatePlayingState(bool is_playing_); |
275 | 284 |
276 // Helper methods for posting task for setting states and update WebKit. | 285 // Helper methods for posting task for setting states and update WebKit. |
277 void UpdateNetworkState(blink::WebMediaPlayer::NetworkState state); | 286 void UpdateNetworkState(blink::WebMediaPlayer::NetworkState state); |
278 void UpdateReadyState(blink::WebMediaPlayer::ReadyState state); | 287 void UpdateReadyState(blink::WebMediaPlayer::ReadyState state); |
279 void TryCreateStreamTextureProxyIfNeeded(); | 288 void TryCreateStreamTextureProxyIfNeeded(); |
280 void DoCreateStreamTexture(); | 289 void DoCreateStreamTexture(); |
281 | 290 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 548 |
540 // NOTE: Weak pointers must be invalidated before all other member variables. | 549 // NOTE: Weak pointers must be invalidated before all other member variables. |
541 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 550 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
542 | 551 |
543 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 552 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
544 }; | 553 }; |
545 | 554 |
546 } // namespace content | 555 } // namespace content |
547 | 556 |
548 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 557 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |