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