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 #include "InbandTextTrackPrivateImpl.h" | 8 #include "InbandTextTrackPrivateImpl.h" |
9 #include "WebAudioSourceProvider.h" | 9 #include "WebAudioSourceProvider.h" |
10 #include "WebDocument.h" | 10 #include "WebDocument.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 WebMediaPlayer::Preload WebMediaPlayerClientImpl::preload() const | 189 WebMediaPlayer::Preload WebMediaPlayerClientImpl::preload() const |
190 { | 190 { |
191 if (m_mediaPlayer) | 191 if (m_mediaPlayer) |
192 return static_cast<WebMediaPlayer::Preload>(m_mediaPlayer->preload()); | 192 return static_cast<WebMediaPlayer::Preload>(m_mediaPlayer->preload()); |
193 return static_cast<WebMediaPlayer::Preload>(m_preload); | 193 return static_cast<WebMediaPlayer::Preload>(m_preload); |
194 } | 194 } |
195 | 195 |
196 void WebMediaPlayerClientImpl::keyAdded(const WebString& keySystem, const WebStr
ing& sessionId) | 196 void WebMediaPlayerClientImpl::keyAdded(const WebString& keySystem, const WebStr
ing& sessionId) |
197 { | 197 { |
198 #if ENABLE(ENCRYPTED_MEDIA) | |
199 ASSERT(m_mediaPlayer); | 198 ASSERT(m_mediaPlayer); |
200 m_mediaPlayer->keyAdded(keySystem, sessionId); | 199 m_mediaPlayer->keyAdded(keySystem, sessionId); |
201 #else | |
202 UNUSED_PARAM(keySystem); | |
203 UNUSED_PARAM(sessionId); | |
204 #endif | |
205 } | 200 } |
206 | 201 |
207 void WebMediaPlayerClientImpl::keyError(const WebString& keySystem, const WebStr
ing& sessionId, MediaKeyErrorCode errorCode, unsigned short systemCode) | 202 void WebMediaPlayerClientImpl::keyError(const WebString& keySystem, const WebStr
ing& sessionId, MediaKeyErrorCode errorCode, unsigned short systemCode) |
208 { | 203 { |
209 #if ENABLE(ENCRYPTED_MEDIA) | |
210 ASSERT(m_mediaPlayer); | 204 ASSERT(m_mediaPlayer); |
211 m_mediaPlayer->keyError(keySystem, sessionId, static_cast<MediaPlayerClient:
:MediaKeyErrorCode>(errorCode), systemCode); | 205 m_mediaPlayer->keyError(keySystem, sessionId, static_cast<MediaPlayerClient:
:MediaKeyErrorCode>(errorCode), systemCode); |
212 #else | |
213 UNUSED_PARAM(keySystem); | |
214 UNUSED_PARAM(sessionId); | |
215 UNUSED_PARAM(errorCode); | |
216 UNUSED_PARAM(systemCode); | |
217 #endif | |
218 } | 206 } |
219 | 207 |
220 void WebMediaPlayerClientImpl::keyMessage(const WebString& keySystem, const WebS
tring& sessionId, const unsigned char* message, unsigned messageLength, const We
bURL& defaultURL) | 208 void WebMediaPlayerClientImpl::keyMessage(const WebString& keySystem, const WebS
tring& sessionId, const unsigned char* message, unsigned messageLength, const We
bURL& defaultURL) |
221 { | 209 { |
222 #if ENABLE(ENCRYPTED_MEDIA) | |
223 ASSERT(m_mediaPlayer); | 210 ASSERT(m_mediaPlayer); |
224 m_mediaPlayer->keyMessage(keySystem, sessionId, message, messageLength, defa
ultURL); | 211 m_mediaPlayer->keyMessage(keySystem, sessionId, message, messageLength, defa
ultURL); |
225 #else | |
226 UNUSED_PARAM(keySystem); | |
227 UNUSED_PARAM(sessionId); | |
228 UNUSED_PARAM(message); | |
229 UNUSED_PARAM(messageLength); | |
230 UNUSED_PARAM(defaultURL); | |
231 #endif | |
232 } | 212 } |
233 | 213 |
234 void WebMediaPlayerClientImpl::keyNeeded(const WebString& keySystem, const WebSt
ring& sessionId, const unsigned char* initData, unsigned initDataLength) | 214 void WebMediaPlayerClientImpl::keyNeeded(const WebString& keySystem, const WebSt
ring& sessionId, const unsigned char* initData, unsigned initDataLength) |
235 { | 215 { |
236 #if ENABLE(ENCRYPTED_MEDIA) | |
237 ASSERT(m_mediaPlayer); | 216 ASSERT(m_mediaPlayer); |
238 m_mediaPlayer->keyNeeded(keySystem, sessionId, initData, initDataLength); | 217 m_mediaPlayer->keyNeeded(keySystem, sessionId, initData, initDataLength); |
239 #else | |
240 UNUSED_PARAM(keySystem); | |
241 UNUSED_PARAM(sessionId); | |
242 UNUSED_PARAM(initData); | |
243 UNUSED_PARAM(initDataLength); | |
244 #endif | |
245 } | 218 } |
246 | 219 |
247 WebPlugin* WebMediaPlayerClientImpl::createHelperPlugin(const WebString& pluginT
ype, WebFrame* frame) | 220 WebPlugin* WebMediaPlayerClientImpl::createHelperPlugin(const WebString& pluginT
ype, WebFrame* frame) |
248 { | 221 { |
249 ASSERT(!m_helperPlugin); | 222 ASSERT(!m_helperPlugin); |
250 | 223 |
251 WebViewImpl* webView = static_cast<WebViewImpl*>(frame->view()); | 224 WebViewImpl* webView = static_cast<WebViewImpl*>(frame->view()); |
252 m_helperPlugin = webView->createHelperPlugin(pluginType, frame->document()); | 225 m_helperPlugin = webView->createHelperPlugin(pluginType, frame->document()); |
253 if (!m_helperPlugin) | 226 if (!m_helperPlugin) |
254 return 0; | 227 return 0; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (m_webMediaPlayer) | 371 if (m_webMediaPlayer) |
399 m_webMediaPlayer->exitFullscreen(); | 372 m_webMediaPlayer->exitFullscreen(); |
400 } | 373 } |
401 | 374 |
402 bool WebMediaPlayerClientImpl::canEnterFullscreen() const | 375 bool WebMediaPlayerClientImpl::canEnterFullscreen() const |
403 { | 376 { |
404 return m_webMediaPlayer && m_webMediaPlayer->canEnterFullscreen(); | 377 return m_webMediaPlayer && m_webMediaPlayer->canEnterFullscreen(); |
405 } | 378 } |
406 #endif | 379 #endif |
407 | 380 |
408 #if ENABLE(ENCRYPTED_MEDIA) | |
409 MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::generateKeyRequest(cons
t String& keySystem, const unsigned char* initData, unsigned initDataLength) | 381 MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::generateKeyRequest(cons
t String& keySystem, const unsigned char* initData, unsigned initDataLength) |
410 { | 382 { |
411 if (!m_webMediaPlayer) | 383 if (!m_webMediaPlayer) |
412 return MediaPlayer::InvalidPlayerState; | 384 return MediaPlayer::InvalidPlayerState; |
413 | 385 |
414 WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->generateKeyRequ
est(keySystem, initData, initDataLength); | 386 WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->generateKeyRequ
est(keySystem, initData, initDataLength); |
415 return static_cast<MediaPlayer::MediaKeyException>(result); | 387 return static_cast<MediaPlayer::MediaKeyException>(result); |
416 } | 388 } |
417 | 389 |
418 MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::addKey(const String& ke
ySystem, const unsigned char* key, unsigned keyLength, const unsigned char* init
Data, unsigned initDataLength, const String& sessionId) | 390 MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::addKey(const String& ke
ySystem, const unsigned char* key, unsigned keyLength, const unsigned char* init
Data, unsigned initDataLength, const String& sessionId) |
419 { | 391 { |
420 if (!m_webMediaPlayer) | 392 if (!m_webMediaPlayer) |
421 return MediaPlayer::InvalidPlayerState; | 393 return MediaPlayer::InvalidPlayerState; |
422 | 394 |
423 WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->addKey(keySyste
m, key, keyLength, initData, initDataLength, sessionId); | 395 WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->addKey(keySyste
m, key, keyLength, initData, initDataLength, sessionId); |
424 return static_cast<MediaPlayer::MediaKeyException>(result); | 396 return static_cast<MediaPlayer::MediaKeyException>(result); |
425 } | 397 } |
426 | 398 |
427 MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::cancelKeyRequest(const
String& keySystem, const String& sessionId) | 399 MediaPlayer::MediaKeyException WebMediaPlayerClientImpl::cancelKeyRequest(const
String& keySystem, const String& sessionId) |
428 { | 400 { |
429 if (!m_webMediaPlayer) | 401 if (!m_webMediaPlayer) |
430 return MediaPlayer::InvalidPlayerState; | 402 return MediaPlayer::InvalidPlayerState; |
431 | 403 |
432 WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->cancelKeyReques
t(keySystem, sessionId); | 404 WebMediaPlayer::MediaKeyException result = m_webMediaPlayer->cancelKeyReques
t(keySystem, sessionId); |
433 return static_cast<MediaPlayer::MediaKeyException>(result); | 405 return static_cast<MediaPlayer::MediaKeyException>(result); |
434 } | 406 } |
435 #endif | |
436 | 407 |
437 void WebMediaPlayerClientImpl::prepareToPlay() | 408 void WebMediaPlayerClientImpl::prepareToPlay() |
438 { | 409 { |
439 if (m_delayingLoad) | 410 if (m_delayingLoad) |
440 startDelayedLoad(); | 411 startDelayedLoad(); |
441 } | 412 } |
442 | 413 |
443 IntSize WebMediaPlayerClientImpl::naturalSize() const | 414 IntSize WebMediaPlayerClientImpl::naturalSize() const |
444 { | 415 { |
445 if (m_webMediaPlayer) | 416 if (m_webMediaPlayer) |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 return m_videoLayer && !m_videoLayer->isOrphan(); | 694 return m_videoLayer && !m_videoLayer->isOrphan(); |
724 } | 695 } |
725 | 696 |
726 PassOwnPtr<MediaPlayerPrivateInterface> WebMediaPlayerClientImpl::create(MediaPl
ayer* player) | 697 PassOwnPtr<MediaPlayerPrivateInterface> WebMediaPlayerClientImpl::create(MediaPl
ayer* player) |
727 { | 698 { |
728 OwnPtr<WebMediaPlayerClientImpl> client = adoptPtr(new WebMediaPlayerClientI
mpl()); | 699 OwnPtr<WebMediaPlayerClientImpl> client = adoptPtr(new WebMediaPlayerClientI
mpl()); |
729 client->m_mediaPlayer = player; | 700 client->m_mediaPlayer = player; |
730 return client.release(); | 701 return client.release(); |
731 } | 702 } |
732 | 703 |
733 #if ENABLE(ENCRYPTED_MEDIA) | |
734 MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& t
ype, | 704 MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& t
ype, |
735 const String& c
odecs, | 705 const String& c
odecs, |
736 const String& k
eySystem, | 706 const String& k
eySystem, |
737 const KURL&) | 707 const KURL&) |
738 { | 708 { |
739 #else | |
740 MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& t
ype, | |
741 const String& c
odecs, | |
742 const KURL&) | |
743 { | |
744 String keySystem; | |
745 #endif | |
746 WebMimeRegistry::SupportsType supportsType = WebKit::Platform::current()->mi
meRegistry()->supportsMediaMIMEType(type, codecs, keySystem); | 709 WebMimeRegistry::SupportsType supportsType = WebKit::Platform::current()->mi
meRegistry()->supportsMediaMIMEType(type, codecs, keySystem); |
747 | 710 |
748 switch (supportsType) { | 711 switch (supportsType) { |
749 default: | 712 default: |
750 ASSERT_NOT_REACHED(); | 713 ASSERT_NOT_REACHED(); |
751 case WebMimeRegistry::IsNotSupported: | 714 case WebMimeRegistry::IsNotSupported: |
752 return MediaPlayer::IsNotSupported; | 715 return MediaPlayer::IsNotSupported; |
753 case WebMimeRegistry::IsSupported: | 716 case WebMimeRegistry::IsSupported: |
754 return MediaPlayer::IsSupported; | 717 return MediaPlayer::IsSupported; |
755 case WebMimeRegistry::MayBeSupported: | 718 case WebMimeRegistry::MayBeSupported: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 | 842 |
880 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 843 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
881 { | 844 { |
882 if (m_client) | 845 if (m_client) |
883 m_client->setFormat(numberOfChannels, sampleRate); | 846 m_client->setFormat(numberOfChannels, sampleRate); |
884 } | 847 } |
885 | 848 |
886 #endif | 849 #endif |
887 | 850 |
888 } // namespace WebKit | 851 } // namespace WebKit |
OLD | NEW |