OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 WebMediaPlayerAndroid( | 90 WebMediaPlayerAndroid( |
91 blink::WebFrame* frame, | 91 blink::WebFrame* frame, |
92 blink::WebMediaPlayerClient* client, | 92 blink::WebMediaPlayerClient* client, |
93 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 93 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
94 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, | 94 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, |
95 RendererMediaPlayerManager* player_manager, | 95 RendererMediaPlayerManager* player_manager, |
96 media::CdmFactory* cdm_factory, | 96 media::CdmFactory* cdm_factory, |
97 scoped_refptr<StreamTextureFactory> factory, | 97 scoped_refptr<StreamTextureFactory> factory, |
98 int frame_id, | 98 int frame_id, |
99 const media::WebMediaPlayerParams& params); | 99 const media::WebMediaPlayerParams& params); |
100 ~WebMediaPlayerAndroid() override; | 100 virtual ~WebMediaPlayerAndroid(); |
101 | 101 |
102 // blink::WebMediaPlayer implementation. | 102 // blink::WebMediaPlayer implementation. |
103 bool supportsOverlayFullscreenVideo() override; | 103 virtual bool supportsOverlayFullscreenVideo(); |
104 void enterFullscreen() override; | 104 virtual void enterFullscreen(); |
105 | 105 |
106 // Resource loading. | 106 // Resource loading. |
107 void load(LoadType load_type, | 107 virtual void load(LoadType load_type, |
108 const blink::WebURL& url, | 108 const blink::WebURL& url, |
109 CORSMode cors_mode) override; | 109 CORSMode cors_mode); |
110 | 110 |
111 // Playback controls. | 111 // Playback controls. |
112 void play() override; | 112 virtual void play(); |
113 void pause() override; | 113 virtual void pause(); |
114 void seek(double seconds) override; | 114 virtual void seek(double seconds); |
115 bool supportsSave() const override; | 115 virtual bool supportsSave() const; |
116 void setRate(double rate) override; | 116 virtual void setRate(double rate); |
117 void setVolume(double volume) override; | 117 virtual void setVolume(double volume); |
118 void setSinkId(const blink::WebString& sink_id, | 118 virtual void setSinkId(const blink::WebString& sink_id, |
119 const blink::WebSecurityOrigin& security_origin, | 119 const blink::WebSecurityOrigin& security_origin, |
120 blink::WebSetSinkIdCallbacks* web_callback) override; | 120 blink::WebSetSinkIdCallbacks* web_callback); |
121 void requestRemotePlayback() override; | 121 virtual void requestRemotePlayback(); |
122 void requestRemotePlaybackControl() override; | 122 virtual void requestRemotePlaybackControl(); |
123 blink::WebTimeRanges buffered() const override; | 123 virtual blink::WebTimeRanges buffered() const; |
124 blink::WebTimeRanges seekable() const override; | 124 virtual blink::WebTimeRanges seekable() const; |
125 | 125 |
126 // Poster image, as defined in the <video> element. | 126 // Poster image, as defined in the <video> element. |
127 void setPoster(const blink::WebURL& poster) override; | 127 virtual void setPoster(const blink::WebURL& poster) override; |
128 | 128 |
129 // Methods for painting. | 129 // Methods for painting. |
130 // FIXME: This path "only works" on Android. It is a workaround for the | 130 // FIXME: This path "only works" on Android. It is a workaround for the |
131 // issue that Skia could not handle Android's GL_TEXTURE_EXTERNAL_OES texture | 131 // issue that Skia could not handle Android's GL_TEXTURE_EXTERNAL_OES texture |
132 // internally. It should be removed and replaced by the normal paint path. | 132 // internally. It should be removed and replaced by the normal paint path. |
133 // https://code.google.com/p/skia/issues/detail?id=1189 | 133 // https://code.google.com/p/skia/issues/detail?id=1189 |
134 void paint(blink::WebCanvas* canvas, | 134 virtual void paint(blink::WebCanvas* canvas, |
135 const blink::WebRect& rect, | 135 const blink::WebRect& rect, |
136 unsigned char alpha, | 136 unsigned char alpha, |
137 SkXfermode::Mode mode) override; | 137 SkXfermode::Mode mode); |
138 | 138 |
139 bool copyVideoTextureToPlatformTexture( | 139 bool copyVideoTextureToPlatformTexture( |
140 blink::WebGraphicsContext3D* web_graphics_context, | 140 blink::WebGraphicsContext3D* web_graphics_context, |
141 unsigned int texture, | 141 unsigned int texture, |
142 unsigned int internal_format, | 142 unsigned int internal_format, |
143 unsigned int type, | 143 unsigned int type, |
144 bool premultiply_alpha, | 144 bool premultiply_alpha, |
145 bool flip_y) override; | 145 bool flip_y) override; |
146 | 146 |
147 // True if the loaded media has a playable video/audio track. | 147 // True if the loaded media has a playable video/audio track. |
148 bool hasVideo() const override; | 148 virtual bool hasVideo() const; |
149 bool hasAudio() const override; | 149 virtual bool hasAudio() const; |
150 | 150 |
151 bool isRemote() const override; | 151 virtual bool isRemote() const; |
152 | 152 |
153 // Dimensions of the video. | 153 // Dimensions of the video. |
154 blink::WebSize naturalSize() const override; | 154 virtual blink::WebSize naturalSize() const; |
155 | 155 |
156 // Getters of playback state. | 156 // Getters of playback state. |
157 bool paused() const override; | 157 virtual bool paused() const; |
158 bool seeking() const override; | 158 virtual bool seeking() const; |
159 double duration() const override; | 159 virtual double duration() const; |
160 virtual double timelineOffset() const; | 160 virtual double timelineOffset() const; |
161 double currentTime() const override; | 161 virtual double currentTime() const; |
162 | 162 |
163 bool didLoadingProgress() override; | 163 virtual bool didLoadingProgress(); |
164 | 164 |
165 // Internal states of loading and network. | 165 // Internal states of loading and network. |
166 blink::WebMediaPlayer::NetworkState networkState() const override; | 166 virtual blink::WebMediaPlayer::NetworkState networkState() const; |
167 blink::WebMediaPlayer::ReadyState readyState() const override; | 167 virtual blink::WebMediaPlayer::ReadyState readyState() const; |
168 | 168 |
169 bool hasSingleSecurityOrigin() const override; | 169 virtual bool hasSingleSecurityOrigin() const; |
170 bool didPassCORSAccessCheck() const override; | 170 virtual bool didPassCORSAccessCheck() const; |
171 | 171 |
172 double mediaTimeForTimeValue(double timeValue) const override; | 172 virtual double mediaTimeForTimeValue(double timeValue) const; |
173 | 173 |
174 // Provide statistics. | 174 // Provide statistics. |
175 unsigned decodedFrameCount() const override; | 175 virtual unsigned decodedFrameCount() const; |
176 unsigned droppedFrameCount() const override; | 176 virtual unsigned droppedFrameCount() const; |
177 unsigned audioDecodedByteCount() const override; | 177 virtual unsigned audioDecodedByteCount() const; |
178 unsigned videoDecodedByteCount() const override; | 178 virtual unsigned videoDecodedByteCount() const; |
179 | 179 |
180 // cc::VideoFrameProvider implementation. These methods are running on the | 180 // cc::VideoFrameProvider implementation. These methods are running on the |
181 // compositor thread. | 181 // compositor thread. |
182 void SetVideoFrameProviderClient( | 182 void SetVideoFrameProviderClient( |
183 cc::VideoFrameProvider::Client* client) override; | 183 cc::VideoFrameProvider::Client* client) override; |
184 bool UpdateCurrentFrame(base::TimeTicks deadline_min, | 184 bool UpdateCurrentFrame(base::TimeTicks deadline_min, |
185 base::TimeTicks deadline_max) override; | 185 base::TimeTicks deadline_max) override; |
186 bool HasCurrentFrame() override; | 186 bool HasCurrentFrame() override; |
187 scoped_refptr<media::VideoFrame> GetCurrentFrame() override; | 187 scoped_refptr<media::VideoFrame> GetCurrentFrame() override; |
188 void PutCurrentFrame() override; | 188 void PutCurrentFrame() override; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 #if defined(VIDEO_HOLE) | 227 #if defined(VIDEO_HOLE) |
228 // Calculate the boundary rectangle of the media player (i.e. location and | 228 // Calculate the boundary rectangle of the media player (i.e. location and |
229 // size of the video frame). | 229 // size of the video frame). |
230 // Returns true if the geometry has been changed since the last call. | 230 // Returns true if the geometry has been changed since the last call. |
231 bool UpdateBoundaryRectangle(); | 231 bool UpdateBoundaryRectangle(); |
232 | 232 |
233 const gfx::RectF GetBoundaryRectangle(); | 233 const gfx::RectF GetBoundaryRectangle(); |
234 #endif // defined(VIDEO_HOLE) | 234 #endif // defined(VIDEO_HOLE) |
235 | 235 |
236 MediaKeyException generateKeyRequest(const blink::WebString& key_system, | 236 virtual MediaKeyException generateKeyRequest( |
237 const unsigned char* init_data, | |
238 unsigned init_data_length) override; | |
239 MediaKeyException addKey(const blink::WebString& key_system, | |
240 const unsigned char* key, | |
241 unsigned key_length, | |
242 const unsigned char* init_data, | |
243 unsigned init_data_length, | |
244 const blink::WebString& session_id) override; | |
245 MediaKeyException cancelKeyRequest( | |
246 const blink::WebString& key_system, | 237 const blink::WebString& key_system, |
247 const blink::WebString& session_id) override; | 238 const unsigned char* init_data, |
| 239 unsigned init_data_length); |
| 240 virtual MediaKeyException addKey( |
| 241 const blink::WebString& key_system, |
| 242 const unsigned char* key, |
| 243 unsigned key_length, |
| 244 const unsigned char* init_data, |
| 245 unsigned init_data_length, |
| 246 const blink::WebString& session_id); |
| 247 virtual MediaKeyException cancelKeyRequest( |
| 248 const blink::WebString& key_system, |
| 249 const blink::WebString& session_id); |
248 | 250 |
249 void setContentDecryptionModule( | 251 virtual void setContentDecryptionModule( |
250 blink::WebContentDecryptionModule* cdm, | 252 blink::WebContentDecryptionModule* cdm, |
251 blink::WebContentDecryptionModuleResult result) override; | 253 blink::WebContentDecryptionModuleResult result); |
252 | 254 |
253 void OnKeyAdded(const std::string& session_id); | 255 void OnKeyAdded(const std::string& session_id); |
254 void OnKeyError(const std::string& session_id, | 256 void OnKeyError(const std::string& session_id, |
255 media::MediaKeys::KeyError error_code, | 257 media::MediaKeys::KeyError error_code, |
256 uint32 system_code); | 258 uint32 system_code); |
257 void OnKeyMessage(const std::string& session_id, | 259 void OnKeyMessage(const std::string& session_id, |
258 const std::vector<uint8>& message, | 260 const std::vector<uint8>& message, |
259 const GURL& destination_url); | 261 const GURL& destination_url); |
260 | 262 |
261 void OnMediaSourceOpened(blink::WebMediaSource* web_media_source); | 263 void OnMediaSourceOpened(blink::WebMediaSource* web_media_source); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 | 539 |
538 // NOTE: Weak pointers must be invalidated before all other member variables. | 540 // NOTE: Weak pointers must be invalidated before all other member variables. |
539 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 541 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
540 | 542 |
541 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 543 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
542 }; | 544 }; |
543 | 545 |
544 } // namespace content | 546 } // namespace content |
545 | 547 |
546 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 548 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |