OLD | NEW |
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 Loading... |
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 void WebMediaPlayerClientImpl::play() | |
229 { | |
230 if (m_webMediaPlayer) | |
231 m_webMediaPlayer->play(); | |
232 } | |
233 | |
234 void WebMediaPlayerClientImpl::pause() | |
235 { | |
236 if (m_webMediaPlayer) | |
237 m_webMediaPlayer->pause(); | |
238 } | |
239 | |
240 double WebMediaPlayerClientImpl::duration() const | 228 double WebMediaPlayerClientImpl::duration() const |
241 { | 229 { |
242 if (m_webMediaPlayer) | 230 if (m_webMediaPlayer) |
243 return m_webMediaPlayer->duration(); | 231 return m_webMediaPlayer->duration(); |
244 return 0.0; | 232 return 0.0; |
245 } | 233 } |
246 | 234 |
247 double WebMediaPlayerClientImpl::currentTime() const | 235 double WebMediaPlayerClientImpl::currentTime() const |
248 { | 236 { |
249 if (m_webMediaPlayer) | 237 if (m_webMediaPlayer) |
250 return m_webMediaPlayer->currentTime(); | 238 return m_webMediaPlayer->currentTime(); |
251 return 0.0; | 239 return 0.0; |
252 } | 240 } |
253 | 241 |
254 void WebMediaPlayerClientImpl::seek(double time) | 242 void WebMediaPlayerClientImpl::seek(double time) |
255 { | 243 { |
256 if (m_webMediaPlayer) | 244 if (m_webMediaPlayer) |
257 m_webMediaPlayer->seek(time); | 245 m_webMediaPlayer->seek(time); |
258 } | 246 } |
259 | 247 |
260 bool WebMediaPlayerClientImpl::seeking() const | 248 bool WebMediaPlayerClientImpl::seeking() const |
261 { | 249 { |
262 if (m_webMediaPlayer) | 250 if (m_webMediaPlayer) |
263 return m_webMediaPlayer->seeking(); | 251 return m_webMediaPlayer->seeking(); |
264 return false; | 252 return false; |
265 } | 253 } |
266 | 254 |
267 bool WebMediaPlayerClientImpl::paused() const | |
268 { | |
269 if (m_webMediaPlayer) | |
270 return m_webMediaPlayer->paused(); | |
271 return false; | |
272 } | |
273 | |
274 bool WebMediaPlayerClientImpl::supportsSave() const | |
275 { | |
276 if (m_webMediaPlayer) | |
277 return m_webMediaPlayer->supportsSave(); | |
278 return false; | |
279 } | |
280 | |
281 void WebMediaPlayerClientImpl::setPoster(const KURL& poster) | 255 void WebMediaPlayerClientImpl::setPoster(const KURL& poster) |
282 { | 256 { |
283 if (m_webMediaPlayer) | 257 if (m_webMediaPlayer) |
284 m_webMediaPlayer->setPoster(WebURL(poster)); | 258 m_webMediaPlayer->setPoster(WebURL(poster)); |
285 } | 259 } |
286 | 260 |
287 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const | 261 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const |
288 { | 262 { |
289 if (m_webMediaPlayer) | 263 if (m_webMediaPlayer) |
290 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS
tate()); | 264 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS
tate()); |
(...skipping 30 matching lines...) Expand all Loading... |
321 } | 295 } |
322 | 296 |
323 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) | 297 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) |
324 { | 298 { |
325 m_preload = preload; | 299 m_preload = preload; |
326 | 300 |
327 if (m_webMediaPlayer) | 301 if (m_webMediaPlayer) |
328 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); | 302 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); |
329 } | 303 } |
330 | 304 |
331 bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const | |
332 { | |
333 if (m_webMediaPlayer) | |
334 return m_webMediaPlayer->hasSingleSecurityOrigin(); | |
335 return false; | |
336 } | |
337 | |
338 double WebMediaPlayerClientImpl::mediaTimeForTimeValue(double timeValue) const | |
339 { | |
340 if (m_webMediaPlayer) | |
341 return m_webMediaPlayer->mediaTimeForTimeValue(timeValue); | |
342 return timeValue; | |
343 } | |
344 | |
345 #if ENABLE(WEB_AUDIO) | 305 #if ENABLE(WEB_AUDIO) |
346 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() | 306 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() |
347 { | 307 { |
348 return &m_audioSourceProvider; | 308 return &m_audioSourceProvider; |
349 } | 309 } |
350 #endif | 310 #endif |
351 | 311 |
352 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie
nt) | 312 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie
nt) |
353 { | 313 { |
354 return adoptPtr(new WebMediaPlayerClientImpl(client)); | 314 return adoptPtr(new WebMediaPlayerClientImpl(client)); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 415 |
456 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 416 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
457 { | 417 { |
458 if (m_client) | 418 if (m_client) |
459 m_client->setFormat(numberOfChannels, sampleRate); | 419 m_client->setFormat(numberOfChannels, sampleRate); |
460 } | 420 } |
461 | 421 |
462 #endif | 422 #endif |
463 | 423 |
464 } // namespace blink | 424 } // namespace blink |
OLD | NEW |