mfplat: Implement MFHeap[Alloc|Free].

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2019-02-22 10:36:54 +03:00 committed by Alexandre Julliard
parent 82e51117c3
commit 40af5dfdd3
4 changed files with 51 additions and 2 deletions

View file

@ -4124,3 +4124,21 @@ HRESULT WINAPI MFCreateCollection(IMFCollection **collection)
return S_OK;
}
/***********************************************************************
* MFHeapAlloc (mfplat.@)
*/
void *WINAPI MFHeapAlloc(SIZE_T size, ULONG flags, char *file, int line, EAllocationType type)
{
TRACE("%lu, %#x, %s, %d, %#x.\n", size, flags, debugstr_a(file), line, type);
return HeapAlloc(GetProcessHeap(), flags, size);
}
/***********************************************************************
* MFHeapFree (mfplat.@)
*/
void WINAPI MFHeapFree(void *p)
{
TRACE("%p\n", p);
HeapFree(GetProcessHeap(), 0, p);
}

View file

@ -103,8 +103,8 @@
@ stub MFGetUncompressedVideoFormat
@ stub MFGetWorkQueueMMCSSClass
@ stub MFGetWorkQueueMMCSSTaskId
@ stub MFHeapAlloc
@ stub MFHeapFree
@ stdcall MFHeapAlloc(long long str long long)
@ stdcall MFHeapFree(ptr)
@ stub MFInitAMMediaTypeFromMFMediaType
@ stub MFInitAttributesFromBlob
@ stub MFInitMediaTypeFromAMMediaType

View file

@ -41,6 +41,8 @@ static HRESULT (WINAPI *pMFCopyImage)(BYTE *dest, LONG deststride, const BYTE *s
static HRESULT (WINAPI *pMFCreateSourceResolver)(IMFSourceResolver **resolver);
static HRESULT (WINAPI *pMFCreateMFByteStreamOnStream)(IStream *stream, IMFByteStream **bytestream);
static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer **buffer);
static void* (WINAPI *pMFHeapAlloc)(SIZE_T size, ULONG flags, char *file, int line, EAllocationType type);
static void (WINAPI *pMFHeapFree)(void *p);
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
@ -314,6 +316,8 @@ static void init_functions(void)
X(MFCreateSourceResolver);
X(MFCreateMFByteStreamOnStream);
X(MFCreateMemoryBuffer);
X(MFHeapAlloc);
X(MFHeapFree);
#undef X
}
@ -1015,6 +1019,22 @@ static void test_MFCreateCollection(void)
IMFCollection_Release(collection);
}
static void test_MFHeapAlloc(void)
{
void *res;
if (!pMFHeapAlloc)
{
win_skip("MFHeapAlloc() is not available.\n");
return;
}
res = pMFHeapAlloc(16, 0, NULL, 0, eAllocationTypeIgnore);
ok(res != NULL, "MFHeapAlloc failed.\n");
pMFHeapFree(res);
}
START_TEST(mfplat)
{
CoInitialize(NULL);
@ -1035,6 +1055,7 @@ START_TEST(mfplat)
test_allocate_queue();
test_MFCopyImage();
test_MFCreateCollection();
test_MFHeapAlloc();
CoUninitialize();
}

View file

@ -68,6 +68,14 @@ typedef struct tagMFASYNCRESULT
HANDLE hEvent;
} MFASYNCRESULT;
typedef enum _EAllocationType
{
eAllocationTypeDynamic,
eAllocationTypeRT,
eAllocationTypePageable,
eAllocationTypeIgnore
} EAllocationType;
DEFINE_GUID(MF_MT_AVG_BITRATE, 0x20332624, 0xfb0d, 0x4d9e, 0xbd, 0x0d, 0xcb, 0xf6, 0x78, 0x6c, 0x10, 0x2e);
DEFINE_GUID(MF_MT_FRAME_RATE, 0xc459a2e8, 0x3d2c, 0x4e44, 0xb1, 0x32, 0xfe, 0xe5, 0x15, 0x6c, 0x7b, 0xb0);
DEFINE_GUID(MF_MT_FRAME_SIZE, 0x1652c33d, 0xd6b2, 0x4012, 0xb8, 0x34, 0x72, 0x03, 0x08, 0x49, 0xa3, 0x7d);
@ -94,6 +102,8 @@ HRESULT WINAPI MFCreateMediaEvent(MediaEventType type, REFGUID extended_type, HR
HRESULT WINAPI MFCreateMediaType(IMFMediaType **type);
HRESULT WINAPI MFCreateSample(IMFSample **sample);
HRESULT WINAPI MFCreateMemoryBuffer(DWORD max_length, IMFMediaBuffer **buffer);
void * WINAPI MFHeapAlloc(SIZE_T size, ULONG flags, char *file, int line, EAllocationType type);
void WINAPI MFHeapFree(void *ptr);
HRESULT WINAPI MFGetTimerPeriodicity(DWORD *periodicity);
HRESULT WINAPI MFTEnum(GUID category, UINT32 flags, MFT_REGISTER_TYPE_INFO *input_type,
MFT_REGISTER_TYPE_INFO *output_type, IMFAttributes *attributes,