| 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 WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| 6 #define WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "cc/layers/video_frame_provider.h" | 15 #include "cc/layers/video_frame_provider.h" |
| 16 #include "media/base/android/media_player_android.h" | 16 #include "media/base/android/media_player_android.h" |
| 17 #include "media/base/demuxer_stream.h" | 17 #include "media/base/demuxer_stream.h" |
| 18 #include "media/base/media_keys.h" | 18 #include "media/base/media_keys.h" |
| 19 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 19 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 20 #include "third_party/WebKit/public/platform/WebSize.h" | 20 #include "third_party/WebKit/public/platform/WebSize.h" |
| 21 #include "third_party/WebKit/public/platform/WebURL.h" | 21 #include "third_party/WebKit/public/platform/WebURL.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
| 23 #include "ui/gfx/rect_f.h" | 23 #include "ui/gfx/rect_f.h" |
| 24 #include "webkit/renderer/media/android/media_source_delegate.h" | 24 #include "webkit/renderer/media/android/media_source_delegate.h" |
| 25 #include "webkit/renderer/media/android/stream_texture_factory_android.h" | 25 #include "webkit/renderer/media/android/stream_texture_factory_android.h" |
| 26 #include "webkit/renderer/media/crypto/proxy_decryptor.h" | 26 #include "webkit/renderer/media/crypto/proxy_decryptor.h" |
| 27 #include "webkit/renderer/media/media_info_loader.h" |
| 27 | 28 |
| 28 namespace media { | 29 namespace media { |
| 29 class Demuxer; | 30 class Demuxer; |
| 30 class MediaLog; | 31 class MediaLog; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace WebKit { | 34 namespace WebKit { |
| 34 class WebFrame; | 35 class WebFrame; |
| 35 } | 36 } |
| 36 | 37 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 void UpdateReadyState(WebKit::WebMediaPlayer::ReadyState state); | 237 void UpdateReadyState(WebKit::WebMediaPlayer::ReadyState state); |
| 237 | 238 |
| 238 // Helper method to reestablish the surface texture peer for android | 239 // Helper method to reestablish the surface texture peer for android |
| 239 // media player. | 240 // media player. |
| 240 void EstablishSurfaceTexturePeer(); | 241 void EstablishSurfaceTexturePeer(); |
| 241 | 242 |
| 242 // Requesting whether the surface texture peer needs to be reestablished. | 243 // Requesting whether the surface texture peer needs to be reestablished. |
| 243 void SetNeedsEstablishPeer(bool needs_establish_peer); | 244 void SetNeedsEstablishPeer(bool needs_establish_peer); |
| 244 | 245 |
| 245 void InitializeMediaPlayer( | 246 void InitializeMediaPlayer( |
| 246 const WebKit::WebURL& url, | |
| 247 media::MediaPlayerAndroid::SourceType source_type); | 247 media::MediaPlayerAndroid::SourceType source_type); |
| 248 | 248 |
| 249 #if defined(GOOGLE_TV) | 249 #if defined(GOOGLE_TV) |
| 250 // Request external surface for out-of-band composition. | 250 // Request external surface for out-of-band composition. |
| 251 void RequestExternalSurface(); | 251 void RequestExternalSurface(); |
| 252 #endif | 252 #endif |
| 253 | 253 |
| 254 private: | 254 private: |
| 255 void ReallocateVideoFrame(); | 255 void ReallocateVideoFrame(); |
| 256 void DidLoadMediaInfo(MediaInfoLoader::Status status); |
| 256 | 257 |
| 257 // Actually do the work for generateKeyRequest/addKey so they can easily | 258 // Actually do the work for generateKeyRequest/addKey so they can easily |
| 258 // report results to UMA. | 259 // report results to UMA. |
| 259 MediaKeyException GenerateKeyRequestInternal( | 260 MediaKeyException GenerateKeyRequestInternal( |
| 260 const WebKit::WebString& key_system, | 261 const WebKit::WebString& key_system, |
| 261 const unsigned char* init_data, | 262 const unsigned char* init_data, |
| 262 unsigned init_data_length); | 263 unsigned init_data_length); |
| 263 MediaKeyException AddKeyInternal(const WebKit::WebString& key_system, | 264 MediaKeyException AddKeyInternal(const WebKit::WebString& key_system, |
| 264 const unsigned char* key, | 265 const unsigned char* key, |
| 265 unsigned key_length, | 266 unsigned key_length, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 323 |
| 323 // Whether media player needs to re-establish the surface texture peer. | 324 // Whether media player needs to re-establish the surface texture peer. |
| 324 bool needs_establish_peer_; | 325 bool needs_establish_peer_; |
| 325 | 326 |
| 326 // Whether |stream_texture_proxy_| is initialized. | 327 // Whether |stream_texture_proxy_| is initialized. |
| 327 bool stream_texture_proxy_initialized_; | 328 bool stream_texture_proxy_initialized_; |
| 328 | 329 |
| 329 // Whether the video size info is available. | 330 // Whether the video size info is available. |
| 330 bool has_size_info_; | 331 bool has_size_info_; |
| 331 | 332 |
| 333 // Whether the video metadata and info are available. |
| 334 bool has_media_metadata_; |
| 335 bool has_media_info_; |
| 336 |
| 332 // Object for allocating stream textures. | 337 // Object for allocating stream textures. |
| 333 scoped_ptr<StreamTextureFactory> stream_texture_factory_; | 338 scoped_ptr<StreamTextureFactory> stream_texture_factory_; |
| 334 | 339 |
| 335 // Object for calling back the compositor thread to repaint the video when a | 340 // Object for calling back the compositor thread to repaint the video when a |
| 336 // frame available. It should be initialized on the compositor thread. | 341 // frame available. It should be initialized on the compositor thread. |
| 337 ScopedStreamTextureProxy stream_texture_proxy_; | 342 ScopedStreamTextureProxy stream_texture_proxy_; |
| 338 | 343 |
| 339 // Whether media player needs external surface. | 344 // Whether media player needs external surface. |
| 340 bool needs_external_surface_; | 345 bool needs_external_surface_; |
| 341 | 346 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 365 WebMediaPlayerProxyAndroid* proxy_; | 370 WebMediaPlayerProxyAndroid* proxy_; |
| 366 | 371 |
| 367 // The current playing time. Because the media player is in the browser | 372 // The current playing time. Because the media player is in the browser |
| 368 // process, it will regularly update the |current_time_| by calling | 373 // process, it will regularly update the |current_time_| by calling |
| 369 // OnTimeUpdate(). | 374 // OnTimeUpdate(). |
| 370 double current_time_; | 375 double current_time_; |
| 371 | 376 |
| 372 media::MediaLog* media_log_; | 377 media::MediaLog* media_log_; |
| 373 MediaStreamClient* media_stream_client_; | 378 MediaStreamClient* media_stream_client_; |
| 374 | 379 |
| 380 scoped_ptr<MediaInfoLoader> info_loader_; |
| 381 |
| 375 // The currently selected key system. Empty string means that no key system | 382 // The currently selected key system. Empty string means that no key system |
| 376 // has been selected. | 383 // has been selected. |
| 377 WebKit::WebString current_key_system_; | 384 WebKit::WebString current_key_system_; |
| 378 | 385 |
| 379 // Temporary for EME v0.1. In the future the init data type should be passed | 386 // Temporary for EME v0.1. In the future the init data type should be passed |
| 380 // through GenerateKeyRequest() directly from WebKit. | 387 // through GenerateKeyRequest() directly from WebKit. |
| 381 std::string init_data_type_; | 388 std::string init_data_type_; |
| 382 | 389 |
| 383 // The decryptor that manages decryption keys and decrypts encrypted frames. | 390 // The decryptor that manages decryption keys and decrypts encrypted frames. |
| 384 scoped_ptr<ProxyDecryptor> decryptor_; | 391 scoped_ptr<ProxyDecryptor> decryptor_; |
| 385 | 392 |
| 386 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 393 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
| 387 }; | 394 }; |
| 388 | 395 |
| 389 } // namespace webkit_media | 396 } // namespace webkit_media |
| 390 | 397 |
| 391 #endif // WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 398 #endif // WEBKIT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| OLD | NEW |