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

Side by Side Diff: trunk/Source/web/WebMediaPlayerClientImpl.cpp

Issue 320053003: Revert 175683 "Eliminate MediaPlayer & MediaPlayerClient abstrac..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « trunk/Source/web/WebMediaPlayerClientImpl.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "config.h" 5 #include "config.h"
6 #include "web/WebMediaPlayerClientImpl.h" 6 #include "web/WebMediaPlayerClientImpl.h"
7 7
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/html/HTMLMediaElement.h" 9 #include "core/html/HTMLMediaElement.h"
10 #include "core/html/TimeRanges.h" 10 #include "core/html/TimeRanges.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 #if OS(ANDROID) 199 #if OS(ANDROID)
200 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream); 200 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream);
201 #endif 201 #endif
202 202
203 // Tell WebMediaPlayer about any connected CDM (may be null). 203 // Tell WebMediaPlayer about any connected CDM (may be null).
204 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement())); 204 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement()));
205 m_webMediaPlayer->load(loadType, kurl, corsMode); 205 m_webMediaPlayer->load(loadType, kurl, corsMode);
206 } 206 }
207 207
208 double WebMediaPlayerClientImpl::rate() const
209 {
210 return m_rate;
211 }
212
213 void WebMediaPlayerClientImpl::setRate(double rate)
214 {
215 m_rate = rate;
216 if (m_webMediaPlayer)
217 m_webMediaPlayer->setRate(rate);
218 }
219
208 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const 220 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
209 { 221 {
210 if (m_webMediaPlayer) 222 if (m_webMediaPlayer)
211 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); 223 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate());
212 return MediaPlayer::Empty; 224 return MediaPlayer::Empty;
213 } 225 }
214 226
215 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const 227 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const
216 { 228 {
217 if (m_webMediaPlayer) 229 if (m_webMediaPlayer)
218 return static_cast<MediaPlayer::ReadyState>(m_webMediaPlayer->readyState ()); 230 return static_cast<MediaPlayer::ReadyState>(m_webMediaPlayer->readyState ());
219 return MediaPlayer::HaveNothing; 231 return MediaPlayer::HaveNothing;
220 } 232 }
221 233
234 double WebMediaPlayerClientImpl::maxTimeSeekable() const
235 {
236 if (m_webMediaPlayer)
237 return m_webMediaPlayer->maxTimeSeekable();
238 return 0.0;
239 }
240
241 PassRefPtr<TimeRanges> WebMediaPlayerClientImpl::buffered() const
242 {
243 if (m_webMediaPlayer)
244 return TimeRanges::create(m_webMediaPlayer->buffered());
245 return TimeRanges::create();
246 }
247
248 bool WebMediaPlayerClientImpl::didLoadingProgress() const
249 {
250 return m_webMediaPlayer && m_webMediaPlayer->didLoadingProgress();
251 }
252
222 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re ct) 253 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re ct)
223 { 254 {
224 // Normally GraphicsContext operations do nothing when painting is disabled. 255 // Normally GraphicsContext operations do nothing when painting is disabled.
225 // Since we're accessing platformContext() directly we have to manually 256 // Since we're accessing platformContext() directly we have to manually
226 // check. 257 // check.
227 if (m_webMediaPlayer && !context->paintingDisabled()) { 258 if (m_webMediaPlayer && !context->paintingDisabled()) {
228 // On Android, video frame is emitted as GL_TEXTURE_EXTERNAL_OES texture . We use a different path to 259 // On Android, video frame is emitted as GL_TEXTURE_EXTERNAL_OES texture . We use a different path to
229 // paint the video frame into the context. 260 // paint the video frame into the context.
230 #if OS(ANDROID) 261 #if OS(ANDROID)
231 if (m_usePaintOnAndroid) { 262 if (m_usePaintOnAndroid) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 SkPaint paint; 332 SkPaint paint;
302 paint.setAlpha(alpha); 333 paint.setAlpha(alpha);
303 // It is not necessary to pass the dest into the drawBitmap call since all t he context have been set up before calling paintCurrentFrameInContext. 334 // It is not necessary to pass the dest into the drawBitmap call since all t he context have been set up before calling paintCurrentFrameInContext.
304 canvas->drawBitmapRect(m_bitmap, NULL, dest, &paint); 335 canvas->drawBitmapRect(m_bitmap, NULL, dest, &paint);
305 } 336 }
306 #endif 337 #endif
307 338
308 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client) 339 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client)
309 : m_client(client) 340 : m_client(client)
310 , m_preload(MediaPlayer::Auto) 341 , m_preload(MediaPlayer::Auto)
342 , m_rate(1.0)
311 #if OS(ANDROID) 343 #if OS(ANDROID)
312 , m_usePaintOnAndroid(false) 344 , m_usePaintOnAndroid(false)
313 #endif 345 #endif
314 { 346 {
315 ASSERT(m_client); 347 ASSERT(m_client);
316 } 348 }
317 349
318 WebCore::HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const 350 WebCore::HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const
319 { 351 {
320 return *static_cast<HTMLMediaElement*>(m_client); 352 return *static_cast<HTMLMediaElement*>(m_client);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 401
370 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) 402 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate)
371 { 403 {
372 if (m_client) 404 if (m_client)
373 m_client->setFormat(numberOfChannels, sampleRate); 405 m_client->setFormat(numberOfChannels, sampleRate);
374 } 406 }
375 407
376 #endif 408 #endif
377 409
378 } // namespace blink 410 } // namespace blink
OLDNEW
« no previous file with comments | « trunk/Source/web/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698