| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 , m_reloadTimer(this, &MediaPlayer::reloadTimerFired) | 279 , m_reloadTimer(this, &MediaPlayer::reloadTimerFired) |
| 280 , m_private(createNullMediaPlayer(this)) | 280 , m_private(createNullMediaPlayer(this)) |
| 281 , m_currentMediaEngine(0) | 281 , m_currentMediaEngine(0) |
| 282 , m_frameView(0) | 282 , m_frameView(0) |
| 283 , m_preload(Auto) | 283 , m_preload(Auto) |
| 284 , m_visible(false) | 284 , m_visible(false) |
| 285 , m_rate(1.0f) | 285 , m_rate(1.0f) |
| 286 , m_volume(1.0f) | 286 , m_volume(1.0f) |
| 287 , m_muted(false) | 287 , m_muted(false) |
| 288 , m_preservesPitch(true) | 288 , m_preservesPitch(true) |
| 289 , m_privateBrowsing(false) | |
| 290 , m_shouldPrepareToRender(false) | 289 , m_shouldPrepareToRender(false) |
| 291 , m_contentMIMETypeWasInferredFromExtension(false) | 290 , m_contentMIMETypeWasInferredFromExtension(false) |
| 292 { | 291 { |
| 293 } | 292 } |
| 294 | 293 |
| 295 MediaPlayer::~MediaPlayer() | 294 MediaPlayer::~MediaPlayer() |
| 296 { | 295 { |
| 297 m_mediaPlayerClient = 0; | 296 m_mediaPlayerClient = 0; |
| 298 } | 297 } |
| 299 | 298 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // Don't delete and recreate the player unless it comes from a different eng
ine. | 353 // Don't delete and recreate the player unless it comes from a different eng
ine. |
| 355 if (!engine) { | 354 if (!engine) { |
| 356 LOG(Media, "MediaPlayer::loadWithNextMediaEngine - no media engine found
for type \"%s\"", m_contentMIMEType.utf8().data()); | 355 LOG(Media, "MediaPlayer::loadWithNextMediaEngine - no media engine found
for type \"%s\"", m_contentMIMEType.utf8().data()); |
| 357 m_currentMediaEngine = engine; | 356 m_currentMediaEngine = engine; |
| 358 m_private = nullptr; | 357 m_private = nullptr; |
| 359 } else if (m_currentMediaEngine != engine) { | 358 } else if (m_currentMediaEngine != engine) { |
| 360 m_currentMediaEngine = engine; | 359 m_currentMediaEngine = engine; |
| 361 m_private = engine->constructor(this); | 360 m_private = engine->constructor(this); |
| 362 if (m_mediaPlayerClient) | 361 if (m_mediaPlayerClient) |
| 363 m_mediaPlayerClient->mediaPlayerEngineUpdated(this); | 362 m_mediaPlayerClient->mediaPlayerEngineUpdated(this); |
| 364 m_private->setPrivateBrowsingMode(m_privateBrowsing); | |
| 365 m_private->setPreload(m_preload); | 363 m_private->setPreload(m_preload); |
| 366 m_private->setPreservesPitch(preservesPitch()); | 364 m_private->setPreservesPitch(preservesPitch()); |
| 367 if (m_shouldPrepareToRender) | 365 if (m_shouldPrepareToRender) |
| 368 m_private->prepareForRendering(); | 366 m_private->prepareForRendering(); |
| 369 } | 367 } |
| 370 | 368 |
| 371 if (m_private) { | 369 if (m_private) { |
| 372 if (m_mediaSource) | 370 if (m_mediaSource) |
| 373 m_private->load(m_url.string(), m_mediaSource); | 371 m_private->load(m_url.string(), m_mediaSource); |
| 374 else | 372 else |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 void MediaPlayer::clearMediaCacheForSite(const String& site) | 804 void MediaPlayer::clearMediaCacheForSite(const String& site) |
| 807 { | 805 { |
| 808 Vector<MediaPlayerFactory*>& engines = installedMediaEngines(); | 806 Vector<MediaPlayerFactory*>& engines = installedMediaEngines(); |
| 809 unsigned size = engines.size(); | 807 unsigned size = engines.size(); |
| 810 for (unsigned i = 0; i < size; i++) { | 808 for (unsigned i = 0; i < size; i++) { |
| 811 if (engines[i]->clearMediaCacheForSite) | 809 if (engines[i]->clearMediaCacheForSite) |
| 812 engines[i]->clearMediaCacheForSite(site); | 810 engines[i]->clearMediaCacheForSite(site); |
| 813 } | 811 } |
| 814 } | 812 } |
| 815 | 813 |
| 816 void MediaPlayer::setPrivateBrowsingMode(bool privateBrowsingMode) | |
| 817 { | |
| 818 m_privateBrowsing = privateBrowsingMode; | |
| 819 m_private->setPrivateBrowsingMode(m_privateBrowsing); | |
| 820 } | |
| 821 | |
| 822 // Client callbacks. | 814 // Client callbacks. |
| 823 void MediaPlayer::networkStateChanged() | 815 void MediaPlayer::networkStateChanged() |
| 824 { | 816 { |
| 825 // If more than one media engine is installed and this one failed before fin
ding metadata, | 817 // If more than one media engine is installed and this one failed before fin
ding metadata, |
| 826 // let the next engine try. | 818 // let the next engine try. |
| 827 if (m_private->networkState() >= FormatError | 819 if (m_private->networkState() >= FormatError |
| 828 && m_private->readyState() < HaveMetadata | 820 && m_private->readyState() < HaveMetadata |
| 829 && installedMediaEngines().size() > 1) { | 821 && installedMediaEngines().size() > 1) { |
| 830 if (m_contentMIMEType.isEmpty() || bestMediaEngineForTypeAndCodecs(m_con
tentMIMEType, m_contentTypeCodecs, m_keySystem, m_url, m_currentMediaEngine)) { | 822 if (m_contentMIMEType.isEmpty() || bestMediaEngineForTypeAndCodecs(m_con
tentMIMEType, m_contentTypeCodecs, m_keySystem, m_url, m_currentMediaEngine)) { |
| 831 m_reloadTimer.startOneShot(0); | 823 m_reloadTimer.startOneShot(0); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 if (!m_private) | 1022 if (!m_private) |
| 1031 return; | 1023 return; |
| 1032 | 1024 |
| 1033 m_private->simulateAudioInterruption(); | 1025 m_private->simulateAudioInterruption(); |
| 1034 } | 1026 } |
| 1035 #endif | 1027 #endif |
| 1036 | 1028 |
| 1037 } | 1029 } |
| 1038 | 1030 |
| 1039 #endif | 1031 #endif |
| OLD | NEW |