Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: webkit/media/android/webmediaplayer_android.cc

Issue 13620008: Enable 2D Canvas painting for Chrome on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and addressing xhwang's comments. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "cc/layers/video_layer.h" 11 #include "cc/layers/video_layer.h"
12 #include "gpu/GLES2/gl2extchromium.h"
12 #include "media/base/android/media_player_bridge.h" 13 #include "media/base/android/media_player_bridge.h"
13 #include "media/base/video_frame.h" 14 #include "media/base/video_frame.h"
14 #include "net/base/mime_util.h" 15 #include "net/base/mime_util.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h"
16 #include "webkit/compositor_bindings/web_layer_impl.h" 17 #include "webkit/compositor_bindings/web_layer_impl.h"
17 #include "webkit/media/android/webmediaplayer_manager_android.h" 18 #include "webkit/media/android/webmediaplayer_manager_android.h"
18 #include "webkit/media/media_switches.h" 19 #include "webkit/media/media_switches.h"
19 #include "webkit/media/webmediaplayer_util.h" 20 #include "webkit/media/webmediaplayer_util.h"
20 21
21 static const uint32 kGLTextureExternalOES = 0x8D65; 22 static const uint32 kGLTextureExternalOES = 0x8D65;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 264
264 void WebMediaPlayerAndroid::setSize(const WebKit::WebSize& size) { 265 void WebMediaPlayerAndroid::setSize(const WebKit::WebSize& size) {
265 } 266 }
266 267
267 void WebMediaPlayerAndroid::paint(WebKit::WebCanvas* canvas, 268 void WebMediaPlayerAndroid::paint(WebKit::WebCanvas* canvas,
268 const WebKit::WebRect& rect, 269 const WebKit::WebRect& rect,
269 uint8_t alpha) { 270 uint8_t alpha) {
270 NOTIMPLEMENTED(); 271 NOTIMPLEMENTED();
271 } 272 }
272 273
274 bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture(
275 WebKit::WebGraphicsContext3D* web_graphics_context,
276 unsigned int texture,
277 unsigned int level,
278 unsigned int internal_format,
279 bool premultiply_alpha,
280 bool flip_y) {
281 if (!texture_id_)
282 return false;
283
284 // The video is stored in an unmultiplied format, so premultiply if
285 // necessary.
286 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
287 premultiply_alpha);
288
289 // Application itself needs to take care of setting the right flip_y
290 // value down to get the expected result.
291 // flip_y==true means to reverse the video orientation while
292 // flip_y==false means to keep the intrinsic orientation.
293 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y);
294 web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, texture_id_,
295 texture, level, internal_format);
296 web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
297 web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
298 false);
299 return true;
300 }
301
273 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const { 302 bool WebMediaPlayerAndroid::hasSingleSecurityOrigin() const {
274 return false; 303 return false;
275 } 304 }
276 305
277 bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const { 306 bool WebMediaPlayerAndroid::didPassCORSAccessCheck() const {
278 return false; 307 return false;
279 } 308 }
280 309
281 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const { 310 WebMediaPlayer::MovieLoadType WebMediaPlayerAndroid::movieLoadType() const {
282 // Deprecated. 311 // Deprecated.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 548
520 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { 549 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) {
521 needs_establish_peer_ = needs_establish_peer; 550 needs_establish_peer_ = needs_establish_peer;
522 } 551 }
523 552
524 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { 553 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) {
525 is_playing_ = is_playing; 554 is_playing_ = is_playing;
526 } 555 }
527 556
528 } // namespace webkit_media 557 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698