Changeset 158599 in webkit
- Timestamp:
- Nov 4, 2013 2:53:32 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r158520 r158599 1 2013-11-01 Jer Noble <jer.noble@apple.com> 2 3 [PluginProxy] Add a setting to disable video plugin proxy support in HTMLMediaElement. 4 https://bugs.webkit.org/show_bug.cgi?id=123621 5 6 Reviewed by Eric Carlson. 7 8 Enable WTF_USE_AVFOUNDATION and add some HAVE_AVFOUNDATION_* defines 9 to replace the existing __MAC_OS_X_VERSION_MIN_REQUIRED macros in 10 MediaPlayerPrivateAVFoundationObjC.mm. 11 12 * wtf/Platform.h: 13 1 14 2013-11-02 Patrick Gansterer <paroga@webkit.org> 2 15 -
trunk/Source/WTF/wtf/Platform.h
r158445 r158599 966 966 #endif 967 967 968 #if PLATFORM( MAC) && !PLATFORM(IOS)968 #if PLATFORM(IOS) || PLATFORM(MAC) 969 969 #define WTF_USE_AVFOUNDATION 1 970 970 #endif 971 971 972 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000) || ( PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080)972 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000) || ((PLATFORM(MAC) && !PLATFORM(IOS)) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) 973 973 #define WTF_USE_COREMEDIA 1 974 #endif 975 976 #if (PLATFORM(MAC) || (OS(WINDOWS) && USE(CG))) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 974 #define HAVE_AVFOUNDATION_VIDEO_OUTPUT 1 975 #endif 976 977 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000) || ((PLATFORM(MAC) && !PLATFORM(IOS)) || (OS(WINDOWS) && USE(CG)) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) 977 978 #define HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP 1 978 979 #endif 979 980 980 #if (PLATFORM( MAC) || (OS(WINDOWS) && USE(CG))) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090981 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000) || (((PLATFORM(MAC) && !PLATFORM(IOS)) || (OS(WINDOWS) && USE(CG))) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) 981 982 #define HAVE_AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT 1 982 #endif983 984 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000) || ((PLATFORM(MAC) || (OS(WINDOWS) && USE(CG))) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)985 983 #define HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK 1 984 #endif 985 986 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000) || ((PLATFORM(MAC) && !PLATFORM(IOS)) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) 987 #define HAVE_AVFOUNDATION_LOADER_DELEGATE 1 988 #endif 989 990 #if (PLATFORM(MAC) && !PLATFORM(IOS)) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 991 #define WTF_USE_VIDEOTOOLBOX 1 986 992 #endif 987 993 -
trunk/Source/WebCore/ChangeLog
r158598 r158599 1 2013-11-01 Jer Noble <jer.noble@apple.com> 2 3 [PluginProxy] Add a setting to disable video plugin proxy support in HTMLMediaElement. 4 https://bugs.webkit.org/show_bug.cgi?id=123621 5 6 Reviewed by Eric Carlson. 7 8 Add a new Setting which will disable the video plugin proxy. Enable support for AVFoundation 9 in iOS (which requries fixing a few compile errors resulting from classes and methods which 10 are not available on iOS. 11 12 * WebCore.exp.in: Export wkAVAssetResolvedURL. 13 * css/StyleResolver.cpp: 14 (WebCore::StyleResolver::canShareStyleWithElement): Make conditional upon 15 new isVideoPluginProxyEnabled() setting. 16 * html/HTMLMediaElement.cpp: 17 (WebCore::HTMLMediaElement::parseAttribute): Ditto. 18 * html/HTMLMediaElement.h: 19 * html/HTMLVideoElement.cpp: 20 (WebCore::HTMLVideoElement::createRenderer): Ditto. 21 (WebCore::HTMLVideoElement::attach): Ditto. 22 (WebCore::HTMLVideoElement::parseAttribute): Ditto. 23 (HTMLVideoElement::setDisplayMode): Ditto. 24 * html/HTMLVideoElement.h: 25 * page/Settings.cpp: 26 (WebCore::Settings::setVideoPluginProxyEnabled): Simple setter. 27 * page/Settings.h: 28 (WebCore::Settings::isVideoPluginProxyEnabled): Simple getter. 29 * platform/graphics/MediaPlayer.cpp: 30 (WebCore::installedMediaEngines): Conditionally add MediaPlayerPrivateIOS and always add 31 MediaPlayerPriateAVFoundationObjC. 32 * platform/graphics/MediaPlayerPrivate.h: 33 (WebCore::MediaPlayerPrivateInterface::deliverNotification): Add default implementation. 34 (WebCore::MediaPlayerPrivateInterface::setMediaPlayerProxy): Ditto. 35 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: 36 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 37 (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Use new 38 HAS_ and USE_ macros instead of __MAC_OS_MIN_VERNSION_REQUIRED. 39 (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC): Ditto. 40 (WebCore::MediaPlayerPrivateAVFoundationObjC::hasContextRenderer): Ditto. 41 (WebCore::MediaPlayerPrivateAVFoundationObjC::createContextVideoRenderer): Ditto. 42 (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer): Ditto. 43 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Ditto. 44 (WebCore::MediaPlayerPrivateAVFoundationObjC::paint): Ditto. 45 (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): Use cachedCGColor instead 46 of CGColorGetConstantColor. 47 (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput): Use CVPixelBuffer pixel 48 format constant instead of QuickDraw constant. 49 (WebCore::MediaPlayerPrivateAVFoundationObjC::createPixelBuffer): Ditto. 50 (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput): Draw to intermediary 51 CGImage on iOS. 52 * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h: 53 * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm: 54 * platform/ios/WebCoreSystemInterfaceIOS.mm: 55 * platform/mac/WebCoreSystemInterface.h: 56 1 57 2013-11-04 Andreas Kling <akling@apple.com> 2 58 -
trunk/Source/WebCore/WebCore.exp.in
r158587 r158599 2791 2791 __ZN7WebCore16HTMLMediaElement19deliverNotificationE32MediaPlayerProxyNotificationType 2792 2792 __ZN7WebCore16HTMLMediaElement19setMediaPlayerProxyEP19WebMediaPlayerProxy 2793 __ZN7WebCore8Settings24gVideoPluginProxyEnabledE 2794 __ZN7WebCore8Settings26setVideoPluginProxyEnabledEb 2793 2795 __ZN7WebCore9HTMLNames8audioTagE 2794 2796 #endif -
trunk/Source/WebCore/css/StyleResolver.cpp
r158389 r158599 188 188 #endif 189 189 190 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 191 #include "HTMLMediaElement.h" 192 #endif 193 190 194 namespace WebCore { 191 195 … … 672 676 // Turn off style sharing for elements that can gain layers for reasons outside of the style system. 673 677 // See comments in RenderObject::setStyle(). 674 if (element->hasTagName(iframeTag) || element->hasTagName(frameTag) || element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag) || element->hasTagName(canvasTag) 678 if (element->hasTagName(iframeTag) || element->hasTagName(frameTag) || element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag) || element->hasTagName(canvasTag)) 679 return false; 680 675 681 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 676 677 || element->hasTagName(videoTag) || isHTMLAudioElement(element)678 #endif 679 ) 680 return false; 682 // With proxying, the media elements are backed by a RenderEmbeddedObject. 683 if ((element->hasTagName(videoTag) || element->hasTagName(audioTag)) && toMediaElement(element)->shouldUseVideoPluginProxy()) 684 return false; 685 #endif 686 681 687 #endif 682 688 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r158527 r158599 548 548 549 549 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 550 document().updateStyleIfNeeded(); 551 createMediaPlayerProxy(); 550 if (shouldUseVideoPluginProxy()) { 551 document().updateStyleIfNeeded(); 552 createMediaPlayerProxy(); 553 } 552 554 #endif 553 555 … … 564 566 { 565 567 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 566 UNUSED_PARAM(style);567 return true;568 #e lse568 if (shouldUseVideoPluginProxy()) 569 return true; 570 #endif 569 571 return controls() && HTMLElement::rendererIsNeeded(style); 570 #endif571 572 } 572 573 … … 574 575 { 575 576 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 576 // Setup the renderer if we already have a proxy widget. 577 RenderEmbeddedObject* mediaRenderer = new RenderEmbeddedObject(*this, std::move(style)); 578 if (m_proxyWidget) { 579 mediaRenderer->setWidget(m_proxyWidget); 580 581 if (Frame* frame = document().frame()) 582 frame->loader().client().showMediaPlayerProxyPlugin(m_proxyWidget.get()); 583 } 584 return mediaRenderer; 585 #else 577 if (shouldUseVideoPluginProxy()) { 578 // Setup the renderer if we already have a proxy widget. 579 RenderEmbeddedObject* mediaRenderer = new RenderEmbeddedObject(*this, std::move(style)); 580 if (m_proxyWidget) { 581 mediaRenderer->setWidget(m_proxyWidget); 582 583 if (Frame* frame = document().frame()) 584 frame->loader().client().showMediaPlayerProxyPlugin(m_proxyWidget.get()); 585 } 586 return mediaRenderer; 587 } 588 #endif 586 589 return new RenderMedia(*this, std::move(style)); 587 #endif588 590 } 589 591 … … 654 656 655 657 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 656 m_needWidgetUpdate = true; 658 if (shouldUseVideoPluginProxy()) 659 m_needWidgetUpdate = true; 657 660 #endif 658 661 } … … 682 685 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaResource)) { 683 686 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 684 createMediaPlayerProxy(); 685 #endif 686 687 if (shouldUseVideoPluginProxy()) 688 createMediaPlayerProxy(); 689 #endif 690 687 691 prepareForLoad(); 688 692 setFlags(m_pendingActionFlags, LoadMediaResource); … … 843 847 #endif 844 848 845 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) 849 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 850 if (shouldUseVideoPluginProxy()) 851 if (m_player) 852 m_player->cancelLoad(); 853 else 854 createMediaPlayerProxy(); 855 } else 856 #endif 846 857 createMediaPlayer(); 847 #else848 if (m_player)849 m_player->cancelLoad();850 else851 createMediaPlayerProxy();852 #endif853 858 854 859 // 4 - If the media element's networkState is not set to NETWORK_EMPTY, then run these substeps … … 1021 1026 } 1022 1027 1023 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) 1024 // Recreate the media player for the new url 1025 createMediaPlayer(); 1026 #endif 1028 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 1029 if (!shouldUseVideoPluginProxy()) 1030 #endif 1031 // Recreate the media player for the new url 1032 createMediaPlayer(); 1027 1033 1028 1034 m_loadState = LoadingFromSourceElement; … … 4164 4170 #endif 4165 4171 4166 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)4167 4168 4172 #if ENABLE(MEDIA_SOURCE) 4169 4173 closeMediaSource(); … … 4171 4175 4172 4176 m_player.clear(); 4173 #endif4174 4177 stopPeriodicTimers(); 4175 4178 m_loadTimer.stop(); … … 4288 4291 { 4289 4292 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 4290 auto renderer = this->renderer(); 4291 if (!renderer || !renderer->isWidget()) 4292 return; 4293 4294 if (Widget* widget = toRenderWidget(renderer)->widget()) 4295 widget->handleEvent(event); 4296 #else 4293 if (shouldUseVideoPluginProxy()) { 4294 auto renderer = this->renderer(); 4295 if (!renderer || !renderer->isWidget()) 4296 return; 4297 4298 if (Widget* widget = toRenderWidget(renderer)->widget()) 4299 widget->handleEvent(event); 4300 return; 4301 } 4302 #endif 4297 4303 HTMLElement::defaultEventHandler(event); 4298 #endif4299 4304 } 4300 4305 … … 4302 4307 { 4303 4308 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 4304 return true; 4305 #else 4309 if (shouldUseVideoPluginProxy()) 4310 return true; 4311 #endif 4306 4312 return HTMLElement::willRespondToMouseClickEvents(); 4307 #endif4308 4313 } 4309 4314 … … 4725 4730 void HTMLMediaElement::configureMediaControls() 4726 4731 { 4732 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 4733 if (shouldUseVideoPluginProxy()) { 4734 if (m_player) 4735 m_player->setControls(controls()); 4736 4737 if (!hasMediaControls() && inDocument()) 4738 createMediaControls(); 4739 return; 4740 } 4741 #endif 4742 4727 4743 #if ENABLE(MEDIA_CONTROLS_SCRIPT) 4728 4744 if (!controls() || !inDocument()) … … 4731 4747 ensureUserAgentShadowRoot(); 4732 4748 return; 4733 #elif !ENABLE(PLUGIN_PROXY_FOR_VIDEO) 4749 #endif 4750 4734 4751 if (!controls() || !inDocument()) { 4735 4752 if (hasMediaControls()) … … 4742 4759 4743 4760 mediaControls()->show(); 4744 #else4745 if (m_player)4746 m_player->setControls(controls());4747 4748 if (!hasMediaControls() && inDocument())4749 createMediaControls();4750 #endif4751 4761 } 4752 4762 … … 5186 5196 } 5187 5197 5198 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 5199 bool HTMLMediaElement::shouldUseVideoPluginProxy() const 5200 { 5201 return document()->settings() && document()->settings()->isVideoPluginProxyEnabled(); 5202 } 5203 #endif 5204 5188 5205 #if ENABLE(MEDIA_CONTROLS_SCRIPT) 5189 5206 DOMWrapperWorld& HTMLMediaElement::ensureIsolatedWorld() -
trunk/Source/WebCore/html/HTMLMediaElement.h
r158527 r158599 384 384 void enteredOrExitedFullscreen() { configureMediaControls(); } 385 385 386 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 387 bool shouldUseVideoPluginProxy() const; 388 #endif 389 386 390 protected: 387 391 HTMLMediaElement(const QualifiedName&, Document&, bool); … … 428 432 #endif 429 433 434 virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE; 435 430 436 private: 431 437 void createMediaPlayer(); … … 438 444 virtual bool isMouseFocusable() const OVERRIDE; 439 445 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; 440 virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE;441 446 virtual bool childShouldCreateRenderer(const Node*) const OVERRIDE; 442 447 virtual InsertionNotificationRequest insertedInto(ContainerNode&) OVERRIDE; -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r158097 r158599 69 69 } 70 70 71 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)72 71 RenderElement* HTMLVideoElement::createRenderer(PassRef<RenderStyle> style) 73 72 { 73 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 74 if (shouldUseVideoPluginProxy()) 75 return HTMLMediaElement::createRenderer(arena, style); 76 #endif 74 77 return new RenderVideo(*this, std::move(style)); 75 78 } 76 #endif77 79 78 80 void HTMLVideoElement::didAttachRenderers() … … 80 82 HTMLMediaElement::didAttachRenderers(); 81 83 82 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) 83 updateDisplayState(); 84 if (shouldDisplayPosterImage()) { 85 if (!m_imageLoader) 86 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); 87 m_imageLoader->updateFromElement(); 88 if (renderer()) 89 toRenderImage(renderer())->imageResource()->setCachedImage(m_imageLoader->image()); 84 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 85 if (!shouldUseVideoPluginProxy()) { 86 #endif 87 updateDisplayState(); 88 if (shouldDisplayPosterImage()) { 89 if (!m_imageLoader) 90 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); 91 m_imageLoader->updateFromElement(); 92 if (renderer()) 93 toRenderImage(renderer())->imageResource()->setCachedImage(m_imageLoader->image()); 94 } 95 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 90 96 } 91 97 #endif … … 115 121 HTMLMediaElement::setDisplayMode(Unknown); 116 122 updateDisplayState(); 117 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) 123 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 124 if (shouldUseVideoPluginProxy()) 125 return; 126 #endif 118 127 if (shouldDisplayPosterImage()) { 119 128 if (!m_imageLoader) … … 124 133 toRenderImage(renderer())->imageResource()->setCachedImage(0); 125 134 } 126 #endif127 135 } else 128 136 HTMLMediaElement::parseAttribute(name, value); … … 221 229 } 222 230 223 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO) 231 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 232 if (shouldUseVideoPluginProxy()) 233 return; 234 #endif 224 235 if (renderer() && displayMode() != oldMode) 225 236 renderer()->updateFromElement(); 226 #endif227 237 } 228 238 -
trunk/Source/WebCore/html/HTMLVideoElement.h
r158097 r158599 76 76 77 77 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; 78 #if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)79 78 virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE; 80 #endif81 79 virtual void didAttachRenderers() OVERRIDE; 82 80 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; -
trunk/Source/WebCore/page/Settings.cpp
r158326 r158599 82 82 #endif 83 83 84 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 85 bool Settings::gVideoPluginProxyEnabled = true; 86 #endif 87 84 88 bool Settings::gMockScrollbarsEnabled = false; 85 89 bool Settings::gUsesOverlayScrollbars = false; … … 580 584 #endif 581 585 586 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 587 void Settings::setVideoPluginProxyEnabled(bool enabled) 588 { 589 if (gVideoPluginProxyEnabled == enabled) 590 return; 591 592 gVideoPluginProxyEnabled = enabled; 593 HTMLMediaElement::resetMediaEngines(); 594 } 595 #endif 596 582 597 void Settings::setScrollingPerformanceLoggingEnabled(bool enabled) 583 598 { -
trunk/Source/WebCore/page/Settings.h
r157455 r158599 268 268 static void setLowPowerVideoAudioBufferSizeEnabled(bool); 269 269 270 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 271 static void setVideoPluginProxyEnabled(bool flag); 272 static bool isVideoPluginProxyEnabled() { return gVideoPluginProxyEnabled; } 273 #endif 274 270 275 private: 271 276 explicit Settings(Page*); … … 354 359 355 360 static bool gLowPowerVideoAudioBufferSizeEnabled; 361 362 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 363 static bool gVideoPluginProxyEnabled; 364 #endif 356 365 }; 357 366 -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r158291 r158599 205 205 enginesQueried = true; 206 206 207 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 208 if (Settings::isVideoPluginProxyEnabled()) 209 MediaPlayerPrivateIOS::registerMediaEngine(addMediaEngine); 210 #endif 211 207 212 #if USE(AVFOUNDATION) 208 213 if (Settings::isAVFoundationEnabled()) { 209 #if PLATFORM(MAC) 214 #if PLATFORM(MAC) || PLATFORM(IOS) 210 215 MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(addMediaEngine); 211 216 #elif PLATFORM(WIN) -
trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r156049 r158599 130 130 131 131 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 132 virtual void deliverNotification(MediaPlayerProxyNotificationType) = 0;133 virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) = 0;132 virtual void deliverNotification(MediaPlayerProxyNotificationType) { } 133 virtual void setMediaPlayerProxy(WebMediaPlayerProxy*) { } 134 134 virtual void setControls(bool) { } 135 135 #endif -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
r157834 r158599 47 47 typedef struct objc_object* id; 48 48 49 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 109049 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 50 50 OBJC_CLASS WebCoreAVFLoaderDelegate; 51 51 OBJC_CLASS AVAssetResourceLoadingRequest; … … 78 78 #endif 79 79 80 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 109080 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 81 81 bool shouldWaitForLoadingOfResource(AVAssetResourceLoadingRequest*); 82 82 void didCancelLoadingRequest(AVAssetResourceLoadingRequest*); … … 157 157 void paintWithImageGenerator(GraphicsContext*, const IntRect&); 158 158 159 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080159 #if HAVE(AVFOUNDATION_VIDEO_OUTPUT) 160 160 void createVideoOutput(); 161 161 void destroyVideoOutput(); … … 201 201 202 202 RetainPtr<AVAssetImageGenerator> m_imageGenerator; 203 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080203 #if HAVE(AVFOUNDATION_VIDEO_OUTPUT) 204 204 RetainPtr<AVPlayerItemVideoOutput> m_videoOutput; 205 205 RetainPtr<CVPixelBufferRef> m_lastImage; 206 206 #endif 207 207 208 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090208 #if USE(VIDEOTOOLBOX) 209 209 RetainPtr<VTPixelTransferSessionRef> m_pixelTransferSession; 210 210 #endif 211 212 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 211 213 friend class WebCoreAVFResourceLoader; 212 214 HashMap<RetainPtr<AVAssetResourceLoadingRequest>, RefPtr<WebCoreAVFResourceLoader>> m_resourceLoaderMap; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r158597 r158599 62 62 #import <AVFoundation/AVFoundation.h> 63 63 #import <CoreMedia/CoreMedia.h> 64 65 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 64 #import <QuartzCore/CoreImage.h> 65 66 #if USE(VIDEOTOOLBOX) 66 67 #import <CoreVideo/CoreVideo.h> 67 68 #import <VideoToolbox/VideoToolbox.h> … … 70 71 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) 71 72 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreMedia) 72 73 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 73 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreImage) 74 74 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreVideo) 75 76 #if USE(VIDEOTOOLBOX) 75 77 SOFT_LINK_FRAMEWORK_OPTIONAL(VideoToolbox) 76 78 #endif … … 81 83 SOFT_LINK(CoreMedia, CMTimeRangeGetEnd, CMTime, (CMTimeRange range), (range)) 82 84 83 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 109084 85 SOFT_LINK(CoreVideo, CVPixelBufferGetWidth, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer)) 85 86 SOFT_LINK(CoreVideo, CVPixelBufferGetHeight, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer)) 87 #if USE(VIDEOTOOLBOX) 86 88 SOFT_LINK(VideoToolbox, VTPixelTransferSessionCreate, OSStatus, (CFAllocatorRef allocator, VTPixelTransferSessionRef *pixelTransferSessionOut), (allocator, pixelTransferSessionOut)) 87 89 SOFT_LINK(VideoToolbox, VTPixelTransferSessionTransferImage, OSStatus, (VTPixelTransferSessionRef session, CVPixelBufferRef sourceBuffer, CVPixelBufferRef destinationBuffer), (session, sourceBuffer, destinationBuffer)) … … 94 96 SOFT_LINK_CLASS(AVFoundation, AVURLAsset) 95 97 SOFT_LINK_CLASS(AVFoundation, AVAssetImageGenerator) 98 SOFT_LINK_CLASS(CoreImage, CIContext) 99 SOFT_LINK_CLASS(CoreImage, CIImage) 96 100 97 101 SOFT_LINK_POINTER(AVFoundation, AVMediaCharacteristicVisual, NSString *) … … 105 109 SOFT_LINK_POINTER(AVFoundation, AVLayerVideoGravityResizeAspect, NSString *) 106 110 SOFT_LINK_POINTER(AVFoundation, AVLayerVideoGravityResize, NSString *) 111 SOFT_LINK_POINTER(CoreVideo, kCVPixelBufferPixelFormatTypeKey, NSString *) 107 112 108 113 SOFT_LINK_CONSTANT(CoreMedia, kCMTimeZero, CMTime) … … 125 130 #define AVLayerVideoGravityResizeAspect getAVLayerVideoGravityResizeAspect() 126 131 #define AVLayerVideoGravityResize getAVLayerVideoGravityResize() 132 #define kCVPixelBufferPixelFormatTypeKey getkCVPixelBufferPixelFormatTypeKey() 127 133 128 134 #if HAVE(AVFOUNDATION_MEDIA_SELECTION_GROUP) … … 180 186 @end 181 187 182 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090188 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 183 189 @interface WebCoreAVFLoaderDelegate : NSObject<AVAssetResourceLoaderDelegate> { 184 190 MediaPlayerPrivateAVFoundationObjC* m_callback; … … 211 217 #endif 212 218 213 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2)219 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 214 220 static dispatch_queue_t globalLoaderDelegateQueue() 215 221 { … … 239 245 , m_videoFrameHasDrawn(false) 240 246 , m_haveCheckedPlayability(false) 241 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090247 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 242 248 , m_loaderDelegate(adoptNS([[WebCoreAVFLoaderDelegate alloc] initWithCallback:this])) 243 249 #endif … … 254 260 playerToPrivateMap().remove(player()); 255 261 #endif 256 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090262 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 257 263 [m_loaderDelegate.get() setCallback:0]; 258 264 [[m_avAsset.get() resourceLoader] setDelegate:nil queue:0]; … … 309 315 bool MediaPlayerPrivateAVFoundationObjC::hasContextRenderer() const 310 316 { 311 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080317 #if HAVE(AVFOUNDATION_VIDEO_OUTPUT) 312 318 if (m_videoOutput) 313 319 return true; … … 318 324 void MediaPlayerPrivateAVFoundationObjC::createContextVideoRenderer() 319 325 { 320 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080326 #if HAVE(AVFOUNDATION_VIDEO_OUTPUT) 321 327 createVideoOutput(); 322 328 #else … … 344 350 void MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer() 345 351 { 346 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080352 #if HAVE(AVFOUNDATION_VIDEO_OUTPUT) 347 353 destroyVideoOutput(); 348 354 #endif … … 368 374 m_videoLayer = adoptNS([[AVPlayerLayer alloc] init]); 369 375 [m_videoLayer.get() setPlayer:m_avPlayer.get()]; 370 [m_videoLayer.get() setBackgroundColor: CGColorGetConstantColor(kCGColorBlack)];376 [m_videoLayer.get() setBackgroundColor:cachedCGColor(Color::black, ColorSpaceDeviceRGB)]; 371 377 #ifndef NDEBUG 372 378 [m_videoLayer.get() setName:@"Video layer"]; … … 428 434 m_avAsset = adoptNS([[AVURLAsset alloc] initWithURL:cocoaURL options:options.get()]); 429 435 430 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090436 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 431 437 [[m_avAsset.get() resourceLoader] setDelegate:m_loaderDelegate.get() queue:globalLoaderDelegateQueue()]; 432 438 #endif … … 794 800 BEGIN_BLOCK_OBJC_EXCEPTIONS; 795 801 796 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080802 #if HAVE(AVFOUNDATION_VIDEO_OUTPUT) 797 803 if (videoOutputHasAvailableFrame()) 798 804 paintWithVideoOutput(context, rect); … … 922 928 } 923 929 924 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090930 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 925 931 bool MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource(AVAssetResourceLoadingRequest* avRequest) 926 932 { … … 1178 1184 } 1179 1185 1180 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10801186 #if HAVE(AVFOUNDATION_VIDEO_OUTPUT) 1181 1187 void MediaPlayerPrivateAVFoundationObjC::createVideoOutput() 1182 1188 { … … 1186 1192 return; 1187 1193 1188 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10901194 #if USE(VIDEOTOOLBOX) 1189 1195 NSDictionary* attributes = @{ (NSString*)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_422YpCbCr8) }; 1190 1196 #else 1191 NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:k 32BGRAPixelFormat], kCVPixelBufferPixelFormatTypeKey,1197 NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], kCVPixelBufferPixelFormatTypeKey, 1192 1198 nil]; 1193 1199 #endif … … 1231 1237 return 0; 1232 1238 1233 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10901239 #if USE(VIDEOTOOLBOX) 1234 1240 // Create a VTPixelTransferSession, if necessary, as we cannot guarantee timely delivery of ARGB pixels. 1235 1241 if (!m_pixelTransferSession) { … … 1240 1246 1241 1247 CVPixelBufferRef outputBuffer; 1242 CVPixelBufferCreate(kCFAllocatorDefault, CVPixelBufferGetWidth(buffer.get()), CVPixelBufferGetHeight(buffer.get()), k 32BGRAPixelFormat, 0, &outputBuffer);1248 CVPixelBufferCreate(kCFAllocatorDefault, CVPixelBufferGetWidth(buffer.get()), CVPixelBufferGetHeight(buffer.get()), kCVPixelFormatType_32BGRA, 0, &outputBuffer); 1243 1249 VTPixelTransferSessionTransferImage(m_pixelTransferSession.get(), buffer.get(), outputBuffer); 1244 1250 buffer = adoptCF(outputBuffer); … … 1281 1287 context->translate(rect.x(), rect.y() + rect.height()); 1282 1288 context->scale(FloatSize(1.0f, -1.0f)); 1283 RetainPtr<CIImage> image = adoptNS([[CIImage alloc] initWithCVImageBuffer:m_lastImage.get() options:@{ kCIImageColorSpace: (id)deviceRGBColorSpaceRef() }]); 1289 1290 CGRect outputRect = { CGPointZero, rect.size() }; 1291 CGRect imageRect = CGRectMake(0, 0, CVPixelBufferGetWidth(m_lastImage.get()), CVPixelBufferGetHeight(m_lastImage.get())); 1292 #if PLATFORM(IOS) 1293 // ciContext does not use a RetainPtr for results of contextWithCGContext:, as the returned value 1294 // is autoreleased, and there is no non-autoreleased version of that function. 1295 CIContext* ciContext = [getCIContextClass() contextWithOptions:nil]; 1296 RetainPtr<CIImage> image = adoptNS([[getCIImageClass() alloc] initWithCVPixelBuffer:m_lastImage.get()]); 1297 RetainPtr<CGImage> cgImage = adoptCF([ciContext createCGImage:image.get() fromRect:imageRect]); 1298 context->drawNativeImage(cgImage.get(), FloatSize(imageRect.size), ColorSpaceDeviceRGB, FloatRect(outputRect), FloatRect(imageRect), 1); 1299 #else 1284 1300 1285 1301 // ciContext does not use a RetainPtr for results of contextWithCGContext:, as the returned value 1286 1302 // is autoreleased, and there is no non-autoreleased version of that function. 1287 1303 CIContext* ciContext = [CIContext contextWithCGContext:context->platformContext() options:nil]; 1288 CGRect outputRect = { CGPointZero, rect.size() }; 1289 CGRect imageRect = CGRectMake(0, 0, CVPixelBufferGetWidth(m_lastImage.get()), CVPixelBufferGetHeight(m_lastImage.get())); 1304 RetainPtr<CIImage> image = adoptNS([[CIImage alloc] initWithCVImageBuffer:m_lastImage.get() options:@{ kCIImageColorSpace: (id)deviceRGBColorSpaceRef() }]); 1290 1305 [ciContext drawImage:image.get() inRect:outputRect fromRect:imageRect]; 1306 #endif 1291 1307 1292 1308 // If we have created an AVAssetImageGenerator in the past due to m_videoOutput not having an available … … 1777 1793 @end 1778 1794 1779 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10901795 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) 1780 1796 @implementation WebCoreAVFLoaderDelegate 1781 1797 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h
r153706 r158599 27 27 #define WebCoreAVFResourceLoader_h 28 28 29 #if ENABLE(VIDEO) && USE(AVFOUNDATION) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 109029 #if ENABLE(VIDEO) && USE(AVFOUNDATION) && HAVE(AVFOUNDATION_LOADER_DELEGATE) 30 30 31 31 #include "CachedRawResourceClient.h" -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm
r156550 r158599 27 27 #import "WebCoreAVFResourceLoader.h" 28 28 29 #if ENABLE(VIDEO) && USE(AVFOUNDATION) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 109029 #if ENABLE(VIDEO) && USE(AVFOUNDATION) && HAVE(AVFOUNDATION_LOADER_DELEGATE) 30 30 31 31 #import "CachedRawResource.h" -
trunk/Source/WebKit/mac/ChangeLog
r158454 r158599 1 2013-11-01 Jer Noble <jer.noble@apple.com> 2 3 [PluginProxy] Add a setting to disable video plugin proxy support in HTMLMediaElement. 4 https://bugs.webkit.org/show_bug.cgi?id=123621 5 6 Reviewed by Eric Carlson. 7 8 Add a new isVideoPluginProxyEnabled setting. 9 10 * WebView/WebPreferenceKeysPrivate.h: 11 * WebView/WebPreferences.mm: 12 (+[WebPreferences initialize]): Set isVideoPluginProxyEnabled preference. 13 (-[WebPreferences isVideoPluginProxyEnabled]): Pass through to Settings. 14 * WebView/WebPreferencesPrivate.h: 15 * WebView/WebView.mm: 16 (-[WebView _preferencesChanged:]): Set isVideoPluginProxyEnabled preference. 17 1 18 2013-11-01 Andy Estes <aestes@apple.com> 2 19 -
trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
r157843 r158599 114 114 #define WebKitHyperlinkAuditingEnabledPreferenceKey @"WebKitHyperlinkAuditingEnabled" 115 115 #define WebKitAVFoundationEnabledKey @"WebKitAVFoundationEnabled" 116 #define WebKitVideoPluginProxyEnabledKey @"WebKitVideoPluginProxyEnabled" 116 117 #define WebKitHixie76WebSocketProtocolEnabledKey @"WebKitHixie76WebSocketProtocolEnabled" 117 118 #define WebKitMediaPlaybackRequiresUserGesturePreferenceKey @"WebKitMediaPlaybackRequiresUserGesture" -
trunk/Source/WebKit/mac/WebView/WebPreferences.mm
r157843 r158599 426 426 [NSNumber numberWithBool:NO], WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey, 427 427 [NSNumber numberWithBool:NO], WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey, 428 #if !PLATFORM(IOS) 429 [NSNumber numberWithBool:NO], WebKitVideoPluginProxyEnabledKey, 430 #endif 428 431 nil]; 429 432 … … 1668 1671 } 1669 1672 1673 - (void)setVideoPluginProxyEnabled:(BOOL)flag 1674 { 1675 [self _setBoolValue:flag forKey:WebKitVideoPluginProxyEnabledKey]; 1676 } 1677 1678 - (BOOL)isVideoPluginProxyEnabled 1679 { 1680 return [self _boolValueForKey:WebKitVideoPluginProxyEnabledKey]; 1681 } 1682 1670 1683 - (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag 1671 1684 { -
trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h
r157843 r158599 290 290 - (BOOL)isQTKitEnabled; 291 291 292 // VideoPluginProxy support is dependent on WebCore/WebKit being 293 // compiled with ENABLE_PLUGIN_PROXY_FOR_VIDEO. 294 - (void)setVideoPluginProxyEnabled:(BOOL)flag; 295 - (BOOL)isVideoPluginProxyEnabled; 296 292 297 // WebSocket support depends on ENABLE(WEB_SOCKETS). 293 298 - (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag; -
trunk/Source/WebKit/mac/WebView/WebView.mm
r158330 r158599 1720 1720 settings.setLowPowerVideoAudioBufferSizeEnabled([preferences lowPowerVideoAudioBufferSizeEnabled]); 1721 1721 1722 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 1723 settings->setVideoPluginProxyEnabled([preferences isVideoPluginProxyEnabled]); 1724 #endif 1725 1722 1726 switch ([preferences storageBlockingPolicy]) { 1723 1727 case WebAllowAllStorage: -
trunk/Source/WebKit2/ChangeLog
r158595 r158599 1 2013-11-01 Jer Noble <jer.noble@apple.com> 2 3 [PluginProxy] Add a setting to disable video plugin proxy support in HTMLMediaElement. 4 https://bugs.webkit.org/show_bug.cgi?id=123621 5 6 Reviewed by Eric Carlson. 7 8 Add WebKit2 functions for setting then new isVideoPluginProxyEnabled preference. 9 10 * Shared/WebPreferencesStore.h: 11 * UIProcess/API/C/WKPreferences.cpp: 12 (WKPreferencesSetVideoPluginProxyEnabled): 13 (WKPreferencesGetVideoPluginProxyEnabled): 14 * UIProcess/API/C/WKPreferences.h: 15 * WebProcess/WebPage/WebPage.cpp: 16 (WebKit::WebPage::updatePreferences): 17 1 18 2013-11-04 Anders Carlsson <andersca@apple.com> 2 19 -
trunk/Source/WebKit2/Shared/WebPreferencesStore.h
r158360 r158599 63 63 #define DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED false 64 64 #define DEFAULT_PDFPLUGIN_ENABLED false 65 #endif 66 67 #if PLATFORM(IOS) 68 #define DEFAULT_VIDEO_PLUGIN_PROXY_ENABLED true 69 #else 70 #define DEFAULT_VIDEO_PLUGIN_PROXY_ENABLED false 65 71 #endif 66 72 … … 169 175 macro(SimpleLineLayoutDebugBordersEnabled, simpleLineLayoutDebugBordersEnabled, Bool, bool, false) \ 170 176 macro(MediaStreamEnabled, mediaStreamEnabled, Bool, bool, false) \ 177 macro(VideoPluginProxyEnabled, isVideoPluginProxyEnabled, Bool, bool, DEFAULT_VIDEO_PLUGIN_PROXY_ENABLED) \ 171 178 \ 172 179 -
trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
r158360 r158599 1206 1206 return toImpl(preferencesRef)->mediaStreamEnabled(); 1207 1207 } 1208 1209 void WKPreferencesSetVideoPluginProxyEnabled(WKPreferencesRef preferencesRef, bool enabled) 1210 { 1211 toImpl(preferencesRef)->setVideoPluginProxyEnabled(enabled); 1212 } 1213 1214 bool WKPreferencesGetVideoPluginProxyEnabled(WKPreferencesRef preferencesRef) 1215 { 1216 return toImpl(preferencesRef)->isVideoPluginProxyEnabled(); 1217 } -
trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.h
r158360 r158599 245 245 WK_EXPORT bool WKPreferencesGetMediaStreamEnabled(WKPreferencesRef preferencesRef); 246 246 247 // Defaults to true. 248 WK_EXPORT void WKPreferencesSetVideoPluginProxyEnabled(WKPreferencesRef preferencesRef, bool enabled); 249 WK_EXPORT bool WKPreferencesGetVideoPluginProxyEnabled(WKPreferencesRef preferencesRef); 250 247 251 #ifdef __cplusplus 248 252 } -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r158451 r158599 2424 2424 #endif 2425 2425 2426 #if USE(PLUGIN_PROXY_FOR_VIDEO) 2427 settings->setVideoPluginProxyEnabled(store.getBoolValueForKey(WebPreferencesKey::isVideoPluginProxyEnabledKey())); 2428 #endif 2429 2426 2430 #if ENABLE(WEB_AUDIO) 2427 2431 settings.setWebAudioEnabled(store.getBoolValueForKey(WebPreferencesKey::webAudioEnabledKey()));
Note: See TracChangeset
for help on using the changeset viewer.