| 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 virtual ~WebMediaPlayerAndroid(); | 100 ~WebMediaPlayerAndroid() override; |
| 101 | 101 |
| 102 // blink::WebMediaPlayer implementation. | 102 // blink::WebMediaPlayer implementation. |
| 103 virtual bool supportsOverlayFullscreenVideo(); | 103 bool supportsOverlayFullscreenVideo() override; |
| 104 virtual void enterFullscreen(); | 104 void enterFullscreen() override; |
| 105 | 105 |
| 106 // Resource loading. | 106 // Resource loading. |
| 107 virtual void load(LoadType load_type, | 107 void load(LoadType load_type, |
| 108 const blink::WebURL& url, | 108 const blink::WebURL& url, |
| 109 CORSMode cors_mode); | 109 CORSMode cors_mode) override; |
| 110 | 110 |
| 111 // Playback controls. | 111 // Playback controls. |
| 112 virtual void play(); | 112 void play() override; |
| 113 virtual void pause(); | 113 void pause() override; |
| 114 virtual void seek(double seconds); | 114 void seek(double seconds) override; |
| 115 virtual bool supportsSave() const; | 115 bool supportsSave() const override; |
| 116 virtual void setRate(double rate); | 116 void setRate(double rate) override; |
| 117 virtual void setVolume(double volume); | 117 void setVolume(double volume) override; |
| 118 virtual void setSinkId(const blink::WebString& sink_id, | 118 void setSinkId(const blink::WebString& sink_id, |
| 119 const blink::WebSecurityOrigin& security_origin, | 119 const blink::WebSecurityOrigin& security_origin, |
| 120 blink::WebSetSinkIdCallbacks* web_callback); | 120 blink::WebSetSinkIdCallbacks* web_callback) override; |
| 121 virtual void requestRemotePlayback(); | 121 void requestRemotePlayback() override; |
| 122 virtual void requestRemotePlaybackControl(); | 122 void requestRemotePlaybackControl() override; |
| 123 virtual blink::WebTimeRanges buffered() const; | 123 blink::WebTimeRanges buffered() const override; |
| 124 virtual blink::WebTimeRanges seekable() const; | 124 blink::WebTimeRanges seekable() const override; |
| 125 | 125 |
| 126 // Poster image, as defined in the <video> element. | 126 // Poster image, as defined in the <video> element. |
| 127 virtual void setPoster(const blink::WebURL& poster) override; | 127 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 virtual void paint(blink::WebCanvas* canvas, | 134 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); | 137 SkXfermode::Mode mode) override; |
| 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 virtual bool hasVideo() const; | 148 bool hasVideo() const override; |
| 149 virtual bool hasAudio() const; | 149 bool hasAudio() const override; |
| 150 | 150 |
| 151 virtual bool isRemote() const; | 151 bool isRemote() const override; |
| 152 | 152 |
| 153 // Dimensions of the video. | 153 // Dimensions of the video. |
| 154 virtual blink::WebSize naturalSize() const; | 154 blink::WebSize naturalSize() const override; |
| 155 | 155 |
| 156 // Getters of playback state. | 156 // Getters of playback state. |
| 157 virtual bool paused() const; | 157 bool paused() const override; |
| 158 virtual bool seeking() const; | 158 bool seeking() const override; |
| 159 virtual double duration() const; | 159 double duration() const override; |
| 160 virtual double timelineOffset() const; | 160 virtual double timelineOffset() const; |
| 161 virtual double currentTime() const; | 161 double currentTime() const override; |
| 162 | 162 |
| 163 virtual bool didLoadingProgress(); | 163 bool didLoadingProgress() override; |
| 164 | 164 |
| 165 // Internal states of loading and network. | 165 // Internal states of loading and network. |
| 166 virtual blink::WebMediaPlayer::NetworkState networkState() const; | 166 blink::WebMediaPlayer::NetworkState networkState() const override; |
| 167 virtual blink::WebMediaPlayer::ReadyState readyState() const; | 167 blink::WebMediaPlayer::ReadyState readyState() const override; |
| 168 | 168 |
| 169 virtual bool hasSingleSecurityOrigin() const; | 169 bool hasSingleSecurityOrigin() const override; |
| 170 virtual bool didPassCORSAccessCheck() const; | 170 bool didPassCORSAccessCheck() const override; |
| 171 | 171 |
| 172 virtual double mediaTimeForTimeValue(double timeValue) const; | 172 double mediaTimeForTimeValue(double timeValue) const override; |
| 173 | 173 |
| 174 // Provide statistics. | 174 // Provide statistics. |
| 175 virtual unsigned decodedFrameCount() const; | 175 unsigned decodedFrameCount() const override; |
| 176 virtual unsigned droppedFrameCount() const; | 176 unsigned droppedFrameCount() const override; |
| 177 virtual unsigned audioDecodedByteCount() const; | 177 unsigned audioDecodedByteCount() const override; |
| 178 virtual unsigned videoDecodedByteCount() const; | 178 unsigned videoDecodedByteCount() const override; |
| 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 virtual MediaKeyException generateKeyRequest( | 236 MediaKeyException generateKeyRequest(const blink::WebString& key_system, |
| 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( |
| 237 const blink::WebString& key_system, | 246 const blink::WebString& key_system, |
| 238 const unsigned char* init_data, | 247 const blink::WebString& session_id) override; |
| 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); | |
| 250 | 248 |
| 251 virtual void setContentDecryptionModule( | 249 void setContentDecryptionModule( |
| 252 blink::WebContentDecryptionModule* cdm, | 250 blink::WebContentDecryptionModule* cdm, |
| 253 blink::WebContentDecryptionModuleResult result); | 251 blink::WebContentDecryptionModuleResult result) override; |
| 254 | 252 |
| 255 void OnKeyAdded(const std::string& session_id); | 253 void OnKeyAdded(const std::string& session_id); |
| 256 void OnKeyError(const std::string& session_id, | 254 void OnKeyError(const std::string& session_id, |
| 257 media::MediaKeys::KeyError error_code, | 255 media::MediaKeys::KeyError error_code, |
| 258 uint32 system_code); | 256 uint32 system_code); |
| 259 void OnKeyMessage(const std::string& session_id, | 257 void OnKeyMessage(const std::string& session_id, |
| 260 const std::vector<uint8>& message, | 258 const std::vector<uint8>& message, |
| 261 const GURL& destination_url); | 259 const GURL& destination_url); |
| 262 | 260 |
| 263 void OnMediaSourceOpened(blink::WebMediaSource* web_media_source); | 261 void OnMediaSourceOpened(blink::WebMediaSource* web_media_source); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 | 537 |
| 540 // NOTE: Weak pointers must be invalidated before all other member variables. | 538 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 541 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 539 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
| 542 | 540 |
| 543 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 541 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
| 544 }; | 542 }; |
| 545 | 543 |
| 546 } // namespace content | 544 } // namespace content |
| 547 | 545 |
| 548 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 546 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| OLD | NEW |