Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: Source/WebCore/platform/graphics/MediaPlayer.cpp

Issue 13674022: Remove MEDIA_SOURCE feature define. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@blink-master
Patch Set: Rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 #include "MediaPlayer.h" 29 #include "MediaPlayer.h"
30 30
31 #include "ContentType.h" 31 #include "ContentType.h"
32 #include "Document.h" 32 #include "Document.h"
33 #include "Frame.h" 33 #include "Frame.h"
34 #include "FrameView.h" 34 #include "FrameView.h"
35 #include "IntRect.h" 35 #include "IntRect.h"
36 #include "Logging.h" 36 #include "Logging.h"
37 #include "MIMETypeRegistry.h" 37 #include "MIMETypeRegistry.h"
38 #include "MediaPlayerPrivate.h" 38 #include "MediaPlayerPrivate.h"
39 #include "MediaSource.h"
39 #include "Settings.h" 40 #include "Settings.h"
40 #include "TimeRanges.h" 41 #include "TimeRanges.h"
41 #include <wtf/text/CString.h> 42 #include <wtf/text/CString.h>
42 43
43 #if ENABLE(VIDEO_TRACK) 44 #if ENABLE(VIDEO_TRACK)
44 #include "InbandTextTrackPrivate.h" 45 #include "InbandTextTrackPrivate.h"
45 #endif 46 #endif
46 47
47 #if ENABLE(MEDIA_SOURCE)
48 #include "MediaSource.h"
49 #endif
50
51 #if PLATFORM(QT) 48 #if PLATFORM(QT)
52 #include <QtGlobal> 49 #include <QtGlobal>
53 #endif 50 #endif
54 51
55 #if USE(GSTREAMER) 52 #if USE(GSTREAMER)
56 #include "MediaPlayerPrivateGStreamer.h" 53 #include "MediaPlayerPrivateGStreamer.h"
57 #define PlatformMediaEngineClassName MediaPlayerPrivateGStreamer 54 #define PlatformMediaEngineClassName MediaPlayerPrivateGStreamer
58 #endif 55 #endif
59 56
60 #if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT)) 57 #if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT))
(...skipping 27 matching lines...) Expand all
88 85
89 const PlatformMedia NoPlatformMedia = { PlatformMedia::None, {0} }; 86 const PlatformMedia NoPlatformMedia = { PlatformMedia::None, {0} };
90 87
91 // a null player to make MediaPlayer logic simpler 88 // a null player to make MediaPlayer logic simpler
92 89
93 class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface { 90 class NullMediaPlayerPrivate : public MediaPlayerPrivateInterface {
94 public: 91 public:
95 NullMediaPlayerPrivate(MediaPlayer*) { } 92 NullMediaPlayerPrivate(MediaPlayer*) { }
96 93
97 virtual void load(const String&) { } 94 virtual void load(const String&) { }
98 #if ENABLE(MEDIA_SOURCE)
99 virtual void load(const String&, PassRefPtr<MediaSource>) { } 95 virtual void load(const String&, PassRefPtr<MediaSource>) { }
100 #endif
101 virtual void cancelLoad() { } 96 virtual void cancelLoad() { }
102 97
103 virtual void prepareToPlay() { } 98 virtual void prepareToPlay() { }
104 virtual void play() { } 99 virtual void play() { }
105 virtual void pause() { } 100 virtual void pause() { }
106 101
107 virtual PlatformMedia platformMedia() const { return NoPlatformMedia; } 102 virtual PlatformMedia platformMedia() const { return NoPlatformMedia; }
108 #if USE(ACCELERATED_COMPOSITING) 103 #if USE(ACCELERATED_COMPOSITING)
109 virtual PlatformLayer* platformLayer() const { return 0; } 104 virtual PlatformLayer* platformLayer() const { return 0; }
110 #endif 105 #endif
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 m_mediaPlayerClient = 0; 356 m_mediaPlayerClient = 0;
362 } 357 }
363 358
364 bool MediaPlayer::load(const KURL& url, const ContentType& contentType, const St ring& keySystem) 359 bool MediaPlayer::load(const KURL& url, const ContentType& contentType, const St ring& keySystem)
365 { 360 {
366 m_contentMIMEType = contentType.type().lower(); 361 m_contentMIMEType = contentType.type().lower();
367 m_contentTypeCodecs = contentType.parameter(codecs()); 362 m_contentTypeCodecs = contentType.parameter(codecs());
368 m_url = url; 363 m_url = url;
369 m_keySystem = keySystem.lower(); 364 m_keySystem = keySystem.lower();
370 m_contentMIMETypeWasInferredFromExtension = false; 365 m_contentMIMETypeWasInferredFromExtension = false;
371
372 #if ENABLE(MEDIA_SOURCE)
373 m_mediaSource = 0; 366 m_mediaSource = 0;
374 #endif
375 367
376 // If the MIME type is missing or is not meaningful, try to figure it out fr om the URL. 368 // If the MIME type is missing or is not meaningful, try to figure it out fr om the URL.
377 if (m_contentMIMEType.isEmpty() || m_contentMIMEType == applicationOctetStre am() || m_contentMIMEType == textPlain()) { 369 if (m_contentMIMEType.isEmpty() || m_contentMIMEType == applicationOctetStre am() || m_contentMIMEType == textPlain()) {
378 if (m_url.protocolIsData()) 370 if (m_url.protocolIsData())
379 m_contentMIMEType = mimeTypeFromDataURL(m_url.string()); 371 m_contentMIMEType = mimeTypeFromDataURL(m_url.string());
380 else { 372 else {
381 String lastPathComponent = url.lastPathComponent(); 373 String lastPathComponent = url.lastPathComponent();
382 size_t pos = lastPathComponent.reverseFind('.'); 374 size_t pos = lastPathComponent.reverseFind('.');
383 if (pos != notFound) { 375 if (pos != notFound) {
384 String extension = lastPathComponent.substring(pos + 1); 376 String extension = lastPathComponent.substring(pos + 1);
385 String mediaType = MIMETypeRegistry::getMediaMIMETypeForExtensio n(extension); 377 String mediaType = MIMETypeRegistry::getMediaMIMETypeForExtensio n(extension);
386 if (!mediaType.isEmpty()) { 378 if (!mediaType.isEmpty()) {
387 m_contentMIMEType = mediaType; 379 m_contentMIMEType = mediaType;
388 m_contentMIMETypeWasInferredFromExtension = true; 380 m_contentMIMETypeWasInferredFromExtension = true;
389 } 381 }
390 } 382 }
391 } 383 }
392 } 384 }
393 385
394 loadWithNextMediaEngine(0); 386 loadWithNextMediaEngine(0);
395 return m_currentMediaEngine; 387 return m_currentMediaEngine;
396 } 388 }
397 389
398 #if ENABLE(MEDIA_SOURCE)
399 bool MediaPlayer::load(const KURL& url, PassRefPtr<MediaSource> mediaSource) 390 bool MediaPlayer::load(const KURL& url, PassRefPtr<MediaSource> mediaSource)
400 { 391 {
401 m_mediaSource = mediaSource; 392 m_mediaSource = mediaSource;
402 m_contentMIMEType = ""; 393 m_contentMIMEType = "";
403 m_contentTypeCodecs = ""; 394 m_contentTypeCodecs = "";
404 m_url = url; 395 m_url = url;
405 m_keySystem = ""; 396 m_keySystem = "";
406 m_contentMIMETypeWasInferredFromExtension = false; 397 m_contentMIMETypeWasInferredFromExtension = false;
407 loadWithNextMediaEngine(0); 398 loadWithNextMediaEngine(0);
408 return m_currentMediaEngine; 399 return m_currentMediaEngine;
409 } 400 }
410 #endif
411 401
412 void MediaPlayer::loadWithNextMediaEngine(MediaPlayerFactory* current) 402 void MediaPlayer::loadWithNextMediaEngine(MediaPlayerFactory* current)
413 { 403 {
414 MediaPlayerFactory* engine = 0; 404 MediaPlayerFactory* engine = 0;
415 405
416 if (!m_contentMIMEType.isEmpty()) 406 if (!m_contentMIMEType.isEmpty())
417 engine = bestMediaEngineForTypeAndCodecs(m_contentMIMEType, m_contentTyp eCodecs, m_keySystem, m_url, current); 407 engine = bestMediaEngineForTypeAndCodecs(m_contentMIMEType, m_contentTyp eCodecs, m_keySystem, m_url, current);
418 408
419 // If no MIME type is specified or the type was inferred from the file exten sion, just use the next engine. 409 // If no MIME type is specified or the type was inferred from the file exten sion, just use the next engine.
420 if (!engine && (m_contentMIMEType.isEmpty() || m_contentMIMETypeWasInferredF romExtension)) 410 if (!engine && (m_contentMIMEType.isEmpty() || m_contentMIMETypeWasInferredF romExtension))
(...skipping 13 matching lines...) Expand all
434 m_private->setMediaPlayerProxy(m_playerProxy); 424 m_private->setMediaPlayerProxy(m_playerProxy);
435 #endif 425 #endif
436 m_private->setPrivateBrowsingMode(m_privateBrowsing); 426 m_private->setPrivateBrowsingMode(m_privateBrowsing);
437 m_private->setPreload(m_preload); 427 m_private->setPreload(m_preload);
438 m_private->setPreservesPitch(preservesPitch()); 428 m_private->setPreservesPitch(preservesPitch());
439 if (m_shouldPrepareToRender) 429 if (m_shouldPrepareToRender)
440 m_private->prepareForRendering(); 430 m_private->prepareForRendering();
441 } 431 }
442 432
443 if (m_private) { 433 if (m_private) {
444 #if ENABLE(MEDIA_SOURCE)
445 if (m_mediaSource) 434 if (m_mediaSource)
446 m_private->load(m_url.string(), m_mediaSource); 435 m_private->load(m_url.string(), m_mediaSource);
447 else 436 else
448 #endif 437 m_private->load(m_url.string());
449 m_private->load(m_url.string());
450 } else { 438 } else {
451 m_private = createNullMediaPlayer(this); 439 m_private = createNullMediaPlayer(this);
452 if (m_mediaPlayerClient) { 440 if (m_mediaPlayerClient) {
453 m_mediaPlayerClient->mediaPlayerEngineUpdated(this); 441 m_mediaPlayerClient->mediaPlayerEngineUpdated(this);
454 m_mediaPlayerClient->mediaPlayerResourceNotSupported(this); 442 m_mediaPlayerClient->mediaPlayerResourceNotSupported(this);
455 } 443 }
456 } 444 }
457 } 445 }
458 446
459 bool MediaPlayer::hasAvailableVideoFrame() const 447 bool MediaPlayer::hasAvailableVideoFrame() const
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 if (!m_private) 1138 if (!m_private)
1151 return; 1139 return;
1152 1140
1153 m_private->simulateAudioInterruption(); 1141 m_private->simulateAudioInterruption();
1154 } 1142 }
1155 #endif 1143 #endif
1156 1144
1157 } 1145 }
1158 1146
1159 #endif 1147 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/platform/graphics/MediaPlayer.h ('k') | Source/WebCore/platform/graphics/MediaPlayerPrivate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698