mfplat: Forward async queue functionality to rtworkq.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-02-05 08:44:13 +03:00 committed by Alexandre Julliard
parent 0c91600efb
commit 7b87278dcf
5 changed files with 37 additions and 1072 deletions

View File

@ -1,6 +1,6 @@
MODULE = mfplat.dll MODULE = mfplat.dll
IMPORTLIB = mfplat IMPORTLIB = mfplat
IMPORTS = advapi32 ole32 mfuuid propsys IMPORTS = advapi32 ole32 mfuuid propsys rtworkq
EXTRADLLFLAGS = -mno-cygwin EXTRADLLFLAGS = -mno-cygwin

View File

@ -40,6 +40,7 @@
#include "mfreadwrite.h" #include "mfreadwrite.h"
#include "propvarutil.h" #include "propvarutil.h"
#include "strsafe.h" #include "strsafe.h"
#include "rtworkq.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
@ -64,8 +65,6 @@ static HRESULT heap_strdupW(const WCHAR *str, WCHAR **dest)
return hr; return hr;
} }
static LONG platform_lock;
struct local_handler struct local_handler
{ {
struct list entry; struct list entry;
@ -1128,10 +1127,7 @@ HRESULT WINAPI MFStartup(ULONG version, DWORD flags)
if (version != MF_VERSION_XP && version != MF_VERSION_WIN7) if (version != MF_VERSION_XP && version != MF_VERSION_WIN7)
return MF_E_BAD_STARTUP_VERSION; return MF_E_BAD_STARTUP_VERSION;
if (InterlockedIncrement(&platform_lock) == 1) RtwqStartup();
{
init_system_queues();
}
return S_OK; return S_OK;
} }
@ -1143,45 +1139,11 @@ HRESULT WINAPI MFShutdown(void)
{ {
TRACE("\n"); TRACE("\n");
if (platform_lock <= 0) RtwqShutdown();
return S_OK;
if (InterlockedExchangeAdd(&platform_lock, -1) == 1)
{
shutdown_system_queues();
}
return S_OK; return S_OK;
} }
/***********************************************************************
* MFLockPlatform (mfplat.@)
*/
HRESULT WINAPI MFLockPlatform(void)
{
InterlockedIncrement(&platform_lock);
return S_OK;
}
/***********************************************************************
* MFUnlockPlatform (mfplat.@)
*/
HRESULT WINAPI MFUnlockPlatform(void)
{
if (InterlockedDecrement(&platform_lock) == 0)
{
shutdown_system_queues();
}
return S_OK;
}
BOOL is_platform_locked(void)
{
return platform_lock > 0;
}
/*********************************************************************** /***********************************************************************
* MFCopyImage (mfplat.@) * MFCopyImage (mfplat.@)
*/ */

View File

