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 | 19 |
20 namespace WebKit { | |
21 class WebVideoFrame; | |
22 } | |
23 | |
24 namespace webkit { | 20 namespace webkit { |
25 class WebLayerImpl; | 21 class WebLayerImpl; |
26 } | 22 } |
27 | 23 |
28 namespace webkit_media { | 24 namespace webkit_media { |
29 | 25 |
30 class StreamTextureFactory; | 26 class StreamTextureFactory; |
31 class StreamTextureProxy; | 27 class StreamTextureProxy; |
32 class WebMediaPlayerManagerAndroid; | 28 class WebMediaPlayerManagerAndroid; |
33 class WebVideoFrameImpl; | |
34 | 29 |
35 // 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 |
36 // WebKit::WebMediaPlayer on Android. | 31 // WebKit::WebMediaPlayer on Android. |
37 class WebMediaPlayerAndroid | 32 class WebMediaPlayerAndroid |
38 : public WebKit::WebMediaPlayer, | 33 : public WebKit::WebMediaPlayer, |
39 #ifdef REMOVE_WEBVIDEOFRAME | |
40 public cc::VideoFrameProvider, | 34 public cc::VideoFrameProvider, |
41 #endif | |
42 public MessageLoop::DestructionObserver { | 35 public MessageLoop::DestructionObserver { |
43 public: | 36 public: |
44 // Resource loading. | 37 // Resource loading. |
45 virtual void load(const WebKit::WebURL& url, CORSMode cors_mode); | 38 virtual void load(const WebKit::WebURL& url, CORSMode cors_mode); |
46 virtual void load(const WebKit::WebURL& url, | 39 virtual void load(const WebKit::WebURL& url, |
47 WebKit::WebMediaSource* media_source, | 40 WebKit::WebMediaSource* media_source, |
48 CORSMode cors_mode); | 41 CORSMode cors_mode); |
49 virtual void cancelLoad(); | 42 virtual void cancelLoad(); |
50 | 43 |
51 // Playback controls. | 44 // Playback controls. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const; | 89 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const; |
97 | 90 |
98 virtual float mediaTimeForTimeValue(float timeValue) const; | 91 virtual float mediaTimeForTimeValue(float timeValue) const; |
99 | 92 |
100 // Provide statistics. | 93 // Provide statistics. |
101 virtual unsigned decodedFrameCount() const; | 94 virtual unsigned decodedFrameCount() const; |
102 virtual unsigned droppedFrameCount() const; | 95 virtual unsigned droppedFrameCount() const; |
103 virtual unsigned audioDecodedByteCount() const; | 96 virtual unsigned audioDecodedByteCount() const; |
104 virtual unsigned videoDecodedByteCount() const; | 97 virtual unsigned videoDecodedByteCount() const; |
105 | 98 |
106 #ifndef REMOVE_WEBVIDEOFRAME | |
107 // Methods called from VideoLayerChromium. These methods are running on the | |
108 // compositor thread. | |
109 virtual WebKit::WebVideoFrame* getCurrentFrame(); | |
110 virtual void putCurrentFrame(WebKit::WebVideoFrame*); | |
111 | |
112 // This gets called both on compositor and main thread to set the callback | |
113 // target when a frame is produced. | |
114 virtual void setStreamTextureClient(WebKit::WebStreamTextureClient* client); | |
115 #else | |
116 // cc::VideoFrameProvider implementation. These methods are running on the | 99 // cc::VideoFrameProvider implementation. These methods are running on the |
117 // compositor thread. | 100 // compositor thread. |
118 virtual void SetVideoFrameProviderClient( | 101 virtual void SetVideoFrameProviderClient( |
119 cc::VideoFrameProvider::Client* client) OVERRIDE; | 102 cc::VideoFrameProvider::Client* client) OVERRIDE; |
120 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE; | 103 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE; |
121 virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame) | 104 virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame) |
122 OVERRIDE; | 105 OVERRIDE; |
123 #endif | |
124 | 106 |
125 // Media player callback handlers. | 107 // Media player callback handlers. |
126 virtual void OnMediaPrepared(base::TimeDelta duration); | 108 virtual void OnMediaPrepared(base::TimeDelta duration); |
127 virtual void OnPlaybackComplete(); | 109 virtual void OnPlaybackComplete(); |
128 virtual void OnBufferingUpdate(int percentage); | 110 virtual void OnBufferingUpdate(int percentage); |
129 virtual void OnSeekComplete(base::TimeDelta current_time); | 111 virtual void OnSeekComplete(base::TimeDelta current_time); |
130 virtual void OnMediaError(int error_type); | 112 virtual void OnMediaError(int error_type); |
131 virtual void OnVideoSizeChanged(int width, int height); | 113 virtual void OnVideoSizeChanged(int width, int height); |
132 | 114 |
133 // Called to update the current time. | 115 // Called to update the current time. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 257 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
276 | 258 |
277 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | 259 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; |
278 | 260 |
279 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 261 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
280 }; | 262 }; |
281 | 263 |
282 } // namespace webkit_media | 264 } // namespace webkit_media |
283 | 265 |
284 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 266 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |