[WinCairo] WinLauncher is not starting on Vista.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Feb 2015 22:37:09 +0000 (22:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Feb 2015 22:37:09 +0000 (22:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141905

Patch by peavo@outlook.com <peavo@outlook.com> on 2015-02-25
Reviewed by Alex Christensen.

We have to soft link with Media Foundation functions to be able
to start on Vista and WinXP.

Source/WebCore:

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::createSession):
(WebCore::MediaPlayerPrivateMediaFoundation::endSession):
(WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
(WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent):
(WebCore::MediaPlayerPrivateMediaFoundation::createTopologyFromSource):
(WebCore::MediaPlayerPrivateMediaFoundation::createOutputNode):
(WebCore::MediaPlayerPrivateMediaFoundation::createSourceStreamNode):
(WebCore::MediaPlayerPrivateMediaFoundation::onTopologySet):

WebKitLibraries:

* win/tools/vsprops/WinCairo.props: Remove Media Foundation input libraries.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
WebKitLibraries/ChangeLog
WebKitLibraries/win/tools/vsprops/WinCairo.props

index 8d40718..4d29fae 100644 (file)
@@ -1,3 +1,23 @@
+2015-02-25  peavo@outlook.com  <peavo@outlook.com>
+
+        [WinCairo] WinLauncher is not starting on Vista.
+        https://bugs.webkit.org/show_bug.cgi?id=141905
+
+        Reviewed by Alex Christensen.
+
+        We have to soft link with Media Foundation functions to be able
+        to start on Vista and WinXP.
+
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        (WebCore::MediaPlayerPrivateMediaFoundation::createSession):
+        (WebCore::MediaPlayerPrivateMediaFoundation::endSession):
+        (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
+        (WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent):
+        (WebCore::MediaPlayerPrivateMediaFoundation::createTopologyFromSource):
+        (WebCore::MediaPlayerPrivateMediaFoundation::createOutputNode):
+        (WebCore::MediaPlayerPrivateMediaFoundation::createSourceStreamNode):
+        (WebCore::MediaPlayerPrivateMediaFoundation::onTopologySet):
+
 2015-02-25  Beth Dakin  <bdakin@apple.com>
 
         REGRESSION (r180018 ): Holding a rubber-band in place can get stuck
index 6650496..8593326 100644 (file)
 #include "GraphicsContext.h"
 #include "HostWindow.h"
 #include "NotImplemented.h"
+#include "SoftLinking.h"
 
 #if USE(MEDIA_FOUNDATION)
 
 #include <wtf/MainThread.h>
 
+SOFT_LINK_LIBRARY(Mf);
+SOFT_LINK_OPTIONAL(Mf, MFCreateSourceResolver, HRESULT, STDAPICALLTYPE, (IMFSourceResolver**));
+SOFT_LINK_OPTIONAL(Mf, MFCreateMediaSession, HRESULT, STDAPICALLTYPE, (IMFAttributes*, IMFMediaSession**));
+SOFT_LINK_OPTIONAL(Mf, MFCreateTopology, HRESULT, STDAPICALLTYPE, (IMFTopology**));
+SOFT_LINK_OPTIONAL(Mf, MFCreateTopologyNode, HRESULT, STDAPICALLTYPE, (MF_TOPOLOGY_TYPE, IMFTopologyNode**));
+SOFT_LINK_OPTIONAL(Mf, MFGetService, HRESULT, STDAPICALLTYPE, (IUnknown*, REFGUID, REFIID, LPVOID*));
+SOFT_LINK_OPTIONAL(Mf, MFCreateAudioRendererActivate, HRESULT, STDAPICALLTYPE, (IMFActivate**));
+SOFT_LINK_OPTIONAL(Mf, MFCreateVideoRendererActivate, HRESULT, STDAPICALLTYPE, (HWND, IMFActivate**));
+
+SOFT_LINK_LIBRARY(Mfplat);
+SOFT_LINK_OPTIONAL(Mfplat, MFStartup, HRESULT, STDAPICALLTYPE, (ULONG, DWORD));
+SOFT_LINK_OPTIONAL(Mfplat, MFShutdown, HRESULT, STDAPICALLTYPE, ());
+
 namespace WebCore {
 
 MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation(MediaPlayer* player) 
@@ -223,10 +237,13 @@ void MediaPlayerPrivateMediaFoundation::paint(GraphicsContext* context, const In
 
 bool MediaPlayerPrivateMediaFoundation::createSession()
 {
-    if (FAILED(MFStartup(MF_VERSION, MFSTARTUP_FULL)))
+    if (!MFStartupPtr() || !MFCreateMediaSessionPtr())
         return false;
 
-    if (FAILED(MFCreateMediaSession(nullptr, &m_mediaSession)))
+    if (FAILED(MFStartupPtr()(MF_VERSION, MFSTARTUP_FULL)))
+        return false;
+
+    if (FAILED(MFCreateMediaSessionPtr()(nullptr, &m_mediaSession)))
         return false;
 
     // Get next event.
@@ -244,7 +261,10 @@ bool MediaPlayerPrivateMediaFoundation::endSession()
         m_mediaSession = nullptr;
     }
 
-    HRESULT hr = MFShutdown();
+    if (!MFShutdownPtr())
+        return false;
+
+    HRESULT hr = MFShutdownPtr()();
     ASSERT(SUCCEEDED(hr));
 
     return true;
@@ -252,7 +272,10 @@ bool MediaPlayerPrivateMediaFoundation::endSession()
 
 bool MediaPlayerPrivateMediaFoundation::startCreateMediaSource(const String& url)
 {
-    if (FAILED(MFCreateSourceResolver(&m_sourceResolver)))
+    if (!MFCreateSourceResolverPtr())
+        return false;
+
+    if (FAILED(MFCreateSourceResolverPtr()(&m_sourceResolver)))
         return false;
 
     COMPtr<IUnknown> cancelCookie;
@@ -293,6 +316,9 @@ bool MediaPlayerPrivateMediaFoundation::endGetEvent(IMFAsyncResult* asyncResult)
 {
     COMPtr<IMFMediaEvent> event;
 
+    if (!m_mediaSession)
+        return false;
+
     // Get the event from the event queue.
     HRESULT hr = m_mediaSession->EndGetEvent(asyncResult, &event);
     if (FAILED(hr))
@@ -330,8 +356,11 @@ bool MediaPlayerPrivateMediaFoundation::endGetEvent(IMFAsyncResult* asyncResult)
 
 bool MediaPlayerPrivateMediaFoundation::createTopologyFromSource()
 {
+    if (!MFCreateTopologyPtr())
+        return false;
+
     // Create a new topology.
-    if (FAILED(MFCreateTopology(&m_topology)))
+    if (FAILED(MFCreateTopologyPtr()(&m_topology)))
         return false;
 
     // Create the presentation descriptor for the media source.
@@ -450,6 +479,9 @@ void MediaPlayerPrivateMediaFoundation::destroyVideoWindow()
 
 bool MediaPlayerPrivateMediaFoundation::createOutputNode(COMPtr<IMFStreamDescriptor> sourceSD, COMPtr<IMFTopologyNode>& node)
 {
+    if (!MFCreateTopologyNodePtr() || !MFCreateAudioRendererActivatePtr() || !MFCreateVideoRendererActivatePtr())
+        return false;
+
     if (!sourceSD)
         return false;
 
@@ -468,19 +500,19 @@ bool MediaPlayerPrivateMediaFoundation::createOutputNode(COMPtr<IMFStreamDescrip
         return false;
 
     // Create a downstream node.
-    if (FAILED(MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &node)))
+    if (FAILED(MFCreateTopologyNodePtr()(MF_TOPOLOGY_OUTPUT_NODE, &node)))
         return false;
 
     // Create an IMFActivate object for the renderer, based on the media type.
     COMPtr<IMFActivate> rendererActivate;
     if (MFMediaType_Audio == guidMajorType) {
         // Create the audio renderer.
-        if (FAILED(MFCreateAudioRendererActivate(&rendererActivate)))
+        if (FAILED(MFCreateAudioRendererActivatePtr()(&rendererActivate)))
             return false;
         m_hasAudio = true;
     } else if (MFMediaType_Video == guidMajorType) {
         // Create the video renderer.
-        if (FAILED(MFCreateVideoRendererActivate(m_hwndVideo, &rendererActivate)))
+        if (FAILED(MFCreateVideoRendererActivatePtr()(m_hwndVideo, &rendererActivate)))
             return false;
         m_hasVideo = true;
     } else
@@ -495,11 +527,14 @@ bool MediaPlayerPrivateMediaFoundation::createOutputNode(COMPtr<IMFStreamDescrip
 
 bool MediaPlayerPrivateMediaFoundation::createSourceStreamNode(COMPtr<IMFStreamDescriptor> sourceSD, COMPtr<IMFTopologyNode>& node)
 {
+    if (!MFCreateTopologyNodePtr())
+        return false;
+
     if (!m_mediaSource || !m_sourcePD || !sourceSD)
         return false;
 
     // Create the source-stream node.
-    HRESULT hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &node);
+    HRESULT hr = MFCreateTopologyNodePtr()(MF_TOPOLOGY_SOURCESTREAM_NODE, &node);
     if (FAILED(hr))
         return false;
 
@@ -533,7 +568,10 @@ void MediaPlayerPrivateMediaFoundation::onCreatedMediaSource()
 
 void MediaPlayerPrivateMediaFoundation::onTopologySet()
 {
-    if (FAILED(MFGetService(m_mediaSession.get(), MR_VIDEO_RENDER_SERVICE, IID_PPV_ARGS(&m_videoDisplay))))
+    if (!MFGetServicePtr())
+        return;
+
+    if (FAILED(MFGetServicePtr()(m_mediaSession.get(), MR_VIDEO_RENDER_SERVICE, IID_PPV_ARGS(&m_videoDisplay))))
         return;
 
     ASSERT(m_videoDisplay);
index a9e1251..9a40c92 100644 (file)
@@ -1,3 +1,15 @@
+2015-02-25  peavo@outlook.com  <peavo@outlook.com>
+
+        [WinCairo] WinLauncher is not starting on Vista.
+        https://bugs.webkit.org/show_bug.cgi?id=141905
+
+        Reviewed by Alex Christensen.
+
+        We have to soft link with Media Foundation functions to be able
+        to start on Vista and WinXP.
+
+        * win/tools/vsprops/WinCairo.props: Remove Media Foundation input libraries.
+
 2015-02-03  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Unreviewed build fix. Turn on feature flags for items
index 7d998d9..505c666 100644 (file)
@@ -9,7 +9,7 @@
       <PreprocessorDefinitions>WIN_CAIRO=1;WTF_PLATFORM_WIN_CAIRO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>cairo.lib;libjpeg.lib;zdll.lib;libpng.lib;Mf.lib;Mfplat.lib;Mfuuid.lib;strmiids.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>cairo.lib;libjpeg.lib;zdll.lib;libpng.lib;Mfuuid.lib;strmiids.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>$(WebKit_Libraries)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
   </ItemDefinitionGroup>