|
Lines 44-49
a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec1
|
| 44 |
|
44 |
|
| 45 |
#if ENABLE(MEDIA_SOURCE) |
45 |
#if ENABLE(MEDIA_SOURCE) |
| 46 |
#include "MediaSourcePrivateClient.h" |
46 |
#include "MediaSourcePrivateClient.h" |
|
|
47 |
#include "MockMediaPlayerMediaSource.h" |
| 47 |
#endif |
48 |
#endif |
| 48 |
|
49 |
|
| 49 |
#if USE(GSTREAMER) |
50 |
#if USE(GSTREAMER) |
|
Lines 78-84
const PlatformMedia NoPlatformMedia = { PlatformMedia::None, {0} };
a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec2
|
| 78 |
|
79 |
|
| 79 |
class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface { |
80 |
class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface { |
| 80 |
public: |
81 |
public: |
| 81 |
NullMediaPlayerPrivate(MediaPlayer*) { } |
82 |
explicit NullMediaPlayerPrivate(MediaPlayer*) { } |
| 82 |
|
83 |
|
| 83 |
virtual void load(const String&) { } |
84 |
virtual void load(const String&) { } |
| 84 |
#if ENABLE(MEDIA_SOURCE) |
85 |
#if ENABLE(MEDIA_SOURCE) |
|
Lines 144-182
public:
a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec3
|
| 144 |
#endif |
145 |
#endif |
| 145 |
}; |
146 |
}; |
| 146 |
|
147 |
|
| 147 |
static PassOwnPtr<MediaPlayerPrivateInterface> createNullMediaPlayer(MediaPlayer* player) |
|
|
| 148 |
{ |
| 149 |
return adoptPtr(new NullMediaPlayerPrivate(player)); |
| 150 |
} |
| 151 |
|
| 152 |
|
148 |
|
| 153 |
// engine support |
149 |
// engine support |
| 154 |
|
150 |
|
| 155 |
struct MediaPlayerFactory { |
151 |
struct MediaPlayerFactory { |
| 156 |
WTF_MAKE_NONCOPYABLE(MediaPlayerFactory); WTF_MAKE_FAST_ALLOCATED; |
152 |
WTF_MAKE_NONCOPYABLE(MediaPlayerFactory); WTF_MAKE_FAST_ALLOCATED; |
| 157 |
public: |
153 |
public: |
| 158 |
MediaPlayerFactory(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsTypeAndCodecs, |
154 |
MediaPlayerFactory(MediaEnginePlayerType playerType, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsTypeAndCodecs, |
| 159 |
MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite, MediaEngineSupportsKeySystem supportsKeySystem) |
155 |
MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite, MediaEngineSupportsKeySystem supportsKeySystem) |
| 160 |
: constructor(constructor) |
156 |
: playerType(playerType) |
| 161 |
, getSupportedTypes(getSupportedTypes) |
157 |
, getSupportedTypes(getSupportedTypes) |
| 162 |
, supportsTypeAndCodecs(supportsTypeAndCodecs) |
158 |
, supportsTypeAndCodecs(supportsTypeAndCodecs) |
| 163 |
, getSitesInMediaCache(getSitesInMediaCache) |
159 |
, getSitesInMediaCache(getSitesInMediaCache) |
| 164 |
, clearMediaCache(clearMediaCache) |
160 |
, clearMediaCache(clearMediaCache) |
| 165 |
, clearMediaCacheForSite(clearMediaCacheForSite) |
161 |
, clearMediaCacheForSite(clearMediaCacheForSite) |
| 166 |
, supportsKeySystem(supportsKeySystem) |
162 |
, supportsKeySystem(supportsKeySystem) |
| 167 |
{ |
163 |
{ |
| 168 |
} |
164 |
} |
| 169 |
|
165 |
|
| 170 |
CreateMediaEnginePlayer constructor; |
166 |
MediaEnginePlayerType playerType; |
| 171 |
MediaEngineSupportedTypes getSupportedTypes; |
167 |
MediaEngineSupportedTypes getSupportedTypes; |
| 172 |
MediaEngineSupportsType supportsTypeAndCodecs; |
168 |
MediaEngineSupportsType supportsTypeAndCodecs; |
| 173 |
MediaEngineGetSitesInMediaCache getSitesInMediaCache; |
169 |
MediaEngineGetSitesInMediaCache getSitesInMediaCache; |
| 174 |
MediaEngineClearMediaCache clearMediaCache; |
170 |
MediaEngineClearMediaCache clearMediaCache; |
| 175 |
MediaEngineClearMediaCacheForSite clearMediaCacheForSite; |
171 |
MediaEngineClearMediaCacheForSite clearMediaCacheForSite; |
| 176 |
MediaEngineSupportsKeySystem supportsKeySystem; |
172 |
MediaEngineSupportsKeySystem supportsKeySystem; |
|
|
173 |
|
| 174 |
std::unique_ptr<MediaPlayerPrivateInterface> createMediaPlayer(MediaPlayer* player) |
| 175 |
{ |
| 176 |
switch (playerType) { |
| 177 |
case NullMediaPlayer: |
| 178 |
return std::make_unique<NullMediaPlayerPrivate>(player); |
| 179 |
#if USE(AVFOUNDATION) |
| 180 |
#if PLATFORM(WIN) |
| 181 |
case AVFoundationCFPlayer: |
| 182 |
return std::make_unique<MediaPlayerPrivateAVFoundationCF>(player); |
| 183 |
#endif |
| 184 |
case AVFoundationObjCPlayer: |
| 185 |
return std::make_unique<MediaPlayerPrivateAVFoundationObjC>(player); |
| 186 |
#if PLATFORM(MAC) && ENABLE(MEDIA_SOURCE) |
| 187 |
case MediaSourceAVFObjCPlayer: |
| 188 |
return std::make_unique<MediaPlayerPrivateMediaSourceAVFObjC>(player); |
| 189 |
#endif |
| 190 |
#endif // USE(AVFOUNDATION) |
| 191 |
#if USE(GSTREAMER) |
| 192 |
case GStreamerPlayer: |
| 193 |
return std::make_unique<MediaPlayerPrivateGStreamer>(player); |
| 194 |
#endif |
| 195 |
#if PLATFORM(COCOA) |
| 196 |
case QTKitPlayer: |
| 197 |
return std::make_unique<MediaPlayerPrivateQTKit>(player); |
| 198 |
#endif |
| 199 |
#if PLATFORM(WIN) && USE(MEDIA_FOUNDATION) |
| 200 |
case MediaFoundationPlayer: |
| 201 |
return std::make_unique<MediaPlayerPrivateMediaFoundation>(player); |
| 202 |
#endif |
| 203 |
#if ENABLE(MEDIA_SOURCE) |
| 204 |
case MockMediaSourcePlayer: |
| 205 |
return std::make_unique<MockMediaPlayerMediaSource>(player); |
| 206 |
#endif |
| 207 |
default: |
| 208 |
ASSERT_NOT_REACHED(); |
| 209 |
return std::make_unique<NullMediaPlayerPrivate>(player); |
| 210 |
} |
| 211 |
} |
| 177 |
}; |
212 |
}; |
| 178 |
|
213 |
|
| 179 |
static void addMediaEngine(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType, MediaEngineGetSitesInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForSite, MediaEngineSupportsKeySystem); |
214 |
static void addMediaEngine(MediaEnginePlayerType, MediaEngineSupportedTypes, MediaEngineSupportsType, MediaEngineGetSitesInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForSite, MediaEngineSupportsKeySystem); |
| 180 |
|
215 |
|
| 181 |
static MediaPlayerFactory* bestMediaEngineForSupportParameters(const MediaEngineSupportParameters&, MediaPlayerFactory* current = 0); |
216 |
static MediaPlayerFactory* bestMediaEngineForSupportParameters(const MediaEngineSupportParameters&, MediaPlayerFactory* current = 0); |
| 182 |
static MediaPlayerFactory* nextMediaEngine(MediaPlayerFactory* current); |
217 |
static MediaPlayerFactory* nextMediaEngine(MediaPlayerFactory* current); |
|
Lines 223-236
static Vector<MediaPlayerFactory*>& installedMediaEngines(RequeryEngineOptions r
a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec4
|
| 223 |
return installedEngines; |
258 |
return installedEngines; |
| 224 |
} |
259 |
} |
| 225 |
|
260 |
|
| 226 |
static void addMediaEngine(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsType, |
261 |
static void addMediaEngine(MediaEnginePlayerType playerType, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsType, |
| 227 |
MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite, MediaEngineSupportsKeySystem supportsKeySystem) |
262 |
MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite, MediaEngineSupportsKeySystem supportsKeySystem) |
| 228 |
{ |
263 |
{ |
| 229 |
ASSERT(constructor); |
264 |
ASSERT(playerType); |
| 230 |
ASSERT(getSupportedTypes); |
265 |
ASSERT(getSupportedTypes); |
| 231 |
ASSERT(supportsType); |
266 |
ASSERT(supportsType); |
| 232 |
|
267 |
|
| 233 |
installedMediaEngines().append(new MediaPlayerFactory(constructor, getSupportedTypes, supportsType, getSitesInMediaCache, clearMediaCache, clearMediaCacheForSite, supportsKeySystem)); |
268 |
installedMediaEngines().append(new MediaPlayerFactory(playerType, getSupportedTypes, supportsType, getSitesInMediaCache, clearMediaCache, clearMediaCacheForSite, supportsKeySystem)); |
| 234 |
} |
269 |
} |
| 235 |
|
270 |
|
| 236 |
static const AtomicString& applicationOctetStream() |
271 |
static const AtomicString& applicationOctetStream() |
|
Lines 308-314
static MediaPlayerFactory* nextMediaEngine(MediaPlayerFactory* current)
a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec5
|
| 308 |
MediaPlayer::MediaPlayer(MediaPlayerClient& client) |
343 |
MediaPlayer::MediaPlayer(MediaPlayerClient& client) |
| 309 |
: m_client(client) |
344 |
: m_client(client) |
| 310 |
, m_reloadTimer(this, &MediaPlayer::reloadTimerFired) |
345 |
, m_reloadTimer(this, &MediaPlayer::reloadTimerFired) |
| 311 |
, m_private(createNullMediaPlayer(this)) |
346 |
, m_private(std::make_unique<NullMediaPlayerPrivate>(this)) |
| 312 |
, m_currentMediaEngine(0) |
347 |
, m_currentMediaEngine(0) |
| 313 |
, m_preload(Auto) |
348 |
, m_preload(Auto) |
| 314 |
, m_visible(false) |
349 |
, m_visible(false) |
|
Lines 409-415
void MediaPlayer::loadWithNextMediaEngine(MediaPlayerFactory* current)
a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec6
|
| 409 |
m_private = nullptr; |
444 |
m_private = nullptr; |
| 410 |
} else if (m_currentMediaEngine != engine) { |
445 |
} else if (m_currentMediaEngine != engine) { |
| 411 |
m_currentMediaEngine = engine; |
446 |
m_currentMediaEngine = engine; |
| 412 |
m_private = engine->constructor(this); |
447 |
m_private = engine->createMediaPlayer(this); |
| 413 |
m_client.mediaPlayerEngineUpdated(this); |
448 |
m_client.mediaPlayerEngineUpdated(this); |
| 414 |
m_private->setPrivateBrowsingMode(m_privateBrowsing); |
449 |
m_private->setPrivateBrowsingMode(m_privateBrowsing); |
| 415 |
m_private->setPreload(m_preload); |
450 |
m_private->setPreload(m_preload); |
|
Lines 426-432
void MediaPlayer::loadWithNextMediaEngine(MediaPlayerFactory* current)
a/Source/WebCore/platform/graphics/MediaPlayer.cpp_sec7
|
| 426 |
#endif |
461 |
#endif |
| 427 |
m_private->load(m_url.string()); |
462 |
m_private->load(m_url.string()); |
| 428 |
} else { |
463 |
} else { |
| 429 |
m_private = createNullMediaPlayer(this); |
464 |
m_private = std::make_unique<NullMediaPlayerPrivate>(this); |
| 430 |
m_client.mediaPlayerEngineUpdated(this); |
465 |
m_client.mediaPlayerEngineUpdated(this); |
| 431 |
m_client.mediaPlayerResourceNotSupported(this); |
466 |
m_client.mediaPlayerResourceNotSupported(this); |
| 432 |
} |
467 |
} |