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" | |
12 #include "base/memory/scoped_ptr.h" | |
11 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "cc/layers/video_frame_provider.h" | |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
17 | 19 |
18 namespace WebKit { | 20 namespace webkit { |
19 class WebVideoFrame; | 21 class WebLayerImpl; |
20 } | 22 } |
21 | 23 |
22 namespace webkit_media { | 24 namespace webkit_media { |
23 | 25 |
24 class StreamTextureFactory; | 26 class StreamTextureFactory; |
25 class StreamTextureProxy; | 27 class StreamTextureProxy; |
26 class WebMediaPlayerManagerAndroid; | 28 class WebMediaPlayerManagerAndroid; |
27 class WebVideoFrameImpl; | |
28 | 29 |
29 // An abstract class that serves as the common base class for implementing | 30 // An abstract class that serves as the common base class for implementing |
30 // WebKit::WebMediaPlayer on Android. | 31 // WebKit::WebMediaPlayer on Android. |
31 class WebMediaPlayerAndroid | 32 class WebMediaPlayerAndroid |
32 : public WebKit::WebMediaPlayer, | 33 : public WebKit::WebMediaPlayer, |
34 public cc::VideoFrameProvider, | |
33 public MessageLoop::DestructionObserver { | 35 public MessageLoop::DestructionObserver { |
34 public: | 36 public: |
35 // Resource loading. | 37 // Resource loading. |
36 virtual void load(const WebKit::WebURL& url, CORSMode cors_mode); | 38 virtual void load(const WebKit::WebURL& url, CORSMode cors_mode); |
37 virtual void load(const WebKit::WebURL& url, | 39 virtual void load(const WebKit::WebURL& url, |
38 WebKit::WebMediaSource* media_source, | 40 WebKit::WebMediaSource* media_source, |
39 CORSMode cors_mode); | 41 CORSMode cors_mode); |
40 virtual void cancelLoad(); | 42 virtual void cancelLoad(); |
41 | 43 |
42 // Playback controls. | 44 // Playback controls. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const; | 89 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const; |
88 | 90 |
89 virtual float mediaTimeForTimeValue(float timeValue) const; | 91 virtual float mediaTimeForTimeValue(float timeValue) const; |
90 | 92 |
91 // Provide statistics. | 93 // Provide statistics. |
92 virtual unsigned decodedFrameCount() const; | 94 virtual unsigned decodedFrameCount() const; |
93 virtual unsigned droppedFrameCount() const; | 95 virtual unsigned droppedFrameCount() const; |
94 virtual unsigned audioDecodedByteCount() const; | 96 virtual unsigned audioDecodedByteCount() const; |
95 virtual unsigned videoDecodedByteCount() const; | 97 virtual unsigned videoDecodedByteCount() const; |
96 | 98 |
97 // Methods called from VideoLayerChromium. These methods are running on the | 99 // cc::VideoFrameProvider implementation. |
98 // compositor thread. | 100 virtual void SetVideoFrameProviderClient( |
99 virtual WebKit::WebVideoFrame* getCurrentFrame(); | 101 cc::VideoFrameProvider::Client* client) OVERRIDE; |
100 virtual void putCurrentFrame(WebKit::WebVideoFrame*); | 102 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE; |
101 | 103 virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame) |
102 // This gets called both on compositor and main thread to set the callback | 104 OVERRIDE; |
103 // target when a frame is produced. | |
104 virtual void setStreamTextureClient(WebKit::WebStreamTextureClient* client); | |
105 | 105 |
106 // Media player callback handlers. | 106 // Media player callback handlers. |
107 virtual void OnMediaPrepared(base::TimeDelta duration); | 107 virtual void OnMediaPrepared(base::TimeDelta duration); |
108 virtual void OnPlaybackComplete(); | 108 virtual void OnPlaybackComplete(); |
109 virtual void OnBufferingUpdate(int percentage); | 109 virtual void OnBufferingUpdate(int percentage); |
110 virtual void OnSeekComplete(base::TimeDelta current_time); | 110 virtual void OnSeekComplete(base::TimeDelta current_time); |
111 virtual void OnMediaError(int error_type); | 111 virtual void OnMediaError(int error_type); |
112 virtual void OnVideoSizeChanged(int width, int height); | 112 virtual void OnVideoSizeChanged(int width, int height); |
113 | 113 |
114 // Called to update the current time. | 114 // Called to update the current time. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 void ReallocateVideoFrame(); | 185 void ReallocateVideoFrame(); |
186 | 186 |
187 WebKit::WebMediaPlayerClient* const client_; | 187 WebKit::WebMediaPlayerClient* const client_; |
188 | 188 |
189 // Save the list of buffered time ranges. | 189 // Save the list of buffered time ranges. |
190 WebKit::WebTimeRanges buffered_; | 190 WebKit::WebTimeRanges buffered_; |
191 | 191 |
192 // Size of the video. | 192 // Size of the video. |
193 WebKit::WebSize natural_size_; | 193 WebKit::WebSize natural_size_; |
194 | 194 |
195 // The video frame object used for renderering by WebKit. | 195 // The video frame object used for rendering by the compositor. |
196 scoped_ptr<WebVideoFrameImpl> web_video_frame_; | 196 scoped_refptr<media::VideoFrame> current_frame_; |
197 | 197 |
198 // Message loop for main renderer thread. | 198 // Message loop for main renderer thread. |
199 MessageLoop* main_loop_; | 199 MessageLoop* main_loop_; |
200 | 200 |
201 // URL of the media file to be fetched. | 201 // URL of the media file to be fetched. |
202 GURL url_; | 202 GURL url_; |
203 | 203 |
204 // Media duration. | 204 // Media duration. |
205 base::TimeDelta duration_; | 205 base::TimeDelta duration_; |
206 | 206 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 // Whether the video size info is available. | 238 // Whether the video size info is available. |
239 bool has_size_info_; | 239 bool has_size_info_; |
240 | 240 |
241 // Object for allocating stream textures. | 241 // Object for allocating stream textures. |
242 scoped_ptr<StreamTextureFactory> stream_texture_factory_; | 242 scoped_ptr<StreamTextureFactory> stream_texture_factory_; |
243 | 243 |
244 // Object for calling back the compositor thread to repaint the video when a | 244 // Object for calling back the compositor thread to repaint the video when a |
245 // frame available. It should be initialized on the compositor thread. | 245 // frame available. It should be initialized on the compositor thread. |
246 scoped_ptr<StreamTextureProxy> stream_texture_proxy_; | 246 scoped_ptr<StreamTextureProxy> stream_texture_proxy_; |
247 | 247 |
248 cc::VideoFrameProvider::Client* video_frame_provider_client_; | |
jamesr
2013/03/21 00:59:11
Most of the other members in this class seem to ha
danakj
2013/03/21 03:05:26
Done, also in the other implementations.
| |
249 | |
250 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | |
251 | |
248 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 252 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
249 }; | 253 }; |
250 | 254 |
251 } // namespace webkit_media | 255 } // namespace webkit_media |
252 | 256 |
253 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 257 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |