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

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

Issue 11442056: Add external surface rendering mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separated GLRenderer change out; refined messaging scheme. Created 7 years, 10 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_impl_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_impl_android.h" 5 #include "webkit/media/android/webmediaplayer_impl_android.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/base/android/media_player_bridge.h" 9 #include "media/base/android/media_player_bridge.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
15 #include "webkit/media/android/stream_texture_factory_android.h" 15 #include "webkit/media/android/stream_texture_factory_android.h"
16 #include "webkit/media/android/webmediaplayer_manager_android.h" 16 #include "webkit/media/android/webmediaplayer_manager_android.h"
17 #include "webkit/media/android/webmediaplayer_proxy_android.h" 17 #include "webkit/media/android/webmediaplayer_proxy_android.h"
18 18
19 using WebKit::WebMediaPlayerClient; 19 using WebKit::WebMediaPlayerClient;
20 using WebKit::WebMediaPlayer; 20 using WebKit::WebMediaPlayer;
21 21
22 namespace webkit_media { 22 namespace webkit_media {
23 23
24 namespace {
25
26 // Copied from content/browser/android/content_video_view.h
27 enum {
28 // These are used in java so don't change them unless we can share an enum
29 // from java and remove this enum.
30 PERSONALITY_FULL_SCREEN = 0,
31 PERSONALITY_EMBEDDED = 1,
32 };
33
34 } // namespace
35
24 WebMediaPlayerImplAndroid::WebMediaPlayerImplAndroid( 36 WebMediaPlayerImplAndroid::WebMediaPlayerImplAndroid(
25 WebKit::WebFrame* frame, 37 WebKit::WebFrame* frame,
26 WebMediaPlayerClient* client, 38 WebMediaPlayerClient* client,
27 WebMediaPlayerManagerAndroid* manager, 39 WebMediaPlayerManagerAndroid* manager,
28 WebMediaPlayerProxyAndroid* proxy, 40 WebMediaPlayerProxyAndroid* proxy,
29 StreamTextureFactory* factory) 41 StreamTextureFactory* factory)
30 : WebMediaPlayerAndroid(client, manager, factory), 42 : WebMediaPlayerAndroid(client, manager, factory),
31 frame_(frame), 43 frame_(frame),
32 proxy_(proxy), 44 proxy_(proxy),
33 current_time_(0) { 45 current_time_(0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 99
88 void WebMediaPlayerImplAndroid::ReleaseResourcesInternal() { 100 void WebMediaPlayerImplAndroid::ReleaseResourcesInternal() {
89 if (proxy_) 101 if (proxy_)
90 proxy_->ReleaseResources(player_id()); 102 proxy_->ReleaseResources(player_id());
91 } 103 }
92 104
93 void WebMediaPlayerImplAndroid::OnTimeUpdate(base::TimeDelta current_time) { 105 void WebMediaPlayerImplAndroid::OnTimeUpdate(base::TimeDelta current_time) {
94 current_time_ = static_cast<float>(current_time.InSecondsF()); 106 current_time_ = static_cast<float>(current_time.InSecondsF());
95 } 107 }
96 108
97 void WebMediaPlayerImplAndroid::OnDidEnterFullscreen() { 109 void WebMediaPlayerImplAndroid::OnDidEnterVideoView(int personality) {
98 if (!manager()->IsInFullscreen(frame_)) { 110 if (personality == PERSONALITY_FULL_SCREEN) {
99 frame_->view()->willEnterFullScreen(); 111 if (!manager()->IsInFullscreen(frame_)) {
100 frame_->view()->didEnterFullScreen(); 112 frame_->view()->willEnterFullScreen();
101 manager()->DidEnterFullscreen(frame_); 113 frame_->view()->didEnterFullScreen();
114 manager()->DidEnterFullscreen(frame_);
115 }
116 } else {
117 SetIsInVideoView(true);
118 SetNeedsEstablishPeer(false);
102 } 119 }
103 } 120 }
104 121
105 void WebMediaPlayerImplAndroid::OnDidExitFullscreen() { 122 void WebMediaPlayerImplAndroid::OnDidExitVideoView(int personality) {
106 SetNeedsEstablishPeer(true); 123 SetNeedsEstablishPeer(true);
107 // We had the fullscreen surface connected to Android MediaPlayer, 124 // We had the fullscreen surface connected to Android MediaPlayer,
108 // so reconnect our surface texture for embedded playback. 125 // so reconnect our surface texture for embedded playback.
109 if (!paused()) 126 if (!paused())
110 EstablishSurfaceTexturePeer(); 127 EstablishSurfaceTexturePeer();
111 128
112 frame_->view()->willExitFullScreen(); 129 if (personality == PERSONALITY_FULL_SCREEN) {
113 frame_->view()->didExitFullScreen(); 130 frame_->view()->willExitFullScreen();
114 manager()->DidExitFullscreen(); 131 frame_->view()->didExitFullScreen();
115 client()->repaint(); 132 manager()->DidExitFullscreen();
133 client()->repaint();
134 } else {
135 SetIsInVideoView(false);
136 }
116 } 137 }
117 138
118 void WebMediaPlayerImplAndroid::OnMediaPlayerPlay() { 139 void WebMediaPlayerImplAndroid::OnMediaPlayerPlay() {
119 UpdatePlayingState(true); 140 UpdatePlayingState(true);
120 client()->playbackStateChanged(); 141 client()->playbackStateChanged();
121 } 142 }
122 143
123 void WebMediaPlayerImplAndroid::OnMediaPlayerPause() { 144 void WebMediaPlayerImplAndroid::OnMediaPlayerPause() {
124 UpdatePlayingState(false); 145 UpdatePlayingState(false);
125 client()->playbackStateChanged(); 146 client()->playbackStateChanged();
126 } 147 }
127 148
128 void WebMediaPlayerImplAndroid::Destroy() { 149 void WebMediaPlayerImplAndroid::Destroy() {
129 proxy_ = NULL; 150 proxy_ = NULL;
130 } 151 }
131 152
132 void WebMediaPlayerImplAndroid::SetVideoSurface(jobject j_surface) {} 153 void WebMediaPlayerImplAndroid::SetVideoSurface(jobject j_surface) {}
133 154
134 } // namespace webkit_media 155 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/android/webmediaplayer_impl_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698