Erich Hoover : quartz: Create and hold onto a preferred allocator for IAsyncReader:: RequestAllocator.

Alexandre Julliard julliard at winehq.org
Tue May 17 12:52:59 CDT 2011


Module: wine
Branch: master
Commit: 068593b23826c995f03559128041b922b68a916b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=068593b23826c995f03559128041b922b68a916b

Author: Erich Hoover <ehoover at mines.edu>
Date:   Sat May 14 11:44:59 2011 -0600

quartz: Create and hold onto a preferred allocator for IAsyncReader::RequestAllocator.

---

 dlls/quartz/pin.c |   18 +++++++++++++++++-
 dlls/quartz/pin.h |    1 +
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c
index bd5cffd..2a3b2d1 100644
--- a/dlls/quartz/pin.c
+++ b/dlls/quartz/pin.c
@@ -283,6 +283,7 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
 
         This->pReader = NULL;
         This->pAlloc = NULL;
+        This->prefAlloc = NULL;
         if (SUCCEEDED(hr))
         {
             hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
@@ -293,9 +294,19 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
             hr = This->fnPreConnect(iface, pReceivePin, &props);
         }
 
+        /*
+         * Some custom filters (such as the one used by Fallout 3
+         * and Fallout: New Vegas) expect to be passed a non-NULL
+         * preferred allocator.
+         */
         if (SUCCEEDED(hr))
         {
-            hr = IAsyncReader_RequestAllocator(This->pReader, NULL, &props, &This->pAlloc);
+            hr = StdMemAllocator_create(NULL, (LPVOID *) &This->prefAlloc);
+        }
+
+        if (SUCCEEDED(hr))
+        {
+            hr = IAsyncReader_RequestAllocator(This->pReader, This->prefAlloc, &props, &This->pAlloc);
         }
 
         if (SUCCEEDED(hr))
@@ -314,6 +325,9 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
              if (This->pReader)
                  IAsyncReader_Release(This->pReader);
              This->pReader = NULL;
+             if (This->prefAlloc)
+                 IMemAllocator_Release(This->prefAlloc);
+             This->prefAlloc = NULL;
              if (This->pAlloc)
                  IMemAllocator_Release(This->pAlloc);
              This->pAlloc = NULL;
@@ -366,6 +380,8 @@ ULONG WINAPI PullPin_Release(IPin *iface)
         WaitForSingleObject(This->hEventStateChanged, INFINITE);
         assert(!This->hThread);
 
+        if(This->prefAlloc)
+            IMemAllocator_Release(This->prefAlloc);
         if(This->pAlloc)
             IMemAllocator_Release(This->pAlloc);
         if(This->pReader)
diff --git a/dlls/quartz/pin.h b/dlls/quartz/pin.h
index 7326061..de2ccd6 100644
--- a/dlls/quartz/pin.h
+++ b/dlls/quartz/pin.h
@@ -73,6 +73,7 @@ typedef struct PullPin
 
 	REFERENCE_TIME rtStart, rtCurrent, rtNext, rtStop;
 	IAsyncReader * pReader;
+	IMemAllocator * prefAlloc;
 	IMemAllocator * pAlloc;
 	QUERYACCEPTPROC fnQueryAccept;
 	SAMPLEPROC_PULL fnSampleProc;




More information about the wine-cvs mailing list