OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define WEBKIT_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 "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
| 19 #include "ui/gfx/rect_f.h" |
19 #include "webkit/media/android/stream_texture_factory_android.h" | 20 #include "webkit/media/android/stream_texture_factory_android.h" |
20 | 21 |
21 namespace webkit { | 22 namespace webkit { |
22 class WebLayerImpl; | 23 class WebLayerImpl; |
23 } | 24 } |
24 | 25 |
25 namespace webkit_media { | 26 namespace webkit_media { |
26 | 27 |
27 class WebMediaPlayerManagerAndroid; | 28 class WebMediaPlayerManagerAndroid; |
28 | 29 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 126 |
126 // Method to set the surface for video. | 127 // Method to set the surface for video. |
127 virtual void SetVideoSurface(jobject j_surface) = 0; | 128 virtual void SetVideoSurface(jobject j_surface) = 0; |
128 | 129 |
129 // Method inherited from DestructionObserver. | 130 // Method inherited from DestructionObserver. |
130 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 131 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
131 | 132 |
132 // Detach the player from its manager. | 133 // Detach the player from its manager. |
133 void Detach(); | 134 void Detach(); |
134 | 135 |
| 136 // Retrieve geometry of the media player (i.e. location and size of the video |
| 137 // frame) if changed. Returns true only if the geometry has been changed since |
| 138 // the last call. |
| 139 bool GetGeometryChange(gfx::RectF* rect); |
| 140 |
135 protected: | 141 protected: |
136 // Construct a WebMediaPlayerAndroid object with reference to the | 142 // Construct a WebMediaPlayerAndroid object with reference to the |
137 // client, manager and stream texture factory. | 143 // client, manager and stream texture factory. |
138 WebMediaPlayerAndroid(WebKit::WebMediaPlayerClient* client, | 144 WebMediaPlayerAndroid(WebKit::WebMediaPlayerClient* client, |
139 WebMediaPlayerManagerAndroid* manager, | 145 WebMediaPlayerManagerAndroid* manager, |
140 StreamTextureFactory* factory); | 146 StreamTextureFactory* factory); |
141 virtual ~WebMediaPlayerAndroid(); | 147 virtual ~WebMediaPlayerAndroid(); |
142 | 148 |
143 // Helper method to update the playing state. | 149 // Helper method to update the playing state. |
144 virtual void UpdatePlayingState(bool is_playing_); | 150 virtual void UpdatePlayingState(bool is_playing_); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 257 |
252 // Whether media player needs external surface. | 258 // Whether media player needs external surface. |
253 bool needs_external_surface_; | 259 bool needs_external_surface_; |
254 | 260 |
255 // A pointer back to the compositor to inform it about state changes. This is | 261 // A pointer back to the compositor to inform it about state changes. This is |
256 // not NULL while the compositor is actively using this webmediaplayer. | 262 // not NULL while the compositor is actively using this webmediaplayer. |
257 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 263 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
258 | 264 |
259 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | 265 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; |
260 | 266 |
| 267 // A rectangle represents the geometry of video frame, when computed last |
| 268 // time. |
| 269 gfx::RectF last_computed_rect_; |
| 270 |
261 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 271 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
262 }; | 272 }; |
263 | 273 |
264 } // namespace webkit_media | 274 } // namespace webkit_media |
265 | 275 |
266 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 276 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |