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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void WebMediaPlayerClientImpl::play() |
| 209 { |
| 210 if (m_webMediaPlayer) |
| 211 m_webMediaPlayer->play(); |
| 212 } |
| 213 |
| 214 void WebMediaPlayerClientImpl::pause() |
| 215 { |
| 216 if (m_webMediaPlayer) |
| 217 m_webMediaPlayer->pause(); |
| 218 } |
| 219 |
208 double WebMediaPlayerClientImpl::duration() const | 220 double WebMediaPlayerClientImpl::duration() const |
209 { | 221 { |
210 if (m_webMediaPlayer) | 222 if (m_webMediaPlayer) |
211 return m_webMediaPlayer->duration(); | 223 return m_webMediaPlayer->duration(); |
212 return 0.0; | 224 return 0.0; |
213 } | 225 } |
214 | 226 |
215 double WebMediaPlayerClientImpl::currentTime() const | 227 double WebMediaPlayerClientImpl::currentTime() const |
216 { | 228 { |
217 if (m_webMediaPlayer) | 229 if (m_webMediaPlayer) |
(...skipping 19 matching lines...) Expand all Loading... |
237 return m_rate; | 249 return m_rate; |
238 } | 250 } |
239 | 251 |
240 void WebMediaPlayerClientImpl::setRate(double rate) | 252 void WebMediaPlayerClientImpl::setRate(double rate) |
241 { | 253 { |
242 m_rate = rate; | 254 m_rate = rate; |
243 if (m_webMediaPlayer) | 255 if (m_webMediaPlayer) |
244 m_webMediaPlayer->setRate(rate); | 256 m_webMediaPlayer->setRate(rate); |
245 } | 257 } |
246 | 258 |
| 259 bool WebMediaPlayerClientImpl::paused() const |
| 260 { |
| 261 if (m_webMediaPlayer) |
| 262 return m_webMediaPlayer->paused(); |
| 263 return false; |
| 264 } |
| 265 |
| 266 bool WebMediaPlayerClientImpl::supportsSave() const |
| 267 { |
| 268 if (m_webMediaPlayer) |
| 269 return m_webMediaPlayer->supportsSave(); |
| 270 return false; |
| 271 } |
| 272 |
247 void WebMediaPlayerClientImpl::setPoster(const KURL& poster) | 273 void WebMediaPlayerClientImpl::setPoster(const KURL& poster) |
248 { | 274 { |
249 if (m_webMediaPlayer) | 275 if (m_webMediaPlayer) |
250 m_webMediaPlayer->setPoster(WebURL(poster)); | 276 m_webMediaPlayer->setPoster(WebURL(poster)); |
251 } | 277 } |
252 | 278 |
253 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const | 279 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const |
254 { | 280 { |
255 if (m_webMediaPlayer) | 281 if (m_webMediaPlayer) |
256 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS
tate()); | 282 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS
tate()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 339 } |
314 | 340 |
315 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) | 341 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) |
316 { | 342 { |
317 m_preload = preload; | 343 m_preload = preload; |
318 | 344 |
319 if (m_webMediaPlayer) | 345 if (m_webMediaPlayer) |
320 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); | 346 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); |
321 } | 347 } |
322 | 348 |
| 349 bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const |
| 350 { |
| 351 if (m_webMediaPlayer) |
| 352 return m_webMediaPlayer->hasSingleSecurityOrigin(); |
| 353 return false; |
| 354 } |
| 355 |
| 356 double WebMediaPlayerClientImpl::mediaTimeForTimeValue(double timeValue) const |
| 357 { |
| 358 if (m_webMediaPlayer) |
| 359 return m_webMediaPlayer->mediaTimeForTimeValue(timeValue); |
| 360 return timeValue; |
| 361 } |
| 362 |
323 #if ENABLE(WEB_AUDIO) | 363 #if ENABLE(WEB_AUDIO) |
324 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() | 364 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() |
325 { | 365 { |
326 return &m_audioSourceProvider; | 366 return &m_audioSourceProvider; |
327 } | 367 } |
328 #endif | 368 #endif |
329 | 369 |
330 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie
nt) | 370 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie
nt) |
331 { | 371 { |
332 return adoptPtr(new WebMediaPlayerClientImpl(client)); | 372 return adoptPtr(new WebMediaPlayerClientImpl(client)); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 474 |
435 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 475 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
436 { | 476 { |
437 if (m_client) | 477 if (m_client) |
438 m_client->setFormat(numberOfChannels, sampleRate); | 478 m_client->setFormat(numberOfChannels, sampleRate); |
439 } | 479 } |
440 | 480 |
441 #endif | 481 #endif |
442 | 482 |
443 } // namespace blink | 483 } // namespace blink |
OLD | NEW |