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

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

Issue 388803005: Eliminate MediaPlayer abstraction(seek, duration, poster APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updated as per review Created 6 years, 5 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 | « 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 #if OS(ANDROID) 219 #if OS(ANDROID)
220 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream); 220 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream);
221 #endif 221 #endif
222 222
223 // Tell WebMediaPlayer about any connected CDM (may be null). 223 // Tell WebMediaPlayer about any connected CDM (may be null).
224 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement())); 224 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement()));
225 m_webMediaPlayer->load(loadType, kurl, corsMode); 225 m_webMediaPlayer->load(loadType, kurl, corsMode);
226 } 226 }
227 227
228 double WebMediaPlayerClientImpl::duration() const
229 {
230 if (m_webMediaPlayer)
231 return m_webMediaPlayer->duration();
232 return 0.0;
233 }
234
235 double WebMediaPlayerClientImpl::currentTime() const
236 {
237 if (m_webMediaPlayer)
238 return m_webMediaPlayer->currentTime();
239 return 0.0;
240 }
241
242 void WebMediaPlayerClientImpl::seek(double time)
243 {
244 if (m_webMediaPlayer)
245 m_webMediaPlayer->seek(time);
246 }
247
248 bool WebMediaPlayerClientImpl::seeking() const
249 {
250 if (m_webMediaPlayer)
251 return m_webMediaPlayer->seeking();
252 return false;
253 }
254
255 void WebMediaPlayerClientImpl::setPoster(const KURL& poster)
256 {
257 if (m_webMediaPlayer)
258 m_webMediaPlayer->setPoster(WebURL(poster));
259 }
260 228
261 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re ct) 229 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re ct)
262 { 230 {
263 // Normally GraphicsContext operations do nothing when painting is disabled. 231 // Normally GraphicsContext operations do nothing when painting is disabled.
264 // Since we're accessing platformContext() directly we have to manually 232 // Since we're accessing platformContext() directly we have to manually
265 // check. 233 // check.
266 if (m_webMediaPlayer && !context->paintingDisabled()) { 234 if (m_webMediaPlayer && !context->paintingDisabled()) {
267 // On Android, video frame is emitted as GL_TEXTURE_EXTERNAL_OES texture . We use a different path to 235 // On Android, video frame is emitted as GL_TEXTURE_EXTERNAL_OES texture . We use a different path to
268 // paint the video frame into the context. 236 // paint the video frame into the context.
269 #if OS(ANDROID) 237 #if OS(ANDROID)
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 376
409 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) 377 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate)
410 { 378 {
411 if (m_client) 379 if (m_client)
412 m_client->setFormat(numberOfChannels, sampleRate); 380 m_client->setFormat(numberOfChannels, sampleRate);
413 } 381 }
414 382
415 #endif 383 #endif
416 384
417 } // namespace blink 385 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698