| 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/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "base/time/default_tick_clock.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 18 #include "cc/layers/video_frame_provider.h" | 19 #include "cc/layers/video_frame_provider.h" |
| 19 #include "content/common/media/media_player_messages_enums_android.h" | 20 #include "content/common/media/media_player_messages_enums_android.h" |
| 20 #include "content/public/renderer/render_frame_observer.h" | 21 #include "content/public/renderer/render_frame_observer.h" |
| 21 #include "content/renderer/media/android/media_info_loader.h" | 22 #include "content/renderer/media/android/media_info_loader.h" |
| 22 #include "content/renderer/media/android/media_source_delegate.h" | 23 #include "content/renderer/media/android/media_source_delegate.h" |
| 23 #include "content/renderer/media/android/stream_texture_factory.h" | 24 #include "content/renderer/media/android/stream_texture_factory.h" |
| 24 #include "content/renderer/media/crypto/proxy_decryptor.h" | 25 #include "content/renderer/media/crypto/proxy_decryptor.h" |
| 25 #include "gpu/command_buffer/common/mailbox.h" | 26 #include "gpu/command_buffer/common/mailbox.h" |
| 26 #include "media/base/android/media_player_android.h" | 27 #include "media/base/android/media_player_android.h" |
| 27 #include "media/base/demuxer_stream.h" | 28 #include "media/base/demuxer_stream.h" |
| 28 #include "media/base/media_keys.h" | 29 #include "media/base/media_keys.h" |
| 30 #include "media/base/time_delta_interpolator.h" |
| 29 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 31 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 30 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 32 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 31 #include "third_party/WebKit/public/platform/WebSize.h" | 33 #include "third_party/WebKit/public/platform/WebSize.h" |
| 32 #include "third_party/WebKit/public/platform/WebURL.h" | 34 #include "third_party/WebKit/public/platform/WebURL.h" |
| 33 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
| 34 #include "third_party/skia/include/gpu/GrContext.h" | 36 #include "third_party/skia/include/gpu/GrContext.h" |
| 35 #include "third_party/skia/include/gpu/SkGrPixelRef.h" | 37 #include "third_party/skia/include/gpu/SkGrPixelRef.h" |
| 36 #include "ui/gfx/rect_f.h" | 38 #include "ui/gfx/rect_f.h" |
| 37 | 39 |
| 38 namespace base { | 40 namespace base { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 int height, bool success); | 180 int height, bool success); |
| 179 void OnPlaybackComplete(); | 181 void OnPlaybackComplete(); |
| 180 void OnBufferingUpdate(int percentage); | 182 void OnBufferingUpdate(int percentage); |
| 181 void OnSeekRequest(const base::TimeDelta& time_to_seek); | 183 void OnSeekRequest(const base::TimeDelta& time_to_seek); |
| 182 void OnSeekComplete(const base::TimeDelta& current_time); | 184 void OnSeekComplete(const base::TimeDelta& current_time); |
| 183 void OnMediaError(int error_type); | 185 void OnMediaError(int error_type); |
| 184 void OnVideoSizeChanged(int width, int height); | 186 void OnVideoSizeChanged(int width, int height); |
| 185 void OnDurationChanged(const base::TimeDelta& duration); | 187 void OnDurationChanged(const base::TimeDelta& duration); |
| 186 | 188 |
| 187 // Called to update the current time. | 189 // Called to update the current time. |
| 188 void OnTimeUpdate(const base::TimeDelta& current_time); | 190 void OnTimeUpdate(base::TimeDelta current_timestamp, |
| 191 base::TimeTicks current_time_ticks); |
| 189 | 192 |
| 190 // Functions called when media player status changes. | 193 // Functions called when media player status changes. |
| 191 void OnConnectedToRemoteDevice(const std::string& remote_playback_message); | 194 void OnConnectedToRemoteDevice(const std::string& remote_playback_message); |
| 192 void OnDisconnectedFromRemoteDevice(); | 195 void OnDisconnectedFromRemoteDevice(); |
| 193 void OnDidEnterFullscreen(); | 196 void OnDidEnterFullscreen(); |
| 194 void OnDidExitFullscreen(); | 197 void OnDidExitFullscreen(); |
| 195 void OnMediaPlayerPlay(); | 198 void OnMediaPlayerPlay(); |
| 196 void OnMediaPlayerPause(); | 199 void OnMediaPlayerPause(); |
| 197 void OnRequestFullscreen(); | 200 void OnRequestFullscreen(); |
| 198 | 201 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 448 |
| 446 scoped_ptr<MediaSourceDelegate, | 449 scoped_ptr<MediaSourceDelegate, |
| 447 MediaSourceDelegate::Destroyer> media_source_delegate_; | 450 MediaSourceDelegate::Destroyer> media_source_delegate_; |
| 448 | 451 |
| 449 // Internal pending playback state. | 452 // Internal pending playback state. |
| 450 // Store a playback request that cannot be started immediately. | 453 // Store a playback request that cannot be started immediately. |
| 451 bool pending_playback_; | 454 bool pending_playback_; |
| 452 | 455 |
| 453 MediaPlayerHostMsg_Initialize_Type player_type_; | 456 MediaPlayerHostMsg_Initialize_Type player_type_; |
| 454 | 457 |
| 455 // The current playing time. Because the media player is in the browser | |
| 456 // process, it will regularly update the |current_time_| by calling | |
| 457 // OnTimeUpdate(). | |
| 458 double current_time_; | |
| 459 | |
| 460 // Whether the browser is currently connected to a remote media player. | 458 // Whether the browser is currently connected to a remote media player. |
| 461 bool is_remote_; | 459 bool is_remote_; |
| 462 | 460 |
| 463 scoped_refptr<media::MediaLog> media_log_; | 461 scoped_refptr<media::MediaLog> media_log_; |
| 464 | 462 |
| 465 scoped_ptr<MediaInfoLoader> info_loader_; | 463 scoped_ptr<MediaInfoLoader> info_loader_; |
| 466 | 464 |
| 467 // The currently selected key system. Empty string means that no key system | 465 // The currently selected key system. Empty string means that no key system |
| 468 // has been selected. | 466 // has been selected. |
| 469 std::string current_key_system_; | 467 std::string current_key_system_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 486 media::DecryptorReadyCB decryptor_ready_cb_; | 484 media::DecryptorReadyCB decryptor_ready_cb_; |
| 487 | 485 |
| 488 SkBitmap bitmap_; | 486 SkBitmap bitmap_; |
| 489 | 487 |
| 490 // Whether stored credentials are allowed to be passed to the server. | 488 // Whether stored credentials are allowed to be passed to the server. |
| 491 bool allow_stored_credentials_; | 489 bool allow_stored_credentials_; |
| 492 | 490 |
| 493 // Whether the resource is local. | 491 // Whether the resource is local. |
| 494 bool is_local_resource_; | 492 bool is_local_resource_; |
| 495 | 493 |
| 494 // base::TickClock used by |interpolator_|. |
| 495 base::DefaultTickClock default_tick_clock_; |
| 496 |
| 497 // Tracks the most recent media time update and provides interpolated values |
| 498 // as playback progresses. |
| 499 media::TimeDeltaInterpolator interpolator_; |
| 500 |
| 496 // NOTE: Weak pointers must be invalidated before all other member variables. | 501 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 497 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 502 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
| 498 | 503 |
| 499 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 504 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
| 500 }; | 505 }; |
| 501 | 506 |
| 502 } // namespace content | 507 } // namespace content |
| 503 | 508 |
| 504 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 509 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| OLD | NEW |