Chromium Code Reviews| 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 #include "webkit/media/android/webmediaplayer_android.h" | 5 #include "webkit/media/android/webmediaplayer_android.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "cc/layers/video_layer.h" | 10 #include "cc/layers/video_layer.h" |
| 11 #include "gpu/GLES2/gl2extchromium.h" | |
| 11 #include "media/base/android/media_player_bridge.h" | 12 #include "media/base/android/media_player_bridge.h" |
| 12 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
| 13 #include "net/base/mime_util.h" | 14 #include "net/base/mime_util.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" |
| 15 #include "webkit/compositor_bindings/web_layer_impl.h" | 16 #include "webkit/compositor_bindings/web_layer_impl.h" |
| 16 #include "webkit/media/android/webmediaplayer_manager_android.h" | 17 #include "webkit/media/android/webmediaplayer_manager_android.h" |
| 17 #include "webkit/media/media_switches.h" | 18 #include "webkit/media/media_switches.h" |
| 18 #include "webkit/media/webmediaplayer_util.h" | 19 #include "webkit/media/webmediaplayer_util.h" |
| 19 | 20 |
| 20 static const uint32 kGLTextureExternalOES = 0x8D65; | 21 static const uint32 kGLTextureExternalOES = 0x8D65; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 | 240 |
| 240 void WebMediaPlayerAndroid::setSize(const WebKit::WebSize& size) { | 241 void WebMediaPlayerAndroid::setSize(const WebKit::WebSize& size) { |
| 241 } | 242 } |
| 242 | 243 |
| 243 void WebMediaPlayerAndroid::paint(WebKit::WebCanvas* canvas, | 244 void WebMediaPlayerAndroid::paint(WebKit::WebCanvas* canvas, |
| 244 const WebKit::WebRect& rect, | 245 const WebKit::WebRect& rect, |
| 245 uint8_t alpha) { | 246 uint8_t alpha) { |
| 246 NOTIMPLEMENTED(); | 247 NOTIMPLEMENTED(); |
| 247 } | 248 } |
| 248 | 249 |
| 250 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( | |
| 251 WebKit::WebGraphicsContext3D* web_graphics_context, | |
| 252 unsigned int texture, | |
| 253 unsigned int level, | |
| 254 unsigned int internal_format, | |
| 255 bool premultiply_alpha, | |
| 256 bool flip_y) { | |
| 257 // TODO(hkuang): Check if there is valid frame uploaded to the texture? | |
| 258 uint32 source_texture = texture_id_; | |
| 259 // The video is stored in a unmultiplied format, so premultiply | |
|
fgalligan1
2013/04/04 20:38:10
nit: newline before //
hkuang
2013/04/04 22:56:45
Done.
| |
| 260 // if necessary. | |
| 261 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | |
| 262 premultiply_alpha); | |
|
fgalligan1
2013/04/04 20:38:10
nit: align to (
hkuang
2013/04/04 22:56:45
Done.
| |
| 263 // Application itself needs to take care of setting the right flip_y | |
| 264 // value down to get the expected result. | |
| 265 // flip_y==true means to reverse the video orientation while | |
| 266 // flip_y==false means to keep the intrinsic orientation. | |
| 267 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); | |
| 268 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, | |
| 269 source_texture, texture, level, internal_format); | |
|
fgalligan1
2013/04/04 20:38:10
nit: align to (
hkuang
2013/04/04 22:56:45
Done.
| |
| 270 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); | |
| 271 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, | |
| 272 false); | |
|
fgalligan1
2013/04/04 20:38:10
nit: align to (
hkuang
2013/04/04 22:56:45
Done.
| |
| 273 return true; | |
| 274 } | |
| 275 | |
| 249 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { | 276 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { |
| 250 return false; | 277 return false; |
| 251 } | 278 } |
| 252 | 279 |
| 253 bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const { | 280 bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const { |
| 254 return false; | 281 return false; |
| 255 } | 282 } |
| 256 | 283 |
| 257 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const { | 284 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const { |
| 258 // Deprecated. | 285 // Deprecated. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 | 501 |
| 475 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { | 502 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { |
| 476 needs_establish_peer_ = needs_establish_peer; | 503 needs_establish_peer_ = needs_establish_peer; |
| 477 } | 504 } |
| 478 | 505 |
| 479 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { | 506 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { |
| 480 is_playing_ = is_playing; | 507 is_playing_ = is_playing; |
| 481 } | 508 } |
| 482 | 509 |
| 483 } // namespace webkit_media | 510 } // namespace webkit_media |
| OLD | NEW |