Title: [195692] trunk/Source/WebCore
Revision
195692
Author
adac...@apple.com
Date
2016-01-27 14:23:36 -0800 (Wed, 27 Jan 2016)

Log Message

Enable API related to the video fullscreen layer in MediaPlayerPrivateMediaSourceAVFObjC
also on Mac platform with video presentation mode support.
https://bugs.webkit.org/show_bug.cgi?id=153223

Reviewed by Jer Noble.

Reuse VideoFullscreenLayerManager to manage moving the video layer between the fullscreen
layer and the inline layer depending on the current presentation mode.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
Create m_videoFullscreenLayerManager.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer):
Return the video inline layer from the VideoFullscreenLayerManager.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer):
Call VideoFullscreenLayerManager::setVideoLayer() with the m_sampleBufferDisplayLayer.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer):
Call VideoFullscreenLayerManager::didDestroyVideoLayer().
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
Call VideoFullscreenLayerManager::setVideoFullscreenLayer().
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
Call VideoFullscreenLayerManager::setVideoFullscreenFrame().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195691 => 195692)


--- trunk/Source/WebCore/ChangeLog	2016-01-27 22:08:20 UTC (rev 195691)
+++ trunk/Source/WebCore/ChangeLog	2016-01-27 22:23:36 UTC (rev 195692)
@@ -1,3 +1,29 @@
+2016-01-26  Ada Chan  <adac...@apple.com>
+
+        Enable API related to the video fullscreen layer in MediaPlayerPrivateMediaSourceAVFObjC
+        also on Mac platform with video presentation mode support.
+        https://bugs.webkit.org/show_bug.cgi?id=153223
+
+        Reviewed by Jer Noble.
+
+        Reuse VideoFullscreenLayerManager to manage moving the video layer between the fullscreen
+        layer and the inline layer depending on the current presentation mode.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
+        Create m_videoFullscreenLayerManager.
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer):
+        Return the video inline layer from the VideoFullscreenLayerManager.
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer):
+        Call VideoFullscreenLayerManager::setVideoLayer() with the m_sampleBufferDisplayLayer.
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer):
+        Call VideoFullscreenLayerManager::didDestroyVideoLayer().
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
+        Call VideoFullscreenLayerManager::setVideoFullscreenLayer().
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
+        Call VideoFullscreenLayerManager::setVideoFullscreenFrame().
+
 2016-01-27  Brady Eidson  <beid...@apple.com>
 
         Modern IDB: SQLite backend doesn't update index records as object records are added.

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (195691 => 195692)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2016-01-27 22:08:20 UTC (rev 195691)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2016-01-27 22:23:36 UTC (rev 195692)
@@ -48,6 +48,10 @@
 class PlatformClockCM;
 class MediaSourcePrivateAVFObjC;
 
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+class VideoFullscreenLayerManager;
+#endif
+
 class MediaPlayerPrivateMediaSourceAVFObjC : public MediaPlayerPrivateInterface {
 public:
     explicit MediaPlayerPrivateMediaSourceAVFObjC(MediaPlayer*);
@@ -82,6 +86,11 @@
     void sizeChanged();
     void characteristicsChanged();
 
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+    virtual void setVideoFullscreenLayer(PlatformLayer*) override;
+    virtual void setVideoFullscreenFrame(FloatRect) override;
+#endif
+
 #if ENABLE(ENCRYPTED_MEDIA_V2)
     bool hasStreamSession() { return m_streamSession; }
     AVStreamSession *streamSession();
@@ -223,6 +232,9 @@
     RefPtr<MediaPlaybackTarget> m_playbackTarget;
     bool m_shouldPlayToTarget { false };
 #endif
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+    std::unique_ptr<VideoFullscreenLayerManager> m_videoFullscreenLayerManager;
+#endif
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (195691 => 195692)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2016-01-27 22:08:20 UTC (rev 195691)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2016-01-27 22:23:36 UTC (rev 195692)
@@ -44,6 +44,10 @@
 #import <wtf/MainThread.h>
 #import <wtf/NeverDestroyed.h>
 
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+#import "VideoFullscreenLayerManager.h"
+#endif
+
 #pragma mark - Soft Linking
 
 #import "CoreMediaSoftLink.h"
@@ -146,6 +150,9 @@
     , m_seeking(false)
     , m_seekCompleted(true)
     , m_loadingProgressed(false)
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+    , m_videoFullscreenLayerManager(VideoFullscreenLayerManager::create())
+#endif
 {
     CMTimebaseRef timebase = [m_synchronizer timebase];
     CMNotificationCenterRef nc = CMNotificationCenterGetDefaultLocalCenter();
@@ -296,7 +303,11 @@
 
 PlatformLayer* MediaPlayerPrivateMediaSourceAVFObjC::platformLayer() const
 {
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+    return m_videoFullscreenLayerManager->videoInlineLayer();
+#else
     return m_sampleBufferDisplayLayer.get();
+#endif
 }
 
 void MediaPlayerPrivateMediaSourceAVFObjC::play()
@@ -757,6 +768,10 @@
 
     // FIXME: move this somewhere appropriate:
     m_player->firstVideoFrameAvailable();
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+    m_videoFullscreenLayerManager->setVideoLayer(m_sampleBufferDisplayLayer.get(), snappedIntRect(m_player->client().mediaPlayerContentBoxRect()).size());
+#endif
 }
 
 void MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer(AVSampleBufferDisplayLayer* displayLayer)
@@ -771,6 +786,10 @@
 
     m_sampleBufferDisplayLayer = nullptr;
     m_player->client().mediaPlayerRenderingModeChanged(m_player);
+
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+    m_videoFullscreenLayerManager->didDestroyVideoLayer();
+#endif
 }
 
 void MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer(AVSampleBufferAudioRenderer* audioRenderer)
@@ -808,6 +827,18 @@
     m_player->characteristicChanged();
 }
 
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+void MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer)
+{
+    m_videoFullscreenLayerManager->setVideoFullscreenLayer(videoFullscreenLayer);
+}
+
+void MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame(FloatRect frame)
+{
+    m_videoFullscreenLayerManager->setVideoFullscreenFrame(frame);
+}
+#endif
+
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 void MediaPlayerPrivateMediaSourceAVFObjC::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& target)
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to