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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 134 |
134 // Method to set the surface for video. | 135 // Method to set the surface for video. |
135 virtual void SetVideoSurface(jobject j_surface) = 0; | 136 virtual void SetVideoSurface(jobject j_surface) = 0; |
136 | 137 |
137 // Method inherited from DestructionObserver. | 138 // Method inherited from DestructionObserver. |
138 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 139 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
139 | 140 |
140 // Detach the player from its manager. | 141 // Detach the player from its manager. |
141 void Detach(); | 142 void Detach(); |
142 | 143 |
| 144 #if defined(GOOGLE_TV) |
| 145 // Retrieve geometry of the media player (i.e. location and size of the video |
| 146 // frame) if changed. Returns true only if the geometry has been changed since |
| 147 // the last call. |
| 148 bool RetrieveGeometryChange(gfx::RectF* rect); |
| 149 #endif |
| 150 |
143 protected: | 151 protected: |
144 // Construct a WebMediaPlayerAndroid object with reference to the | 152 // Construct a WebMediaPlayerAndroid object with reference to the |
145 // client, manager and stream texture factory. | 153 // client, manager and stream texture factory. |
146 WebMediaPlayerAndroid(WebKit::WebMediaPlayerClient* client, | 154 WebMediaPlayerAndroid(WebKit::WebMediaPlayerClient* client, |
147 WebMediaPlayerManagerAndroid* manager, | 155 WebMediaPlayerManagerAndroid* manager, |
148 StreamTextureFactory* factory); | 156 StreamTextureFactory* factory); |
149 virtual ~WebMediaPlayerAndroid(); | 157 virtual ~WebMediaPlayerAndroid(); |
150 | 158 |
151 // Helper method to update the playing state. | 159 // Helper method to update the playing state. |
152 virtual void UpdatePlayingState(bool is_playing_); | 160 virtual void UpdatePlayingState(bool is_playing_); |
(...skipping 30 matching lines...) Expand all Loading... |
183 | 191 |
184 // Cleaning up all remaining resources as this object is about to get deleted. | 192 // Cleaning up all remaining resources as this object is about to get deleted. |
185 virtual void Destroy() = 0; | 193 virtual void Destroy() = 0; |
186 | 194 |
187 WebKit::WebMediaPlayerClient* client() { return client_; } | 195 WebKit::WebMediaPlayerClient* client() { return client_; } |
188 | 196 |
189 int player_id() const { return player_id_; } | 197 int player_id() const { return player_id_; } |
190 | 198 |
191 WebMediaPlayerManagerAndroid* manager() const { return manager_; } | 199 WebMediaPlayerManagerAndroid* manager() const { return manager_; } |
192 | 200 |
| 201 #if defined(GOOGLE_TV) |
193 // Request external surface for out-of-band composition. | 202 // Request external surface for out-of-band composition. |
194 virtual void RequestExternalSurface() = 0; | 203 virtual void RequestExternalSurface() = 0; |
| 204 #endif |
195 | 205 |
196 private: | 206 private: |
197 void ReallocateVideoFrame(); | 207 void ReallocateVideoFrame(); |
198 | 208 |
199 WebKit::WebMediaPlayerClient* const client_; | 209 WebKit::WebMediaPlayerClient* const client_; |
200 | 210 |
201 // Save the list of buffered time ranges. | 211 // Save the list of buffered time ranges. |
202 WebKit::WebTimeRanges buffered_; | 212 WebKit::WebTimeRanges buffered_; |
203 | 213 |
204 // Size of the video. | 214 // Size of the video. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 269 |
260 // Whether media player needs external surface. | 270 // Whether media player needs external surface. |
261 bool needs_external_surface_; | 271 bool needs_external_surface_; |
262 | 272 |
263 // A pointer back to the compositor to inform it about state changes. This is | 273 // A pointer back to the compositor to inform it about state changes. This is |
264 // not NULL while the compositor is actively using this webmediaplayer. | 274 // not NULL while the compositor is actively using this webmediaplayer. |
265 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 275 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
266 | 276 |
267 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | 277 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; |
268 | 278 |
| 279 #if defined(GOOGLE_TV) |
| 280 // A rectangle represents the geometry of video frame, when computed last |
| 281 // time. |
| 282 gfx::RectF last_computed_rect_; |
| 283 #endif |
| 284 |
269 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 285 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
270 }; | 286 }; |
271 | 287 |
272 } // namespace webkit_media | 288 } // namespace webkit_media |
273 | 289 |
274 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 290 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |