Begin implementation of video using Media Foundation.
authoralex.christensen@flexsim.com <alex.christensen@flexsim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Apr 2014 18:22:02 +0000 (18:22 +0000)
committeralex.christensen@flexsim.com <alex.christensen@flexsim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Apr 2014 18:22:02 +0000 (18:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131830

Reviewed by Brent Fulgham.

Source/WebCore:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
Added MediaPlayerPrivateMediaFoundation files.
* platform/graphics/MediaPlayer.cpp:
Include MediaPlayerPrivateMediaFoundation inside new USE(MEDIA_FOUNDATION) flag.
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: Added.
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: Added.

Source/WebKit/win:
* FullscreenVideoController.cpp:
* WebView.cpp:
Added new USE(MEDIA_FOUNDATION) flag to prevent using the unsupported fullscreen api.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167670 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h [new file with mode: 0644]
Source/WebKit/win/ChangeLog
Source/WebKit/win/FullscreenVideoController.cpp
Source/WebKit/win/WebView.cpp

index 93ad082..ff96743 100644 (file)
@@ -1,3 +1,18 @@
+2014-04-22  Alex Christensen  <achristensen@webkit.org>
+
+        Begin implementation of video using Media Foundation.
+        https://bugs.webkit.org/show_bug.cgi?id=131830
+
+        Reviewed by Brent Fulgham.
+
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        Added MediaPlayerPrivateMediaFoundation files.
+        * platform/graphics/MediaPlayer.cpp:
+        Include MediaPlayerPrivateMediaFoundation inside new USE(MEDIA_FOUNDATION) flag.
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: Added.
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: Added.
+
 2014-04-22  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r167658.
index 387746c..e7e5ef3 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     </ClCompile>
     <ClCompile Include="..\platform\HistogramSupport.cpp" />
+    <ClCompile Include="..\platform\graphics\win\MediaPlayerPrivateMediaFoundation.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\platform\KillRingNone.cpp" />
     <ClCompile Include="..\platform\network\soup\AuthenticationChallengeSoup.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     <ClInclude Include="..\platform\graphics\TiledBackingStoreClient.h" />
     <ClInclude Include="..\platform\graphics\TrackBasePrivate.h" />
     <ClInclude Include="..\platform\graphics\VideoTrackPrivate.h" />
+    <ClInclude Include="..\platform\graphics\win\MediaPlayerPrivateMediaFoundation.h" />
     <ClInclude Include="..\platform\graphics\win\SharedGDIObject.h" />
     <ClInclude Include="..\platform\HistogramSupport.h" />
     <ClInclude Include="..\platform\HostWindow.h" />
index a7319f6..d2fabae 100644 (file)
     <ClCompile Include="..\platform\graphics\win\MediaPlayerPrivateFullscreenWindow.cpp">
       <Filter>platform\graphics\win</Filter>
     </ClCompile>
+    <ClCompile Include="..\platform\graphics\win\MediaPlayerPrivateMediaFoundation.cpp">
+      <Filter>platform\graphics\win</Filter>
+    </ClCompile>
     <ClCompile Include="..\platform\graphics\opentype\OpenTypeMathData.cpp">
       <Filter>platform\graphics\win</Filter>
     </ClCompile>
     <ClInclude Include="..\platform\graphics\avfoundation\MediaPlayerPrivateAVFoundation.h">
       <Filter>platform\graphics\avfoundation</Filter>
     </ClInclude>
+    <ClCompile Include="..\platform\graphics\win\MediaPlayerPrivateMediaFoundation.h">
+      <Filter>platform\graphics\win</Filter>
+    </ClCompile>
     <ClInclude Include="..\platform\graphics\avfoundation\cf\AVFoundationCFSoftLinking.h">
       <Filter>platform\graphics\avfoundation\cf</Filter>
     </ClInclude>
index d07a6b5..b393d3f 100644 (file)
 #define PlatformMediaEngineClassName MediaPlayerPrivateGStreamer
 #endif
 
+#if USE(MEDIA_FOUNDATION)
+#include "MediaPlayerPrivateMediaFoundation.h"
+#define PlatformMediaEngineClassName MediaPlayerPrivateMediaFoundation
+#endif
+
 #if PLATFORM(COCOA)
 #if PLATFORM(IOS)
 #include "MediaPlayerPrivateIOS.h"
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
new file mode 100644 (file)
index 0000000..8a1cee6
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2014 Alex Christensen <achristensen@webkit.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MediaPlayerPrivateMediaFoundation.h"
+
+#include "GraphicsContext.h"
+#include "NotImplemented.h"
+
+#if USE(MEDIA_FOUNDATION)
+
+namespace WebCore {
+
+// TODO: Implement video functionality using Media Foundation
+
+MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation(MediaPlayer* player) 
+    : m_player(player)
+{
+}
+
+PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateMediaFoundation::create(MediaPlayer* player)
+{
+    return adoptPtr(new MediaPlayerPrivateMediaFoundation(player));
+}
+
+void MediaPlayerPrivateMediaFoundation::registerMediaEngine(MediaEngineRegistrar registrar)
+{
+    if (isAvailable())
+        registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
+}
+
+bool MediaPlayerPrivateMediaFoundation::isAvailable() 
+{
+    notImplemented();
+    return true;
+}
+
+void MediaPlayerPrivateMediaFoundation::getSupportedTypes(HashSet<String>& types)
+{
+    notImplemented();
+    types = HashSet<String>();
+}
+
+MediaPlayer::SupportsType MediaPlayerPrivateMediaFoundation::supportsType(const MediaEngineSupportParameters& parameters)
+{
+    notImplemented();
+    return MediaPlayer::IsNotSupported;
+}
+
+void MediaPlayerPrivateMediaFoundation::load(const String&)
+{
+    notImplemented();
+}
+
+void MediaPlayerPrivateMediaFoundation::cancelLoad()
+{
+    notImplemented();
+}
+
+void MediaPlayerPrivateMediaFoundation::play()
+{
+    notImplemented();
+}
+
+void MediaPlayerPrivateMediaFoundation::pause()
+{
+    notImplemented();
+}
+
+IntSize MediaPlayerPrivateMediaFoundation::naturalSize() const 
+{
+    notImplemented();
+    return IntSize(0, 0);
+}
+
+bool MediaPlayerPrivateMediaFoundation::hasVideo() const
+{
+    notImplemented();
+    return false;
+}
+
+bool MediaPlayerPrivateMediaFoundation::hasAudio() const
+{
+    notImplemented();
+    return false;
+}
+
+void MediaPlayerPrivateMediaFoundation::setVisible(bool)
+{
+    notImplemented();
+}
+
+bool MediaPlayerPrivateMediaFoundation::seeking() const
+{
+    notImplemented();
+    return false;
+}
+
+bool MediaPlayerPrivateMediaFoundation::paused() const
+{
+    notImplemented();
+    return false;
+}
+
+MediaPlayer::NetworkState MediaPlayerPrivateMediaFoundation::networkState() const
+{ 
+    notImplemented();
+    return MediaPlayer::Empty;
+}
+
+MediaPlayer::ReadyState MediaPlayerPrivateMediaFoundation::readyState() const
+{
+    notImplemented();
+    return MediaPlayer::HaveNothing;
+}
+
+std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateMediaFoundation::buffered() const
+{ 
+    notImplemented();
+    return PlatformTimeRanges::create();
+}
+
+bool MediaPlayerPrivateMediaFoundation::didLoadingProgress() const
+{
+    notImplemented();
+    return false;
+}
+
+void MediaPlayerPrivateMediaFoundation::setSize(const IntSize&)
+{
+    notImplemented();
+}
+
+void MediaPlayerPrivateMediaFoundation::paint(GraphicsContext* context, const IntRect& rect)
+{
+    if (context->paintingDisabled()
+        || !m_player->visible())
+        return;
+
+    // TODO: Paint the contents of the video to the context
+    notImplemented();
+}
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
new file mode 100644 (file)
index 0000000..b9ae0c5
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2014 Alex Christensen <achristensen@webkit.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "MediaPlayerPrivate.h"
+
+namespace WebCore {
+
+class MediaPlayerPrivateMediaFoundation : public MediaPlayerPrivateInterface {
+public:
+    MediaPlayerPrivateMediaFoundation(MediaPlayer*);
+    static void registerMediaEngine(MediaEngineRegistrar);
+
+    static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
+    static void getSupportedTypes(HashSet<String>& types);
+    static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
+    static bool isAvailable();
+
+    virtual void load(const String& url);
+    virtual void cancelLoad();
+
+    virtual void play();
+    virtual void pause();
+
+    virtual IntSize naturalSize() const;
+
+    virtual bool hasVideo() const;
+    virtual bool hasAudio() const;
+
+    virtual void setVisible(bool);
+
+    virtual bool seeking() const;
+
+    virtual bool paused() const;
+
+    virtual MediaPlayer::NetworkState networkState() const;
+    virtual MediaPlayer::ReadyState readyState() const;
+
+    virtual std::unique_ptr<PlatformTimeRanges> buffered() const;
+
+    virtual bool didLoadingProgress() const;
+
+    virtual void setSize(const IntSize&);
+
+    virtual void paint(GraphicsContext*, const IntRect&);
+
+private:
+
+    MediaPlayer* m_player;
+
+};
+
+}
index 543a909..26e6a88 100644 (file)
@@ -1,3 +1,14 @@
+2014-04-22  Alex Christensen  <achristensen@webkit.org>
+
+        Begin implementation of video using Media Foundation.
+        https://bugs.webkit.org/show_bug.cgi?id=131830
+
+        Reviewed by Brent Fulgham.
+
+        * FullscreenVideoController.cpp:
+        * WebView.cpp:
+        Added new USE(MEDIA_FOUNDATION) flag to prevent using the unsupported fullscreen api.
+
 2014-04-09  Alexey Proskuryakov  <ap@apple.com>
 
         Eliminate DragSession structure
index 0b22ce9..e8dbc2c 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "config.h"
 
-#if ENABLE(VIDEO) && !USE(GSTREAMER)
+#if ENABLE(VIDEO) && !USE(GSTREAMER) && !USE(MEDIA_FOUNDATION)
 
 #include "FullscreenVideoController.h"
 
index 14fa428..7657a6c 100644 (file)
@@ -6276,7 +6276,7 @@ HRESULT WebView::setCanStartPlugins(BOOL canStartPlugins)
 
 void WebView::enterFullscreenForNode(Node* node)
 {
-#if ENABLE(VIDEO) && !USE(GSTREAMER)
+#if ENABLE(VIDEO) && !USE(GSTREAMER) && !USE(MEDIA_FOUNDATION)
     if (!isHTMLVideoElement(node) || !node->isElementNode())
         return;
 
@@ -6307,7 +6307,7 @@ void WebView::enterFullscreenForNode(Node* node)
 
 void WebView::exitFullscreen()
 {
-#if ENABLE(VIDEO) && !USE(GSTREAMER)
+#if ENABLE(VIDEO) && !USE(GSTREAMER) && !USE(MEDIA_FOUNDATION)
     if (!m_fullScreenVideoController)
         return;