OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 virtual void setSize(const IntSize&) { } | 100 virtual void setSize(const IntSize&) { } |
101 | 101 |
102 virtual void paint(GraphicsContext*, const IntRect&) { } | 102 virtual void paint(GraphicsContext*, const IntRect&) { } |
103 | 103 |
104 virtual bool canLoadPoster() const { return false; } | 104 virtual bool canLoadPoster() const { return false; } |
105 virtual void setPoster(const String&) { } | 105 virtual void setPoster(const String&) { } |
106 | 106 |
107 virtual bool hasSingleSecurityOrigin() const { return true; } | 107 virtual bool hasSingleSecurityOrigin() const { return true; } |
108 | 108 |
109 #if ENABLE(ENCRYPTED_MEDIA) | |
110 virtual MediaPlayer::MediaKeyException generateKeyRequest(const String&, con
st unsigned char*, unsigned) OVERRIDE { return MediaPlayer::InvalidPlayerState;
} | 109 virtual MediaPlayer::MediaKeyException generateKeyRequest(const String&, con
st unsigned char*, unsigned) OVERRIDE { return MediaPlayer::InvalidPlayerState;
} |
111 virtual MediaPlayer::MediaKeyException addKey(const String&, const unsigned
char*, unsigned, const unsigned char*, unsigned, const String&) OVERRIDE { retur
n MediaPlayer::InvalidPlayerState; } | 110 virtual MediaPlayer::MediaKeyException addKey(const String&, const unsigned
char*, unsigned, const unsigned char*, unsigned, const String&) OVERRIDE { retur
n MediaPlayer::InvalidPlayerState; } |
112 virtual MediaPlayer::MediaKeyException cancelKeyRequest(const String&, const
String&) OVERRIDE { return MediaPlayer::InvalidPlayerState; } | 111 virtual MediaPlayer::MediaKeyException cancelKeyRequest(const String&, const
String&) OVERRIDE { return MediaPlayer::InvalidPlayerState; } |
113 #endif | |
114 }; | 112 }; |
115 | 113 |
116 static PassOwnPtr<MediaPlayerPrivateInterface> createNullMediaPlayer(MediaPlayer
* player) | 114 static PassOwnPtr<MediaPlayerPrivateInterface> createNullMediaPlayer(MediaPlayer
* player) |
117 { | 115 { |
118 return adoptPtr(new NullMediaPlayerPrivate(player)); | 116 return adoptPtr(new NullMediaPlayerPrivate(player)); |
119 } | 117 } |
120 | 118 |
121 | 119 |
122 // engine support | 120 // engine support |
123 | 121 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return 0; | 184 return 0; |
187 | 185 |
188 // 4.8.10.3 MIME types - In the absence of a specification to the contrary,
the MIME type "application/octet-stream" | 186 // 4.8.10.3 MIME types - In the absence of a specification to the contrary,
the MIME type "application/octet-stream" |
189 // when used with parameters, e.g. "application/octet-stream;codecs=theora",
is a type that the user agent knows | 187 // when used with parameters, e.g. "application/octet-stream;codecs=theora",
is a type that the user agent knows |
190 // it cannot render. | 188 // it cannot render. |
191 if (type == applicationOctetStream()) { | 189 if (type == applicationOctetStream()) { |
192 if (!codecs.isEmpty()) | 190 if (!codecs.isEmpty()) |
193 return 0; | 191 return 0; |
194 } | 192 } |
195 | 193 |
196 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2) | |
197 MediaPlayer::SupportsType engineSupport = engine->supportsTypeAndCodecs(type
, codecs, keySystem, url); | 194 MediaPlayer::SupportsType engineSupport = engine->supportsTypeAndCodecs(type
, codecs, keySystem, url); |
198 #else | |
199 UNUSED_PARAM(keySystem); | |
200 ASSERT(keySystem.isEmpty()); | |
201 MediaPlayer::SupportsType engineSupport = engine->supportsTypeAndCodecs(type
, codecs, url); | |
202 #endif | |
203 if (engineSupport > MediaPlayer::IsNotSupported) | 195 if (engineSupport > MediaPlayer::IsNotSupported) |
204 return engine; | 196 return engine; |
205 | 197 |
206 return 0; | 198 return 0; |
207 } | 199 } |
208 | 200 |
209 // media player | 201 // media player |
210 | 202 |
211 MediaPlayer::MediaPlayer(MediaPlayerClient* client) | 203 MediaPlayer::MediaPlayer(MediaPlayerClient* client) |
212 : m_mediaPlayerClient(client) | 204 : m_mediaPlayerClient(client) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 void MediaPlayer::play() | 339 void MediaPlayer::play() |
348 { | 340 { |
349 m_private->play(); | 341 m_private->play(); |
350 } | 342 } |
351 | 343 |
352 void MediaPlayer::pause() | 344 void MediaPlayer::pause() |
353 { | 345 { |
354 m_private->pause(); | 346 m_private->pause(); |
355 } | 347 } |
356 | 348 |
357 #if ENABLE(ENCRYPTED_MEDIA) | |
358 MediaPlayer::MediaKeyException MediaPlayer::generateKeyRequest(const String& key
System, const unsigned char* initData, unsigned initDataLength) | 349 MediaPlayer::MediaKeyException MediaPlayer::generateKeyRequest(const String& key
System, const unsigned char* initData, unsigned initDataLength) |
359 { | 350 { |
360 return m_private->generateKeyRequest(keySystem.lower(), initData, initDataLe
ngth); | 351 return m_private->generateKeyRequest(keySystem.lower(), initData, initDataLe
ngth); |
361 } | 352 } |
362 | 353 |
363 MediaPlayer::MediaKeyException MediaPlayer::addKey(const String& keySystem, cons
t unsigned char* key, unsigned keyLength, const unsigned char* initData, unsigne
d initDataLength, const String& sessionId) | 354 MediaPlayer::MediaKeyException MediaPlayer::addKey(const String& keySystem, cons
t unsigned char* key, unsigned keyLength, const unsigned char* initData, unsigne
d initDataLength, const String& sessionId) |
364 { | 355 { |
365 return m_private->addKey(keySystem.lower(), key, keyLength, initData, initDa
taLength, sessionId); | 356 return m_private->addKey(keySystem.lower(), key, keyLength, initData, initDa
taLength, sessionId); |
366 } | 357 } |
367 | 358 |
368 MediaPlayer::MediaKeyException MediaPlayer::cancelKeyRequest(const String& keySy
stem, const String& sessionId) | 359 MediaPlayer::MediaKeyException MediaPlayer::cancelKeyRequest(const String& keySy
stem, const String& sessionId) |
369 { | 360 { |
370 return m_private->cancelKeyRequest(keySystem.lower(), sessionId); | 361 return m_private->cancelKeyRequest(keySystem.lower(), sessionId); |
371 } | 362 } |
372 #endif | |
373 | 363 |
374 double MediaPlayer::duration() const | 364 double MediaPlayer::duration() const |
375 { | 365 { |
376 return m_private->duration(); | 366 return m_private->duration(); |
377 } | 367 } |
378 | 368 |
379 double MediaPlayer::startTime() const | 369 double MediaPlayer::startTime() const |
380 { | 370 { |
381 return m_private->startTime(); | 371 return m_private->startTime(); |
382 } | 372 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 582 |
593 // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty
string if type is a type that the | 583 // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty
string if type is a type that the |
594 // user agent knows it cannot render or is the type "application/octet-strea
m" | 584 // user agent knows it cannot render or is the type "application/octet-strea
m" |
595 if (type == applicationOctetStream()) | 585 if (type == applicationOctetStream()) |
596 return IsNotSupported; | 586 return IsNotSupported; |
597 | 587 |
598 MediaPlayerFactory* engine = bestMediaEngineForTypeAndCodecs(type, typeCodec
s, system, url); | 588 MediaPlayerFactory* engine = bestMediaEngineForTypeAndCodecs(type, typeCodec
s, system, url); |
599 if (!engine) | 589 if (!engine) |
600 return IsNotSupported; | 590 return IsNotSupported; |
601 | 591 |
602 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2) | |
603 return engine->supportsTypeAndCodecs(type, typeCodecs, system, url); | 592 return engine->supportsTypeAndCodecs(type, typeCodecs, system, url); |
604 #else | |
605 ASSERT(system.isEmpty()); | |
606 return engine->supportsTypeAndCodecs(type, typeCodecs, url); | |
607 #endif | |
608 } | 593 } |
609 | 594 |
610 bool MediaPlayer::isAvailable() | 595 bool MediaPlayer::isAvailable() |
611 { | 596 { |
612 return !!installedMediaEngine(); | 597 return !!installedMediaEngine(); |
613 } | 598 } |
614 | 599 |
615 #if USE(NATIVE_FULLSCREEN_VIDEO) | 600 #if USE(NATIVE_FULLSCREEN_VIDEO) |
616 void MediaPlayer::enterFullscreen() | 601 void MediaPlayer::enterFullscreen() |
617 { | 602 { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 m_mediaPlayerClient->mediaPlayerCharacteristicChanged(this); | 746 m_mediaPlayerClient->mediaPlayerCharacteristicChanged(this); |
762 } | 747 } |
763 | 748 |
764 #if ENABLE(WEB_AUDIO) | 749 #if ENABLE(WEB_AUDIO) |
765 AudioSourceProvider* MediaPlayer::audioSourceProvider() | 750 AudioSourceProvider* MediaPlayer::audioSourceProvider() |
766 { | 751 { |
767 return m_private->audioSourceProvider(); | 752 return m_private->audioSourceProvider(); |
768 } | 753 } |
769 #endif // WEB_AUDIO | 754 #endif // WEB_AUDIO |
770 | 755 |
771 #if ENABLE(ENCRYPTED_MEDIA) | |
772 void MediaPlayer::keyAdded(const String& keySystem, const String& sessionId) | 756 void MediaPlayer::keyAdded(const String& keySystem, const String& sessionId) |
773 { | 757 { |
774 if (m_mediaPlayerClient) | 758 if (m_mediaPlayerClient) |
775 m_mediaPlayerClient->mediaPlayerKeyAdded(this, keySystem, sessionId); | 759 m_mediaPlayerClient->mediaPlayerKeyAdded(this, keySystem, sessionId); |
776 } | 760 } |
777 | 761 |
778 void MediaPlayer::keyError(const String& keySystem, const String& sessionId, Med
iaPlayerClient::MediaKeyErrorCode errorCode, unsigned short systemCode) | 762 void MediaPlayer::keyError(const String& keySystem, const String& sessionId, Med
iaPlayerClient::MediaKeyErrorCode errorCode, unsigned short systemCode) |
779 { | 763 { |
780 if (m_mediaPlayerClient) | 764 if (m_mediaPlayerClient) |
781 m_mediaPlayerClient->mediaPlayerKeyError(this, keySystem, sessionId, err
orCode, systemCode); | 765 m_mediaPlayerClient->mediaPlayerKeyError(this, keySystem, sessionId, err
orCode, systemCode); |
782 } | 766 } |
783 | 767 |
784 void MediaPlayer::keyMessage(const String& keySystem, const String& sessionId, c
onst unsigned char* message, unsigned messageLength, const KURL& defaultURL) | 768 void MediaPlayer::keyMessage(const String& keySystem, const String& sessionId, c
onst unsigned char* message, unsigned messageLength, const KURL& defaultURL) |
785 { | 769 { |
786 if (m_mediaPlayerClient) | 770 if (m_mediaPlayerClient) |
787 m_mediaPlayerClient->mediaPlayerKeyMessage(this, keySystem, sessionId, m
essage, messageLength, defaultURL); | 771 m_mediaPlayerClient->mediaPlayerKeyMessage(this, keySystem, sessionId, m
essage, messageLength, defaultURL); |
788 } | 772 } |
789 | 773 |
790 bool MediaPlayer::keyNeeded(const String& keySystem, const String& sessionId, co
nst unsigned char* initData, unsigned initDataLength) | 774 bool MediaPlayer::keyNeeded(const String& keySystem, const String& sessionId, co
nst unsigned char* initData, unsigned initDataLength) |
791 { | 775 { |
792 if (m_mediaPlayerClient) | 776 if (m_mediaPlayerClient) |
793 return m_mediaPlayerClient->mediaPlayerKeyNeeded(this, keySystem, sessio
nId, initData, initDataLength); | 777 return m_mediaPlayerClient->mediaPlayerKeyNeeded(this, keySystem, sessio
nId, initData, initDataLength); |
794 return false; | 778 return false; |
795 } | 779 } |
796 #endif | |
797 | 780 |
798 #if ENABLE(ENCRYPTED_MEDIA_V2) | 781 #if ENABLE(ENCRYPTED_MEDIA_V2) |
799 bool MediaPlayer::keyNeeded(Uint8Array* initData) | 782 bool MediaPlayer::keyNeeded(Uint8Array* initData) |
800 { | 783 { |
801 if (m_mediaPlayerClient) | 784 if (m_mediaPlayerClient) |
802 return m_mediaPlayerClient->mediaPlayerKeyNeeded(this, initData); | 785 return m_mediaPlayerClient->mediaPlayerKeyNeeded(this, initData); |
803 return false; | 786 return false; |
804 } | 787 } |
805 #endif | 788 #endif |
806 | 789 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 { | 831 { |
849 return m_private->requiresTextTrackRepresentation(); | 832 return m_private->requiresTextTrackRepresentation(); |
850 } | 833 } |
851 | 834 |
852 void MediaPlayer::setTextTrackRepresentation(TextTrackRepresentation* representa
tion) | 835 void MediaPlayer::setTextTrackRepresentation(TextTrackRepresentation* representa
tion) |
853 { | 836 { |
854 m_private->setTextTrackRepresentation(representation); | 837 m_private->setTextTrackRepresentation(representation); |
855 } | 838 } |
856 | 839 |
857 } | 840 } |
OLD | NEW |