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 "WebMediaPlayerClientImpl.h" | 6 #include "WebMediaPlayerClientImpl.h" |
7 | 7 |
8 #if ENABLE(VIDEO) | 8 #if ENABLE(VIDEO) |
9 | 9 |
10 #include "TemporaryGlue.h" | 10 #include "TemporaryGlue.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 } | 227 } |
228 | 228 |
229 void WebMediaPlayerClientImpl::setVolume(float volume) | 229 void WebMediaPlayerClientImpl::setVolume(float volume) |
230 { | 230 { |
231 if (m_webMediaPlayer.get()) | 231 if (m_webMediaPlayer.get()) |
232 m_webMediaPlayer->setVolume(volume); | 232 m_webMediaPlayer->setVolume(volume); |
233 } | 233 } |
234 | 234 |
235 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const | 235 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const |
236 { | 236 { |
237 COMPILE_ASSERT( | |
238 int(WebMediaPlayer::Empty) == int(MediaPlayer::Empty), Empty); | |
239 COMPILE_ASSERT( | |
240 int(WebMediaPlayer::Idle) == int(MediaPlayer::Idle), Idle); | |
241 COMPILE_ASSERT( | |
242 int(WebMediaPlayer::Loading) == int(MediaPlayer::Loading), Loading); | |
243 COMPILE_ASSERT( | |
244 int(WebMediaPlayer::Loaded) == int(MediaPlayer::Loaded), Loaded); | |
245 COMPILE_ASSERT( | |
246 int(WebMediaPlayer::FormatError) == int(MediaPlayer::FormatError), | |
247 FormatError); | |
248 COMPILE_ASSERT( | |
249 int(WebMediaPlayer::NetworkError) == int(MediaPlayer::NetworkError), | |
250 NetworkError); | |
251 COMPILE_ASSERT( | |
252 int(WebMediaPlayer::DecodeError) == int(MediaPlayer::DecodeError), | |
253 DecodeError); | |
254 | |
255 if (m_webMediaPlayer.get()) | 237 if (m_webMediaPlayer.get()) |
256 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkState()); | 238 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkState()); |
257 return MediaPlayer::Empty; | 239 return MediaPlayer::Empty; |
258 } | 240 } |
259 | 241 |
260 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const | 242 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const |
261 { | 243 { |
262 COMPILE_ASSERT( | |
263 int(WebMediaPlayer::HaveNothing) == int(MediaPlayer::HaveNothing), | |
264 HaveNothing); | |
265 COMPILE_ASSERT( | |
266 int(WebMediaPlayer::HaveMetadata) == int(MediaPlayer::HaveMetadata), | |
267 HaveMetadata); | |
268 COMPILE_ASSERT( | |
269 int(WebMediaPlayer::HaveCurrentData) == int(MediaPlayer::HaveCurrentData), | |
270 HaveCurrentData); | |
271 COMPILE_ASSERT( | |
272 int(WebMediaPlayer::HaveFutureData) == int(MediaPlayer::HaveFutureData), | |
273 HaveFutureData); | |
274 COMPILE_ASSERT( | |
275 int(WebMediaPlayer::HaveEnoughData) == int(MediaPlayer::HaveEnoughData), | |
276 HaveEnoughData); | |
277 | |
278 if (m_webMediaPlayer.get()) | 244 if (m_webMediaPlayer.get()) |
279 return static_cast<MediaPlayer::ReadyState>(m_webMediaPlayer->readyState()); | 245 return static_cast<MediaPlayer::ReadyState>(m_webMediaPlayer->readyState()); |
280 return MediaPlayer::HaveNothing; | 246 return MediaPlayer::HaveNothing; |
281 } | 247 } |
282 | 248 |
283 float WebMediaPlayerClientImpl::maxTimeSeekable() const | 249 float WebMediaPlayerClientImpl::maxTimeSeekable() const |
284 { | 250 { |
285 if (m_webMediaPlayer.get()) | 251 if (m_webMediaPlayer.get()) |
286 return m_webMediaPlayer->maxTimeSeekable(); | 252 return m_webMediaPlayer->maxTimeSeekable(); |
287 return 0.0f; | 253 return 0.0f; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 | 318 |
353 bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const | 319 bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const |
354 { | 320 { |
355 if (m_webMediaPlayer.get()) | 321 if (m_webMediaPlayer.get()) |
356 return m_webMediaPlayer->hasSingleSecurityOrigin(); | 322 return m_webMediaPlayer->hasSingleSecurityOrigin(); |
357 return false; | 323 return false; |
358 } | 324 } |
359 | 325 |
360 MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const | 326 MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const |
361 { | 327 { |
362 COMPILE_ASSERT( | |
363 int(WebMediaPlayer::Unknown) == int(MediaPlayer::Unknown), | |
364 Unknown); | |
365 COMPILE_ASSERT( | |
366 int(WebMediaPlayer::Download) == int(MediaPlayer::Download), | |
367 Download); | |
368 COMPILE_ASSERT( | |
369 int(WebMediaPlayer::StoredStream) == int(MediaPlayer::StoredStream), | |
370 StoredStream); | |
371 COMPILE_ASSERT( | |
372 int(WebMediaPlayer::LiveStream) == int(MediaPlayer::LiveStream), | |
373 LiveStream); | |
374 | |
375 if (m_webMediaPlayer.get()) | 328 if (m_webMediaPlayer.get()) |
376 return static_cast<MediaPlayer::MovieLoadType>( | 329 return static_cast<MediaPlayer::MovieLoadType>( |
377 m_webMediaPlayer->movieLoadType()); | 330 m_webMediaPlayer->movieLoadType()); |
378 return MediaPlayer::Unknown; | 331 return MediaPlayer::Unknown; |
379 } | 332 } |
380 | 333 |
381 MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player) | 334 MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player) |
382 { | 335 { |
383 WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl(); | 336 WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl(); |
384 client->m_mediaPlayer = player; | 337 client->m_mediaPlayer = player; |
(...skipping 12 matching lines...) Expand all Loading... | |
397 WebMimeRegistry::SupportsType supportsType = | 350 WebMimeRegistry::SupportsType supportsType = |
398 webKitClient()->mimeRegistry()->supportsMediaMIMEType(type, codecs); | 351 webKitClient()->mimeRegistry()->supportsMediaMIMEType(type, codecs); |
399 | 352 |
400 switch (supportsType) { | 353 switch (supportsType) { |
401 default: | 354 default: |
402 ASSERT_NOT_REACHED(); | 355 ASSERT_NOT_REACHED(); |
403 case WebMimeRegistry::IsNotSupported: | 356 case WebMimeRegistry::IsNotSupported: |
404 return MediaPlayer::IsNotSupported; | 357 return MediaPlayer::IsNotSupported; |
405 case WebMimeRegistry::IsSupported: | 358 case WebMimeRegistry::IsSupported: |
406 return MediaPlayer::IsSupported; | 359 return MediaPlayer::IsSupported; |
407 case WebMimeRegistry::MayBeSupported: | 360 case WebMimeRegistry::MayBeSupported: |
scherkus (not reviewing)
2009/09/08 20:15:34
Hmm... it looks like we can't do the same trick he
| |
408 return MediaPlayer::MayBeSupported; | 361 return MediaPlayer::MayBeSupported; |
409 } | 362 } |
410 } | 363 } |
411 | 364 |
412 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl() | 365 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl() |
413 : m_mediaPlayer(0) | 366 : m_mediaPlayer(0) |
414 { | 367 { |
415 } | 368 } |
416 | 369 |
417 } // namespace WebKit | 370 } // namespace WebKit |
418 | 371 |
419 #endif // ENABLE(VIDEO) | 372 #endif // ENABLE(VIDEO) |
OLD | NEW |