Changeset 229824 in webkit
- Timestamp:
- Mar 21, 2018 2:13:58 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
- 1 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r229818 r229824 1 2018-03-21 Eric Carlson <eric.carlson@apple.com> 2 3 Clean up platform VideoFullscreenLayerManager 4 https://bugs.webkit.org/show_bug.cgi?id=183859 5 <rdar://problem/38715419> 6 7 Reviewed by Jer Noble. 8 9 No new tests, no functional change. 10 11 * WebCore.xcodeproj/project.pbxproj: 12 * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h. 13 (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager): 14 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: 15 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 16 (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): 17 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): 18 (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): 19 (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const): 20 (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): 21 (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame): 22 (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity): 23 (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const): 24 (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds): 25 (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation): 26 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: 27 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 28 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): 29 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const): 30 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): 31 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): 32 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer): 33 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame): 34 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const): 35 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds): 36 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation): 37 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: 38 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: 39 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): 40 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): 41 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers): 42 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const): 43 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer): 44 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame): 45 * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h. 46 * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm. 47 (-[WebVideoContainerLayer setBounds:]): 48 (-[WebVideoContainerLayer setPosition:]): 49 (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC): 50 (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer): 51 (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): 52 (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame): 53 (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer): 54 (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const): 55 (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds): 56 (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation): 57 1 58 2018-03-21 Antoine Quint <graouts@apple.com> 2 59 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r229768 r229824 127 127 0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0753860014489E9800B78452 /* CachedTextTrack.cpp */; }; 128 128 0753860314489E9800B78452 /* CachedTextTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 0753860114489E9800B78452 /* CachedTextTrack.h */; }; 129 075BA84920618AA500FCB4AD /* VideoFullscreenLayerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */; }; 129 130 07638A991884487200E15A1B /* MediaSessionManagerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 07638A971884487200E15A1B /* MediaSessionManagerIOS.h */; settings = {ATTRIBUTES = (Private, ); }; }; 130 131 07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07638A981884487200E15A1B /* MediaSessionManagerIOS.mm */; }; … … 1526 1527 52B0D4C01C57FD660077CE53 /* VideoFullscreenChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1527 1528 52B0D4C21C57FF910077CE53 /* VideoFullscreenInterfaceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1528 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManager .mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */; };1529 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManagerObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */; }; 1529 1530 52D5A1A71C57489D00DE34A3 /* VideoFullscreenModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1A41C57488900DE34A3 /* VideoFullscreenModel.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1530 1531 52D5A1A81C5748A300DE34A3 /* VideoFullscreenModelVideoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1A51C57488900DE34A3 /* VideoFullscreenModelVideoElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 5263 5264 0753860014489E9800B78452 /* CachedTextTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedTextTrack.cpp; sourceTree = "<group>"; }; 5264 5265 0753860114489E9800B78452 /* CachedTextTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedTextTrack.h; sourceTree = "<group>"; }; 5266 075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManager.h; sourceTree = "<group>"; }; 5265 5267 07638A971884487200E15A1B /* MediaSessionManagerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerIOS.h; sourceTree = "<group>"; }; 5266 5268 07638A981884487200E15A1B /* MediaSessionManagerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSessionManagerIOS.mm; sourceTree = "<group>"; }; … … 8087 8089 52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenChangeObserver.h; sourceTree = "<group>"; }; 8088 8090 52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenInterfaceMac.h; sourceTree = "<group>"; }; 8089 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager .mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManager.mm; sourceTree = "<group>"; };8090 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManager .h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManager.h; sourceTree = "<group>"; };8091 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManagerObjC.mm; sourceTree = "<group>"; }; 8092 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManagerObjC.h; sourceTree = "<group>"; }; 8091 8093 52D5A1A41C57488900DE34A3 /* VideoFullscreenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenModel.h; sourceTree = "<group>"; }; 8092 8094 52D5A1A51C57488900DE34A3 /* VideoFullscreenModelVideoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenModelVideoElement.h; sourceTree = "<group>"; }; … … 23412 23414 BE913D7F181EF8E500DCB09E /* TrackPrivateBase.h */, 23413 23415 E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */, 23416 075BA84720618AA500FCB4AD /* VideoFullscreenLayerManager.h */, 23414 23417 BEF29EEA1715DD0900C4B4C9 /* VideoTrackPrivate.h */, 23415 23418 1411DCB0164C39A800D49BC1 /* WidthCache.h */, … … 24629 24632 CDC8B5A918047FF10016E685 /* SourceBufferPrivateAVFObjC.h */, 24630 24633 CDC8B5A818047FF10016E685 /* SourceBufferPrivateAVFObjC.mm */, 24631 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManager .h */,24632 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager .mm */,24634 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */, 24635 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */, 24633 24636 CD336F6517FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.cpp */, 24634 24637 CD336F6617FA0AC600DDDCD0 /* VideoTrackPrivateAVFObjC.h */, … … 30399 30402 3FBC4AF4189881560046EE38 /* VideoFullscreenInterfaceAVKit.h in Headers */, 30400 30403 52B0D4C21C57FF910077CE53 /* VideoFullscreenInterfaceMac.h in Headers */, 30404 075BA84920618AA500FCB4AD /* VideoFullscreenLayerManager.h in Headers */, 30401 30405 52D5A1A71C57489D00DE34A3 /* VideoFullscreenModel.h in Headers */, 30402 30406 52D5A1A81C5748A300DE34A3 /* VideoFullscreenModelVideoElement.h in Headers */, … … 31770 31774 837B7D201DC3F55000D051FC /* ValidationBubbleIOS.mm in Sources */, 31771 31775 3FBC4AF3189881560046EE38 /* VideoFullscreenInterfaceAVKit.mm in Sources */, 31772 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManager .mm in Sources */,31776 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManagerObjC.mm in Sources */, 31773 31777 BE88E0DE1715D2A200658D98 /* VideoTrack.cpp in Sources */, 31774 31778 BE88E0E11715D2A200658D98 /* VideoTrackList.cpp in Sources */, -
trunk/Source/WebCore/platform/graphics/VideoFullscreenLayerManager.h
r229823 r229824 1 1 /* 2 * Copyright (C) 201 6Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))29 30 #include "FloatRect.h"31 #include "IntSize.h"32 28 #include "PlatformLayer.h" 33 29 #include <wtf/Function.h> 34 30 #include <wtf/Noncopyable.h> 35 #include <wtf/RetainPtr.h>36 31 37 32 namespace WebCore { 33 34 class FloatRect; 35 class IntSize; 36 class TextTrackRepresentation; 38 37 39 38 class VideoFullscreenLayerManager { 40 39 WTF_MAKE_NONCOPYABLE(VideoFullscreenLayerManager); 41 40 public: 42 VideoFullscreenLayerManager(); 41 VideoFullscreenLayerManager() = default; 42 virtual ~VideoFullscreenLayerManager() { } 43 43 44 PlatformLayer *videoInlineLayer() const { return m_videoInlineLayer.get(); }45 PlatformLayer *videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); }46 FloatRect videoFullscreenFrame() const { return m_videoFullscreenFrame; }47 v oid setVideoLayer(PlatformLayer *, IntSize contentSize);48 v oid setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler);49 v oid setVideoFullscreenFrame(FloatRect);50 v oid didDestroyVideoLayer();44 virtual PlatformLayer *videoInlineLayer() const = 0; 45 virtual PlatformLayer *videoFullscreenLayer() const = 0; 46 virtual FloatRect videoFullscreenFrame() const = 0; 47 virtual void setVideoLayer(PlatformLayer*, IntSize) = 0; 48 virtual void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) = 0; 49 virtual void setVideoFullscreenFrame(FloatRect) = 0; 50 virtual void didDestroyVideoLayer() = 0; 51 51 52 private: 53 RetainPtr<PlatformLayer> m_videoInlineLayer; 54 RetainPtr<PlatformLayer> m_videoFullscreenLayer; 55 RetainPtr<PlatformLayer> m_videoLayer; 56 FloatRect m_videoFullscreenFrame; 52 virtual bool requiresTextTrackRepresentation() const = 0; 53 virtual void setTextTrackRepresentation(TextTrackRepresentation*) = 0; 54 virtual void syncTextTrackBounds() = 0; 57 55 }; 58 56 59 57 } 60 58 61 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
r229790 r229824 73 73 class WebCoreAVFResourceLoader; 74 74 class TextureCacheCV; 75 class VideoFullscreenLayerManagerObjC; 75 76 class VideoTextureCopierCV; 76 77 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))78 class VideoFullscreenLayerManager;79 #endif80 77 81 78 class MediaPlayerPrivateAVFoundationObjC : public MediaPlayerPrivateAVFoundation { … … 189 186 void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&) override; 190 187 PlatformLayer* platformLayer() const override; 191 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))192 188 void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override; 193 189 void setVideoFullscreenFrame(FloatRect) override; 194 190 void setVideoFullscreenGravity(MediaPlayer::VideoGravity) override; 195 191 void setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode) override; 196 #endif197 192 198 193 #if PLATFORM(IOS) … … 344 339 RetainPtr<AVPlayerItem> m_avPlayerItem; 345 340 RetainPtr<AVPlayerLayer> m_videoLayer; 346 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 347 std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager; 341 std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager; 348 342 MediaPlayer::VideoGravity m_videoFullscreenGravity; 349 RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;350 #endif351 343 RetainPtr<WebCoreAVFMovieObserver> m_objcObserver; 352 344 RetainPtr<id> m_timeObserver; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r229790 r229824 61 61 #import "TextureCacheCV.h" 62 62 #import "URL.h" 63 #import "VideoFullscreenLayerManagerObjC.h" 63 64 #import "VideoTextureCopierCV.h" 64 65 #import "VideoTrackPrivateAVFObjC.h" … … 99 100 #import <AVFoundation/AVTime.h> 100 101 101 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))102 #import "VideoFullscreenLayerManager.h"103 #endif104 105 102 #if PLATFORM(IOS) 106 103 #import "WAKAppKitStubs.h" … … 489 486 MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlayer* player) 490 487 : MediaPlayerPrivateAVFoundation(player) 491 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 492 , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>()) 488 , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>()) 493 489 , m_videoFullscreenGravity(MediaPlayer::VideoGravityResizeAspect) 494 #endif495 490 , m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithCallback:this])) 496 491 , m_videoFrameHasDrawn(false) … … 708 703 INFO_LOG(LOGIDENTIFIER); 709 704 710 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))711 705 m_videoFullscreenLayerManager->setVideoLayer(m_videoLayer.get(), defaultSize); 712 706 … … 715 709 [m_videoLayer setPIPModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModePictureInPicture)]; 716 710 #endif 717 #else718 [m_videoLayer setFrame:CGRectMake(0, 0, defaultSize.width(), defaultSize.height())];719 #endif720 711 } 721 712 … … 729 720 [m_videoLayer removeObserver:m_objcObserver.get() forKeyPath:@"readyForDisplay"]; 730 721 [m_videoLayer setPlayer:nil]; 731 732 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))733 722 m_videoFullscreenLayerManager->didDestroyVideoLayer(); 734 #endif735 723 736 724 m_videoLayer = nil; … … 1173 1161 PlatformLayer* MediaPlayerPrivateAVFoundationObjC::platformLayer() const 1174 1162 { 1175 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 1176 return m_haveBeenAskedToCreateLayer ? m_videoFullscreenLayerManager->videoInlineLayer() : nullptr; 1177 #else 1178 return m_haveBeenAskedToCreateLayer ? m_videoLayer.get() : nullptr; 1179 #endif 1180 } 1181 1182 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 1163 return m_videoFullscreenLayerManager->videoInlineLayer(); 1164 } 1165 1183 1166 void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer(PlatformLayer* videoFullscreenLayer, WTF::Function<void()>&& completionHandler) 1184 1167 { 1185 if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {1186 completionHandler();1187 return;1188 }1189 1190 [CATransaction begin];1191 [CATransaction setDisableActions:YES];1192 1193 1168 m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler)); 1194 1195 if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {1196 syncTextTrackBounds();1197 [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];1198 }1199 1200 [CATransaction commit];1201 1202 1169 updateDisableExternalPlayback(); 1203 1170 } … … 1206 1173 { 1207 1174 m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame); 1208 syncTextTrackBounds();1209 1175 } 1210 1176 … … 1243 1209 #endif 1244 1210 } 1245 1246 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))1247 1211 1248 1212 #if PLATFORM(IOS) … … 1878 1842 return; 1879 1843 1880 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))1881 1844 // Do not attempt to change the video gravity while in full screen mode. 1882 1845 // See setVideoFullscreenGravity(). 1883 1846 if (m_videoFullscreenLayerManager->videoFullscreenLayer()) 1884 1847 return; 1885 #endif1886 1848 1887 1849 [CATransaction begin]; … … 2178 2140 bool MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation() const 2179 2141 { 2180 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 2181 if (m_videoFullscreenLayerManager->videoFullscreenLayer()) 2182 return true; 2183 #endif 2184 return false; 2142 return m_videoFullscreenLayerManager->requiresTextTrackRepresentation(); 2185 2143 } 2186 2144 2187 2145 void MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds() 2188 2146 { 2189 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 2190 if (!m_videoFullscreenLayerManager->videoFullscreenLayer() || !m_textTrackRepresentationLayer) 2191 return; 2192 2193 [CATransaction begin]; 2194 [CATransaction setDisableActions:YES]; 2195 2196 FloatRect videoFullscreenFrame = m_videoFullscreenLayerManager->videoFullscreenFrame(); 2197 CGRect textFrame = m_videoLayer ? [m_videoLayer videoRect] : CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height()); 2198 [m_textTrackRepresentationLayer setFrame:textFrame]; 2199 2200 [CATransaction commit]; 2201 #endif 2147 m_videoFullscreenLayerManager->syncTextTrackBounds(); 2202 2148 } 2203 2149 2204 2150 void MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation(TextTrackRepresentation* representation) 2205 2151 { 2206 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 2207 PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil; 2208 if (representationLayer == m_textTrackRepresentationLayer) { 2209 syncTextTrackBounds(); 2210 return; 2211 } 2212 2213 [CATransaction begin]; 2214 [CATransaction setDisableActions:YES]; 2215 2216 if (m_textTrackRepresentationLayer) 2217 [m_textTrackRepresentationLayer removeFromSuperlayer]; 2218 2219 m_textTrackRepresentationLayer = representationLayer; 2220 2221 if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) { 2222 syncTextTrackBounds(); 2223 [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()]; 2224 } 2225 2226 [CATransaction commit]; 2227 2228 #else 2229 UNUSED_PARAM(representation); 2230 #endif 2152 m_videoFullscreenLayerManager->setTextTrackRepresentation(representation); 2231 2153 } 2232 2154 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
r228709 r229824 53 53 class PlatformClockCM; 54 54 class TextureCacheCV; 55 class VideoFullscreenLayerManagerObjC; 55 56 class VideoTextureCopierCV; 56 57 class WebCoreDecompressionSession; 57 58 58 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)59 class VideoFullscreenLayerManager;60 #endif61 59 62 60 class MediaPlayerPrivateMediaSourceAVFObjC : public MediaPlayerPrivateInterface { … … 109 107 WebCoreDecompressionSession* decompressionSession() const { return m_decompressionSession.get(); } 110 108 111 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)112 109 void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override; 113 110 void setVideoFullscreenFrame(FloatRect) override; 114 #endif 115 116 #if ENABLE(VIDEO_TRACK) 111 117 112 bool requiresTextTrackRepresentation() const override; 118 113 void setTextTrackRepresentation(TextTrackRepresentation*) override; 119 114 void syncTextTrackBounds() override; 120 #endif121 115 122 116 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) … … 309 303 bool m_hasAvailableVideoFrame { false }; 310 304 bool m_allRenderersHaveAvailableSamples { false }; 311 RetainPtr<PlatformLayer> m_textTrackRepresentationLayer;312 305 std::unique_ptr<TextureCacheCV> m_textureCache; 313 306 std::unique_ptr<VideoTextureCopierCV> m_videoTextureCopier; … … 317 310 bool m_shouldPlayToTarget { false }; 318 311 #endif 319 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE) 320 std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager; 321 #endif 312 std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager; 322 313 #if ENABLE(ENCRYPTED_MEDIA) 323 314 RefPtr<CDMInstance> m_cdmInstance; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r228709 r229824 42 42 #import "TextTrackRepresentation.h" 43 43 #import "TextureCacheCV.h" 44 #import "VideoFullscreenLayerManagerObjC.h" 44 45 #import "VideoTextureCopierCV.h" 45 46 #import "WebCoreDecompressionSession.h" … … 53 54 #import <wtf/MainThread.h> 54 55 #import <wtf/NeverDestroyed.h> 55 56 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)57 #import "VideoFullscreenLayerManager.h"58 #endif59 56 60 57 #pragma mark - Soft Linking … … 135 132 , m_seeking(false) 136 133 , m_loadingProgressed(false) 137 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE) 138 , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>()) 139 #endif 134 , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>()) 140 135 { 141 136 CMTimebaseRef timebase = [m_synchronizer timebase]; … … 291 286 PlatformLayer* MediaPlayerPrivateMediaSourceAVFObjC::platformLayer() const 292 287 { 293 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)294 288 return m_videoFullscreenLayerManager->videoInlineLayer(); 295 #else296 return m_sampleBufferDisplayLayer.get();297 #endif298 289 } 299 290 … … 714 705 if (m_mediaSourcePrivate) 715 706 m_mediaSourcePrivate->setVideoLayer(m_sampleBufferDisplayLayer.get()); 716 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))717 707 m_videoFullscreenLayerManager->setVideoLayer(m_sampleBufferDisplayLayer.get(), snappedIntRect(m_player->client().mediaPlayerContentBoxRect()).size()); 718 #endif719 708 m_player->client().mediaPlayerRenderingModeChanged(m_player); 720 709 } … … 732 721 if (m_mediaSourcePrivate) 733 722 m_mediaSourcePrivate->setVideoLayer(nullptr); 734 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))735 723 m_videoFullscreenLayerManager->didDestroyVideoLayer(); 736 #endif737 724 m_sampleBufferDisplayLayer = nullptr; 738 725 setHasAvailableVideoFrame(false); … … 1080 1067 } 1081 1068 1082 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)1083 1069 void MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler) 1084 1070 { 1085 if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {1086 completionHandler();1087 return;1088 }1089 1090 [CATransaction begin];1091 [CATransaction setDisableActions:YES];1092 1093 1071 m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler)); 1094 1095 if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) {1096 syncTextTrackBounds();1097 [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()];1098 }1099 1100 [CATransaction commit];1101 1072 } 1102 1073 … … 1104 1075 { 1105 1076 m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame); 1106 syncTextTrackBounds(); 1107 } 1108 #endif 1109 1077 } 1078 1110 1079 bool MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation() const 1111 1080 { 1112 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 1113 if (m_videoFullscreenLayerManager->videoFullscreenLayer()) 1114 return true; 1115 #endif 1116 return false; 1081 return m_videoFullscreenLayerManager->videoFullscreenLayer(); 1117 1082 } 1118 1083 1119 1084 void MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds() 1120 1085 { 1121 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 1122 if (!m_videoFullscreenLayerManager->videoFullscreenLayer() || !m_textTrackRepresentationLayer) 1123 return; 1124 1125 [CATransaction begin]; 1126 [CATransaction setDisableActions:YES]; 1127 1128 auto videoFullscreenFrame = m_videoFullscreenLayerManager->videoFullscreenFrame(); 1129 auto videoRect = [m_sampleBufferDisplayLayer bounds]; 1130 auto textFrame = m_sampleBufferDisplayLayer ? videoRect : CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height()); 1131 [m_textTrackRepresentationLayer setFrame:textFrame]; 1132 1133 [CATransaction commit]; 1134 #endif 1086 m_videoFullscreenLayerManager->syncTextTrackBounds(); 1135 1087 } 1136 1088 1137 1089 void MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation(TextTrackRepresentation* representation) 1138 1090 { 1139 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 1140 PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil; 1141 if (representationLayer == m_textTrackRepresentationLayer) { 1142 syncTextTrackBounds(); 1143 return; 1144 } 1145 1146 [CATransaction begin]; 1147 [CATransaction setDisableActions:YES]; 1148 1149 if (m_textTrackRepresentationLayer) 1150 [m_textTrackRepresentationLayer removeFromSuperlayer]; 1151 1152 m_textTrackRepresentationLayer = representationLayer; 1153 1154 if (m_videoFullscreenLayerManager->videoFullscreenLayer() && m_textTrackRepresentationLayer) { 1155 syncTextTrackBounds(); 1156 [m_videoFullscreenLayerManager->videoFullscreenLayer() addSublayer:m_textTrackRepresentationLayer.get()]; 1157 } 1158 1159 [CATransaction commit]; 1160 1161 #else 1162 UNUSED_PARAM(representation); 1163 #endif 1164 } 1165 1091 m_videoFullscreenLayerManager->setTextTrackRepresentation(representation); 1092 } 1166 1093 1167 1094 #if ENABLE(WIRELESS_PLAYBACK_TARGET) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h
r226990 r229824 55 55 class MediaSourcePrivateClient; 56 56 class PixelBufferConformerCV; 57 class VideoFullscreenLayerManagerObjC; 57 58 class VideoTrackPrivateMediaStream; 58 59 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))60 class VideoFullscreenLayerManager;61 #endif62 59 63 60 class MediaPlayerPrivateMediaStreamAVFObjC final : public MediaPlayerPrivateInterface, private MediaStreamPrivate::Observer, private MediaStreamTrackPrivate::Observer … … 224 221 void readyStateChanged(MediaStreamTrackPrivate&) override; 225 222 226 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))227 223 void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) override; 228 224 void setVideoFullscreenFrame(FloatRect) override; 229 #endif230 225 231 226 MediaTime streamTime() const; … … 270 265 MediaSample::VideoRotation m_videoRotation { MediaSample::VideoRotation::None }; 271 266 CGAffineTransform m_videoTransform; 267 std::unique_ptr<VideoFullscreenLayerManagerObjC> m_videoFullscreenLayerManager; 268 269 #if !RELEASE_LOG_DISABLED 270 Ref<const Logger> m_logger; 271 const void* m_logIdentifier; 272 #endif 273 272 274 bool m_videoMirrored { false }; 273 275 bool m_playing { false }; … … 280 282 bool m_visible { false }; 281 283 bool m_haveSeenMetadata { false }; 282 283 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))284 std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager;285 #endif286 287 #if !RELEASE_LOG_DISABLED288 Ref<const Logger> m_logger;289 const void* m_logIdentifier;290 #endif291 292 284 }; 293 285 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
r228528 r229824 34 34 #import "MediaStreamPrivate.h" 35 35 #import "PixelBufferConformerCV.h" 36 #import "VideoFullscreenLayerManagerObjC.h" 36 37 #import "VideoTrackPrivateMediaStream.h" 37 38 #import <AVFoundation/AVSampleBufferDisplayLayer.h> … … 46 47 #import <wtf/NeverDestroyed.h> 47 48 48 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))49 #import "VideoFullscreenLayerManager.h"50 #endif51 49 52 50 #pragma mark - Soft Linking … … 192 190 , m_statusChangeListener(adoptNS([[WebAVSampleBufferStatusChangeListener alloc] initWithParent:this])) 193 191 , m_clock(PAL::Clock::create()) 194 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 195 , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManager>()) 196 #endif 192 , m_videoFullscreenLayerManager(std::make_unique<VideoFullscreenLayerManagerObjC>()) 197 193 #if !RELEASE_LOG_DISABLED 198 194 , m_logger(player->mediaPlayerLogger()) … … 501 497 updateDisplayLayer(); 502 498 503 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))504 499 m_videoFullscreenLayerManager->setVideoLayer(m_backgroundLayer.get(), snappedIntRect(m_player->client().mediaPlayerContentBoxRect()).size()); 505 #endif506 500 } 507 501 … … 519 513 updateRenderingMode(); 520 514 521 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))522 515 m_videoFullscreenLayerManager->didDestroyVideoLayer(); 523 #endif524 516 } 525 517 … … 587 579 return nullptr; 588 580 589 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))590 581 return m_videoFullscreenLayerManager->videoInlineLayer(); 591 #else592 return m_backgroundLayer.get();593 #endif594 582 } 595 583 … … 910 898 } 911 899 912 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))913 900 void MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer(PlatformLayer* videoFullscreenLayer, WTF::Function<void()>&& completionHandler) 914 901 { 915 if (m_videoFullscreenLayerManager->videoFullscreenLayer() == videoFullscreenLayer) {916 completionHandler();917 return;918 }919 920 902 m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler)); 921 903 } … … 925 907 m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame); 926 908 } 927 #endif928 909 929 910 typedef enum { -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h
r229823 r229824 26 26 #pragma once 27 27 28 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))29 30 28 #include "FloatRect.h" 31 29 #include "IntSize.h" 32 30 #include "PlatformLayer.h" 31 #include "VideoFullscreenLayerManager.h" 33 32 #include <wtf/Function.h> 34 33 #include <wtf/Noncopyable.h> … … 37 36 namespace WebCore { 38 37 39 class VideoFullscreenLayerManager { 40 WTF_MAKE_NONCOPYABLE(VideoFullscreenLayerManager); 38 class VideoFullscreenLayerManagerObjC final : public VideoFullscreenLayerManager { 41 39 public: 42 VideoFullscreenLayerManager ();40 VideoFullscreenLayerManagerObjC(); 43 41 44 PlatformLayer *videoInlineLayer() const { return m_videoInlineLayer.get(); } 45 PlatformLayer *videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); } 46 FloatRect videoFullscreenFrame() const { return m_videoFullscreenFrame; } 47 void setVideoLayer(PlatformLayer *, IntSize contentSize); 48 void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler); 49 void setVideoFullscreenFrame(FloatRect); 50 void didDestroyVideoLayer(); 42 PlatformLayer *videoInlineLayer() const final { return m_videoInlineLayer.get(); } 43 PlatformLayer *videoFullscreenLayer() const final { return m_videoFullscreenLayer.get(); } 44 FloatRect videoFullscreenFrame() const final { return m_videoFullscreenFrame; } 45 void setVideoLayer(PlatformLayer *, IntSize contentSize) final; 46 void setVideoFullscreenLayer(PlatformLayer *, WTF::Function<void()>&& completionHandler) final; 47 void setVideoFullscreenFrame(FloatRect) final; 48 void didDestroyVideoLayer() final; 49 50 bool requiresTextTrackRepresentation() const final; 51 void setTextTrackRepresentation(TextTrackRepresentation*) final; 52 void syncTextTrackBounds() final; 51 53 52 54 private: 55 RetainPtr<PlatformLayer> m_textTrackRepresentationLayer; 53 56 RetainPtr<PlatformLayer> m_videoInlineLayer; 54 57 RetainPtr<PlatformLayer> m_videoFullscreenLayer; 55 58 RetainPtr<PlatformLayer> m_videoLayer; 56 59 FloatRect m_videoFullscreenFrame; 60 FloatRect m_videoInlineFrame; 57 61 }; 58 62 59 63 } 60 64 61 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm
r229823 r229824 25 25 26 26 #import "config.h" 27 #import "VideoFullscreenLayerManager.h" 28 29 #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 27 #import "VideoFullscreenLayerManagerObjC.h" 30 28 31 29 #import "Color.h" 30 #import "TextTrackRepresentation.h" 32 31 #import "WebCoreCALayerExtras.h" 33 32 #import <mach/mach_init.h> … … 60 59 namespace WebCore { 61 60 62 VideoFullscreenLayerManager::VideoFullscreenLayerManager() 61 VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC() 62 : VideoFullscreenLayerManager() 63 63 { 64 64 } 65 65 66 void VideoFullscreenLayerManager ::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize)66 void VideoFullscreenLayerManagerObjC::setVideoLayer(PlatformLayer *videoLayer, IntSize contentSize) 67 67 { 68 68 m_videoLayer = videoLayer; 69 m_videoInlineFrame = CGRectMake(0, 0, contentSize.width(), contentSize.height()); 69 70 70 71 [m_videoLayer web_disableAllActions]; … … 73 74 [m_videoInlineLayer setName:@"WebVideoContainerLayer"]; 74 75 #endif 75 [m_videoInlineLayer setFrame: CGRectMake(0, 0, contentSize.width(), contentSize.height())];76 [m_videoInlineLayer setFrame:m_videoInlineFrame]; 76 77 if (m_videoFullscreenLayer) { 77 78 [m_videoLayer setFrame:CGRectMake(0, 0, m_videoFullscreenFrame.width(), m_videoFullscreenFrame.height())]; … … 83 84 } 84 85 85 void VideoFullscreenLayerManager ::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler)86 void VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler) 86 87 { 87 88 if (m_videoFullscreenLayer == videoFullscreenLayer) { … … 126 127 } 127 128 128 void VideoFullscreenLayerManager ::setVideoFullscreenFrame(FloatRect videoFullscreenFrame)129 void VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame(FloatRect videoFullscreenFrame) 129 130 { 130 131 m_videoFullscreenFrame = videoFullscreenFrame; … … 132 133 return; 133 134 134 [m_videoLayer setFrame: CGRectMake(0, 0, videoFullscreenFrame.width(), videoFullscreenFrame.height())];135 [m_videoLayer setFrame:m_videoFullscreenFrame]; 135 136 } 136 137 137 void VideoFullscreenLayerManager ::didDestroyVideoLayer()138 void VideoFullscreenLayerManagerObjC::didDestroyVideoLayer() 138 139 { 139 140 [m_videoLayer removeFromSuperlayer]; … … 143 144 } 144 145 146 bool VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation() const 147 { 148 return m_videoFullscreenLayer; 145 149 } 146 150 147 #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 151 void VideoFullscreenLayerManagerObjC::syncTextTrackBounds() 152 { 153 if (!m_videoFullscreenLayer || !m_textTrackRepresentationLayer) 154 return; 155 156 [CATransaction begin]; 157 [CATransaction setDisableActions:YES]; 158 159 CGRect textFrame = m_videoLayer ? m_videoInlineFrame : m_videoFullscreenFrame; 160 [m_textTrackRepresentationLayer setFrame:textFrame]; 161 162 [CATransaction commit]; 163 } 164 165 void VideoFullscreenLayerManagerObjC::setTextTrackRepresentation(TextTrackRepresentation* representation) 166 { 167 PlatformLayer* representationLayer = representation ? representation->platformLayer() : nil; 168 if (representationLayer == m_textTrackRepresentationLayer) { 169 syncTextTrackBounds(); 170 return; 171 } 172 173 [CATransaction begin]; 174 [CATransaction setDisableActions:YES]; 175 176 if (m_textTrackRepresentationLayer) 177 [m_textTrackRepresentationLayer removeFromSuperlayer]; 178 179 m_textTrackRepresentationLayer = representationLayer; 180 181 if (m_videoFullscreenLayer && m_textTrackRepresentationLayer) { 182 syncTextTrackBounds(); 183 [m_videoFullscreenLayer addSublayer:m_textTrackRepresentationLayer.get()]; 184 } 185 186 [CATransaction commit]; 187 188 } 189 190 } 191
Note: See TracChangeset
for help on using the changeset viewer.