| 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 30 matching lines...) Expand all Loading... |
| 41 #include <wtf/text/CString.h> | 41 #include <wtf/text/CString.h> |
| 42 | 42 |
| 43 #if ENABLE(VIDEO_TRACK) | 43 #if ENABLE(VIDEO_TRACK) |
| 44 #include "InbandTextTrackPrivate.h" | 44 #include "InbandTextTrackPrivate.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if ENABLE(MEDIA_SOURCE) | 47 #if ENABLE(MEDIA_SOURCE) |
| 48 #include "MediaSource.h" | 48 #include "MediaSource.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if PLATFORM(QT) | |
| 52 #include <QtGlobal> | |
| 53 #endif | |
| 54 | |
| 55 #if USE(GSTREAMER) | 51 #if USE(GSTREAMER) |
| 56 #include "MediaPlayerPrivateGStreamer.h" | 52 #include "MediaPlayerPrivateGStreamer.h" |
| 57 #define PlatformMediaEngineClassName MediaPlayerPrivateGStreamer | 53 #define PlatformMediaEngineClassName MediaPlayerPrivateGStreamer |
| 58 #endif | 54 #endif |
| 59 | 55 |
| 60 #if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) | |
| 61 #include "MediaPlayerPrivateQTKit.h" | |
| 62 #if USE(AVFOUNDATION) | |
| 63 #include "MediaPlayerPrivateAVFoundationObjC.h" | |
| 64 #endif | |
| 65 #elif OS(WINCE) && !PLATFORM(QT) | |
| 66 #include "MediaPlayerPrivateWinCE.h" | |
| 67 #define PlatformMediaEngineClassName MediaPlayerPrivate | |
| 68 #elif PLATFORM(WIN) | |
| 69 #include "MediaPlayerPrivateQuickTimeVisualContext.h" | |
| 70 #define PlatformMediaEngineClassName MediaPlayerPrivateQuickTimeVisualContext | |
| 71 #if USE(AVFOUNDATION) | |
| 72 #include "MediaPlayerPrivateAVFoundationCF.h" | |
| 73 #endif | |
| 74 #elif PLATFORM(QT) | |
| 75 #if USE(QT_MULTIMEDIA) && !USE(GSTREAMER) | |
| 76 #include "MediaPlayerPrivateQt.h" | |
| 77 #define PlatformMediaEngineClassName MediaPlayerPrivateQt | |
| 78 #endif | |
| 79 #elif PLATFORM(CHROMIUM) | |
| 80 #include "MediaPlayerPrivateChromium.h" | 56 #include "MediaPlayerPrivateChromium.h" |
| 81 #define PlatformMediaEngineClassName MediaPlayerPrivate | 57 #define PlatformMediaEngineClassName MediaPlayerPrivate |
| 82 #elif PLATFORM(BLACKBERRY) | |
| 83 #include "MediaPlayerPrivateBlackBerry.h" | |
| 84 #define PlatformMediaEngineClassName MediaPlayerPrivate | |
| 85 #endif | |
| 86 | 58 |
| 87 namespace WebCore { | 59 namespace WebCore { |
| 88 | 60 |
| 89 const PlatformMedia NoPlatformMedia = { PlatformMedia::None, {0} }; | 61 const PlatformMedia NoPlatformMedia = { PlatformMedia::None, {0} }; |
| 90 | 62 |
| 91 // a null player to make MediaPlayer logic simpler | 63 // a null player to make MediaPlayer logic simpler |
| 92 | 64 |
| 93 class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface { | 65 class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface { |
| 94 public: | 66 public: |
| 95 NullMediaPlayerPrivate(MediaPlayer*) { } | 67 NullMediaPlayerPrivate(MediaPlayer*) { } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 180 |
| 209 if (requeryFlags == ResetEngines) { | 181 if (requeryFlags == ResetEngines) { |
| 210 installedEngines.clear(); | 182 installedEngines.clear(); |
| 211 enginesQueried = false; | 183 enginesQueried = false; |
| 212 return installedEngines; | 184 return installedEngines; |
| 213 } | 185 } |
| 214 | 186 |
| 215 if (!enginesQueried) { | 187 if (!enginesQueried) { |
| 216 enginesQueried = true; | 188 enginesQueried = true; |
| 217 | 189 |
| 218 #if USE(AVFOUNDATION) | |
| 219 if (Settings::isAVFoundationEnabled()) { | |
| 220 #if PLATFORM(MAC) | |
| 221 MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(addMediaEngi
ne); | |
| 222 #elif PLATFORM(WIN) | |
| 223 MediaPlayerPrivateAVFoundationCF::registerMediaEngine(addMediaEngine
); | |
| 224 #endif | |
| 225 } | |
| 226 #endif | |
| 227 | |
| 228 #if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) | |
| 229 if (Settings::isQTKitEnabled()) | |
| 230 MediaPlayerPrivateQTKit::registerMediaEngine(addMediaEngine); | |
| 231 #endif | |
| 232 | |
| 233 #if defined(PlatformMediaEngineClassName) | 190 #if defined(PlatformMediaEngineClassName) |
| 234 PlatformMediaEngineClassName::registerMediaEngine(addMediaEngine); | 191 PlatformMediaEngineClassName::registerMediaEngine(addMediaEngine); |
| 235 #endif | 192 #endif |
| 236 } | 193 } |
| 237 | 194 |
| 238 return installedEngines; | 195 return installedEngines; |
| 239 } | 196 } |
| 240 | 197 |
| 241 static void addMediaEngine(CreateMediaEnginePlayer constructor, MediaEngineSuppo
rtedTypes getSupportedTypes, MediaEngineSupportsType supportsType, | 198 static void addMediaEngine(CreateMediaEnginePlayer constructor, MediaEngineSuppo
rtedTypes getSupportedTypes, MediaEngineSupportsType supportsType, |
| 242 MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaC
ache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite) | 199 MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaC
ache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite) |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 699 |
| 743 // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty
string if type is a type that the | 700 // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty
string if type is a type that the |
| 744 // user agent knows it cannot render or is the type "application/octet-strea
m" | 701 // user agent knows it cannot render or is the type "application/octet-strea
m" |
| 745 if (type == applicationOctetStream()) | 702 if (type == applicationOctetStream()) |
| 746 return IsNotSupported; | 703 return IsNotSupported; |
| 747 | 704 |
| 748 MediaPlayerFactory* engine = bestMediaEngineForTypeAndCodecs(type, typeCodec
s, system, url); | 705 MediaPlayerFactory* engine = bestMediaEngineForTypeAndCodecs(type, typeCodec
s, system, url); |
| 749 if (!engine) | 706 if (!engine) |
| 750 return IsNotSupported; | 707 return IsNotSupported; |
| 751 | 708 |
| 752 #if PLATFORM(MAC) | 709 // FIXME: Remove this parameter. This was used by the Mac port. |
| 753 // YouTube will ask if the HTMLMediaElement canPlayType video/webm, then | |
| 754 // video/x-flv, then finally video/mp4, and will then load a URL of the firs
t type | |
| 755 // in that list which returns "probably". When Perian is installed, | |
| 756 // MediaPlayerPrivateQTKit claims to support both video/webm and video/x-flv
, but | |
| 757 // due to a bug in Perian, loading media in these formats will sometimes fai
l on | |
| 758 // slow connections. <https://bugs.webkit.org/show_bug.cgi?id=86409> | |
| 759 if (client && client->mediaPlayerNeedsSiteSpecificHacks()) { | |
| 760 String host = client->mediaPlayerDocumentHost(); | |
| 761 if ((host.endsWith(".youtube.com", false) || equalIgnoringCase("youtube.
com", host)) | |
| 762 && (contentType.type().startsWith("video/webm", false) || contentTyp
e.type().startsWith("video/x-flv", false))) | |
| 763 return IsNotSupported; | |
| 764 } | |
| 765 #else | |
| 766 UNUSED_PARAM(client); | 710 UNUSED_PARAM(client); |
| 767 #endif | |
| 768 | 711 |
| 769 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2) | 712 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2) |
| 770 return engine->supportsTypeAndCodecs(type, typeCodecs, system, url); | 713 return engine->supportsTypeAndCodecs(type, typeCodecs, system, url); |
| 771 #else | 714 #else |
| 772 ASSERT(system.isEmpty()); | 715 ASSERT(system.isEmpty()); |
| 773 return engine->supportsTypeAndCodecs(type, typeCodecs, url); | 716 return engine->supportsTypeAndCodecs(type, typeCodecs, url); |
| 774 #endif | 717 #endif |
| 775 } | 718 } |
| 776 | 719 |
| 777 void MediaPlayer::getSupportedTypes(HashSet<String>& types) | 720 void MediaPlayer::getSupportedTypes(HashSet<String>& types) |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 } | 1017 } |
| 1075 | 1018 |
| 1076 String MediaPlayer::engineDescription() const | 1019 String MediaPlayer::engineDescription() const |
| 1077 { | 1020 { |
| 1078 if (!m_private) | 1021 if (!m_private) |
| 1079 return String(); | 1022 return String(); |
| 1080 | 1023 |
| 1081 return m_private->engineDescription(); | 1024 return m_private->engineDescription(); |
| 1082 } | 1025 } |
| 1083 | 1026 |
| 1084 #if PLATFORM(WIN) && USE(AVFOUNDATION) | |
| 1085 GraphicsDeviceAdapter* MediaPlayer::graphicsDeviceAdapter() const | |
| 1086 { | |
| 1087 if (!m_mediaPlayerClient) | |
| 1088 return 0; | |
| 1089 | |
| 1090 return m_mediaPlayerClient->mediaPlayerGraphicsDeviceAdapter(this); | |
| 1091 } | |
| 1092 #endif | |
| 1093 | |
| 1094 CachedResourceLoader* MediaPlayer::cachedResourceLoader() | 1027 CachedResourceLoader* MediaPlayer::cachedResourceLoader() |
| 1095 { | 1028 { |
| 1096 if (!m_mediaPlayerClient) | 1029 if (!m_mediaPlayerClient) |
| 1097 return 0; | 1030 return 0; |
| 1098 | 1031 |
| 1099 return m_mediaPlayerClient->mediaPlayerCachedResourceLoader(); | 1032 return m_mediaPlayerClient->mediaPlayerCachedResourceLoader(); |
| 1100 } | 1033 } |
| 1101 | 1034 |
| 1102 #if ENABLE(VIDEO_TRACK) | 1035 #if ENABLE(VIDEO_TRACK) |
| 1103 void MediaPlayer::addTextTrack(PassRefPtr<InbandTextTrackPrivate> track) | 1036 void MediaPlayer::addTextTrack(PassRefPtr<InbandTextTrackPrivate> track) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 if (!m_private) | 1083 if (!m_private) |
| 1151 return; | 1084 return; |
| 1152 | 1085 |
| 1153 m_private->simulateAudioInterruption(); | 1086 m_private->simulateAudioInterruption(); |
| 1154 } | 1087 } |
| 1155 #endif | 1088 #endif |
| 1156 | 1089 |
| 1157 } | 1090 } |
| 1158 | 1091 |
| 1159 #endif | 1092 #endif |
| OLD | NEW |