@ -15,9 +15,9 @@
@ stub GetAMSubtypeFromD3DFormat @ stub GetAMSubtypeFromD3DFormat
@ stub GetD3DFormatFromMFSubtype @ stub GetD3DFormatFromMFSubtype
@ stub LFGetGlobalPool @ stub LFGetGlobalPool
@ stdcall MFAddPeriodicCallback(ptr ptr ptr) @ stdcall MFAddPeriodicCallback(ptr ptr ptr) rtworkq.RtwqAddPeriodicCallback
@ stdcall MFAllocateWorkQueue(ptr) @ stdcall MFAllocateWorkQueue(ptr)
@ stdcall MFAllocateWorkQueueEx(long ptr) @ stdcall MFAllocateWorkQueueEx(long ptr) rtworkq.RtwqAllocateWorkQueue
@ stub MFAppendCollection @ stub MFAppendCollection
@ stub MFAverageTimePerFrameToFrameRate @ stub MFAverageTimePerFrameToFrameRate
@ stdcall MFBeginCreateFile(long long long wstr ptr ptr ptr) @ stdcall MFBeginCreateFile(long long long wstr ptr ptr ptr)
@ -28,7 +28,7 @@
@ stub MFCalculateBitmapImageSize @ stub MFCalculateBitmapImageSize
@ stdcall MFCalculateImageSize(ptr long long ptr) @ stdcall MFCalculateImageSize(ptr long long ptr)
@ stdcall MFCancelCreateFile(ptr) @ stdcall MFCancelCreateFile(ptr)
@ stdcall MFCancelWorkItem(int64) @ stdcall MFCancelWorkItem(int64) rtworkq.RtwqCancelWorkItem
@ stdcall MFCompareFullToPartialMediaType(ptr ptr) @ stdcall MFCompareFullToPartialMediaType(ptr ptr)
@ stub MFCompareSockaddrAddresses @ stub MFCompareSockaddrAddresses
@ stub MFConvertColorInfoFromDXVA @ stub MFConvertColorInfoFromDXVA
@ -121,9 +121,9 @@
@ stub MFInitVideoFormat_RGB @ stub MFInitVideoFormat_RGB
@ stdcall MFInvokeCallback(ptr) @ stdcall MFInvokeCallback(ptr)
@ stub MFJoinIoPort @ stub MFJoinIoPort
@ stdcall MFLockPlatform() @ stdcall MFLockPlatform() rtworkq.RtwqLockPlatform
@ stdcall MFLockWorkQueue(long) @ stdcall MFLockWorkQueue(long) rtworkq.RtwqLockWorkQueue
@ stdcall MFPutWaitingWorkItem(long long ptr ptr) @ stdcall MFPutWaitingWorkItem(long long ptr ptr) rtworkq.RtwqPutWaitingWorkItem
@ stdcall MFPutWorkItem(long ptr ptr) @ stdcall MFPutWorkItem(long ptr ptr)
@ stdcall MFPutWorkItem2(long long ptr ptr) @ stdcall MFPutWorkItem2(long long ptr ptr)
@ stdcall MFPutWorkItemEx(long ptr) @ stdcall MFPutWorkItemEx(long ptr)
@ -131,7 +131,7 @@
@ stub MFRecordError @ stub MFRecordError
@ stdcall MFRegisterLocalByteStreamHandler(wstr wstr ptr) @ stdcall MFRegisterLocalByteStreamHandler(wstr wstr ptr)
@ stdcall MFRegisterLocalSchemeHandler(wstr ptr) @ stdcall MFRegisterLocalSchemeHandler(wstr ptr)
@ stdcall MFRemovePeriodicCallback(long) @ stdcall MFRemovePeriodicCallback(long) rtworkq.RtwqRemovePeriodicCallback
@ stdcall MFScheduleWorkItem(ptr ptr int64 ptr) @ stdcall MFScheduleWorkItem(ptr ptr int64 ptr)
@ stdcall MFScheduleWorkItemEx(ptr int64 ptr) @ stdcall MFScheduleWorkItemEx(ptr int64 ptr)
@ stub MFSerializeAttributesToStream @ stub MFSerializeAttributesToStream
@ -154,8 +154,8 @@
@ stub MFTraceError @ stub MFTraceError
@ stub MFTraceFuncEnter @ stub MFTraceFuncEnter
@ stub MFUnblockThread @ stub MFUnblockThread
@ stdcall MFUnlockPlatform() @ stdcall MFUnlockPlatform() rtworkq.RtwqUnlockPlatform
@ stdcall MFUnlockWorkQueue(long) @ stdcall MFUnlockWorkQueue(long) rtworkq.RtwqUnlockWorkQueue
@ stdcall MFUnwrapMediaType(ptr ptr) @ stdcall MFUnwrapMediaType(ptr ptr)
@ stub MFValidateMediaTypeSize @ stub MFValidateMediaTypeSize
@ stdcall MFWrapMediaType(ptr ptr ptr ptr) @ stdcall MFWrapMediaType(ptr ptr ptr ptr)

View File

@ -87,10 +87,6 @@ extern HRESULT attributes_GetItemByIndex(struct attributes *object, UINT32 index
PROPVARIANT *value) DECLSPEC_HIDDEN; PROPVARIANT *value) DECLSPEC_HIDDEN;
extern HRESULT attributes_CopyAllItems(struct attributes *object, IMFAttributes *dest) DECLSPEC_HIDDEN; extern HRESULT attributes_CopyAllItems(struct attributes *object, IMFAttributes *dest) DECLSPEC_HIDDEN;
extern void init_system_queues(void) DECLSPEC_HIDDEN;
extern void shutdown_system_queues(void) DECLSPEC_HIDDEN;
extern BOOL is_platform_locked(void) DECLSPEC_HIDDEN;
static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
{ {
size_t new_capacity, max_capacity; size_t new_capacity, max_capacity;

File diff suppressed because it is too large Load Diff