Signed-off-by: Sven Baars sven.wine@gmail.com --- This patch series stops Disgaea 5 from crashing. This is the first time I send any functional patches, so feel free to correct me.
dlls/mfplat/main.c | 30 +++++++++++ dlls/mfplat/mfplat.spec | 2 +- dlls/mfplat/tests/Makefile.in | 2 + dlls/mfplat/tests/mfplat.c | 98 +++++++++++++++++++++++++++++++++- dlls/mfplat/tests/resource.rc | 24 +++++++++ dlls/mfplat/tests/test.mp4 | Bin 0 -> 1554 bytes include/mfapi.h | 2 + 7 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 dlls/mfplat/tests/resource.rc create mode 100644 dlls/mfplat/tests/test.mp4
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index bd6b99f1fa..e7e7e30b3d 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -452,6 +452,8 @@ typedef struct _mfbytestream { IMFByteStream IMFByteStream_iface; LONG ref; + + IMFAttributes *attributes; } mfbytestream;
static inline mfbytestream *impl_from_IMFByteStream(IMFByteStream *iface) @@ -470,6 +472,10 @@ static HRESULT WINAPI mfbytestream_QueryInterface(IMFByteStream *iface, REFIID r { *out = &This->IMFByteStream_iface; } + else if(IsEqualGUID(riid, &IID_IMFAttributes) && This->attributes) + { + *out = This->attributes; + } else { FIXME("(%s, %p)\n", debugstr_guid(riid), out); @@ -500,6 +506,8 @@ static ULONG WINAPI mfbytestream_Release(IMFByteStream *iface)
if (!ref) { + if (This->attributes) + IUnknown_Release((IUnknown*)This->attributes); HeapFree(GetProcessHeap(), 0, This); }
@@ -681,12 +689,34 @@ HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **byt
object->ref = 1; object->IMFByteStream_iface.lpVtbl = &mfbytesteam_vtbl; + MFCreateAttributes(&object->attributes, 0); + + *bytestream = &object->IMFByteStream_iface; + + return S_OK; +} + +HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE openmode, MF_FILE_FLAGS flags, + LPCWSTR url, IMFByteStream **bytestream) +{ + mfbytestream *object; + + FIXME("(%d, %d, %d, %s, %p): stub\n", accessmode, openmode, flags, debugstr_w(url), bytestream); + + object = heap_alloc( sizeof(*object) ); + if(!object) + return E_OUTOFMEMORY; + + object->ref = 1; + object->IMFByteStream_iface.lpVtbl = &mfbytesteam_vtbl; + MFCreateAttributes(&object->attributes, 0);
*bytestream = &object->IMFByteStream_iface;
return S_OK; }
+ static HRESULT WINAPI MFPluginControl_QueryInterface(IMFPluginControl *iface, REFIID riid, void **ppv) { if(IsEqualGUID(riid, &IID_IUnknown)) { diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec index 3e42d2fd70..4533eeb71c 100644 --- a/dlls/mfplat/mfplat.spec +++ b/dlls/mfplat/mfplat.spec @@ -43,7 +43,7 @@ @ stub MFCreateAudioMediaType @ stub MFCreateCollection @ stdcall MFCreateEventQueue(ptr) -@ stub MFCreateFile +@ stdcall MFCreateFile(long long long wstr ptr) @ stub MFCreateLegacyMediaBufferOnMFMediaBuffer @ stdcall MFCreateMFByteStreamOnStream(ptr ptr) @ stub MFCreateMFVideoFormatFromMFMediaType diff --git a/dlls/mfplat/tests/Makefile.in b/dlls/mfplat/tests/Makefile.in index a5553a5af3..07cf328ad2 100644 --- a/dlls/mfplat/tests/Makefile.in +++ b/dlls/mfplat/tests/Makefile.in @@ -3,3 +3,5 @@ IMPORTS = ole32 mfplat
C_SRCS = \ mfplat.c + +RC_SRCS = resource.rc diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 17cdc46579..97fca67be6 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -49,6 +49,36 @@ DEFINE_GUID(DUMMY_CLSID, 0x12345678,0x1234,0x1234,0x12,0x13,0x14,0x15,0x16,0x17, DEFINE_GUID(DUMMY_GUID1, 0x12345678,0x1234,0x1234,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21); DEFINE_GUID(DUMMY_GUID2, 0x12345678,0x1234,0x1234,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22);
+static const WCHAR mp4file[] = {'t','e','s','t','.','m','p','4',0}; + +static WCHAR *load_resource(const WCHAR *name) +{ + static WCHAR pathW[MAX_PATH]; + DWORD written; + HANDLE file; + HRSRC res; + void *ptr; + + GetTempPathW(ARRAY_SIZE(pathW), pathW); + lstrcatW(pathW, name); + + file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, + NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", + wine_dbgstr_w(pathW), GetLastError()); + + res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA); + ok(res != 0, "couldn't find resource\n"); + ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res)); + WriteFile(file, ptr, SizeofResource(GetModuleHandleA(NULL), res), + &written, NULL); + ok(written == SizeofResource(GetModuleHandleA(NULL), res), + "couldn't write resource\n" ); + CloseHandle(file); + + return pathW; +} + static BOOL check_clsid(CLSID *clsids, UINT32 count) { int i; @@ -170,6 +200,9 @@ static void test_source_resolver(void) { IMFSourceResolver *resolver, *resolver2; HRESULT hr; + WCHAR *filename; + + static const WCHAR file_type[] = {'v','i','d','e','o','/','m','p','4',0};
if (!pMFCreateSourceResolver) { @@ -177,6 +210,12 @@ static void test_source_resolver(void) return; }
+ hr = MFStartup(MAKELONG( MF_API_VERSION, 0xdead ), MFSTARTUP_FULL); + ok(hr == MF_E_BAD_STARTUP_VERSION, "got 0x%08x\n", hr); + + hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = pMFCreateSourceResolver(NULL); ok(hr == E_POINTER, "got %#x\n", hr);
@@ -258,7 +297,9 @@ static void test_MFCreateAttributes(void) static void test_MFCreateMFByteStreamOnStream(void) { IMFByteStream *bytestream; + IMFByteStream *bytestream2; IStream *stream; + IMFAttributes *attributes; HRESULT hr;
if(!pMFCreateMFByteStreamOnStream) @@ -270,13 +311,67 @@ static void test_MFCreateMFByteStreamOnStream(void) hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = pMFCreateMFByteStreamOnStream(stream, &bytestream ); + hr = pMFCreateMFByteStreamOnStream(stream, &bytestream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IUnknown_QueryInterface(bytestream, &IID_IMFAttributes, + (void **)&attributes); + ok(hr == S_OK || + /* w7pro64 */ + broken(hr == E_NOINTERFACE), "got 0x%08x\n", hr); + ok((void *)attributes != (void *)bytestream, "got %p\n", bytestream); + + if (hr == S_OK) + IMFAttributes_Release(attributes); + + hr = IUnknown_QueryInterface(bytestream, &IID_IMFByteStream, + (void **)&bytestream2); ok(hr == S_OK, "got 0x%08x\n", hr); + ok(bytestream == bytestream2, "got %p\n", bytestream2);
IStream_Release(stream); IMFByteStream_Release(bytestream); }
+static void test_MFCreateFile(void) +{ + IMFByteStream *bytestream; + IMFByteStream *bytestream2; + IMFAttributes *attributes; + HRESULT hr; + WCHAR *filename; + + filename = load_resource(mp4file); + + hr = MFStartup(MAKELONG( MF_API_VERSION, 0xdead ), MFSTARTUP_FULL); + ok(hr == MF_E_BAD_STARTUP_VERSION, "got 0x%08x\n", hr); + + hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, + MF_FILEFLAGS_NONE, filename, &bytestream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IUnknown_QueryInterface(bytestream, &IID_IMFAttributes, + (void **)&attributes); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok((void *)attributes != (void *)bytestream, "got %p\n", bytestream); + + hr = IUnknown_QueryInterface(bytestream, &IID_IMFByteStream, + (void **)&bytestream2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(bytestream == bytestream2, "got %p\n", bytestream2); + + IMFAttributes_Release(attributes); + IMFByteStream_Release(bytestream2); + IMFByteStream_Release(bytestream); + + MFShutdown(); + + DeleteFileW(filename); +} + static void test_MFCreateMemoryBuffer(void) { IMFMediaBuffer *buffer; @@ -390,6 +485,7 @@ START_TEST(mfplat) test_MFCreateMediaType(); test_MFCreateAttributes(); test_MFSample(); + test_MFCreateFile(); test_MFCreateMFByteStreamOnStream(); test_MFCreateMemoryBuffer();
diff --git a/dlls/mfplat/tests/resource.rc b/dlls/mfplat/tests/resource.rc new file mode 100644 index 0000000000..e9bf920c31 --- /dev/null +++ b/dlls/mfplat/tests/resource.rc @@ -0,0 +1,24 @@ +/* + * Resources for mfplat test suite. + * + * Copyright 2018 Sven Baars + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windef.h" + +/* @makedep: test.mp4 */ +test.mp4 RCDATA test.mp4 diff --git a/dlls/mfplat/tests/test.mp4 b/dlls/mfplat/tests/test.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..a5bbca6bbf7692eab047050b79b8ccc83516e6b4 GIT binary patch literal 1554 zcmZuxeN0nV6u<3bttg}g3M<<3v4A5C7=;cYskS&=aH+Gw(TQ=|2k#+BpKbac6$q26 zgvfMZE^O--6L1NclR1flh8QLw4%rM5#eGC{R2Jv(j|s9(8MANazOwnmo#gk<x#yhw zyZ4@R-$e*%%DGx+CF@`ik|L}DS&UP!LkKM^chNNX_cIj9Atd<{DdnJiN*lZEK&*TH zLUnilE|&Pi#`t<(V2JeCh0xUFbE~$JpP!3QD)e^to@B05Kdu~jt~KuYz}1=h$wy;^ z-(P&iYuL#r*6qMlmYD;w&8gboiuVmim)E`@VY(w}d_`I2ihOP3>WzsJPV$oN<)LWX zeE-6+iWMz`xA<B45szMa^nqwQ5w>wzrc-v;{3ns3&Hgygab@co_v%sWh^~kxZdgv1 zG$e27=y&X0FwfM)&vJ1wQfF>hX5`>p!|hca@<xwAt#6-gnD>;lG>BPmWrt3nUp`73 z+Yr|+TbnzS=UsV1v;C6gviW|rw)-!S-=bHn;0v1+QGDC}Ia|1D&?ob%jF`h$Wc#Ew zV;vf3`obS*$vM<kEDwCQ`|#nw>4L6xr#4wnKY06wGT*}wdIn7LW=}zVn#?n%4mVMz zS*QG<-xMcs%$)a1n<6jX{=IjfF~joa!xMeyYRwY|Cr0Vm>*3w%uu#*`=0;_WapAn$ zU<`El@AbuA79AjpWMkq|c1;#tZJ#~+J(2cx>Nm%BvdmP*5AP|wGW~$TESZLVhn6a1 ztO^C+GL%><v}DW7eXsQJ-HUG|I!ZcwqEv0#Ya@m<t5KG7N5rlo$2IYtr*eGsbj8h0 z?c@jJ8?GH6PW~!_$shUIcJraKf^47ff8>qKKRQs;^7r5rKP{`hCoZsRD*LTIOV>}^ zv}Z#0Dsy%(f4!(s5zT+wRX-W1@{bU&DxT$gcYNB95Wz4GhZ`=WopD!CphZIb3Y&Tt zN#HB;J~@EE6G4Pb;@qcgDO~ywITu+4q3v9iuqGi&TV#WEm&%fL{&(FFn1q2)5>0U| zXbo*=;Rh207#4X2E~$c{DoKbWFx1ksXMtOViZ2NB(km#tOR(VMuB70{eJoZOI||7? zl%2*olCw<Zo^mi$Zbl##Z##(!#x#_R#yMDUJgnMfPYBwQI+iQ7gFVc0?7t1cIX-wf zaHFt@IfI@MICdeJ7+9Xp2>Ks?)jSUa8_iO<Oo;G!Jey%!2<ZHT2<$>SD4dRa20SkU zV;68rdYYqx<dOt*;hjTh6eXe7GH{(SlkT#Yax=1Y8M;ip4CY9n)kw{9LK`q0-qUjY z7J{U}>4bH`mH}`KUjy7ccnDD_0CJHA@_=3toU_OwXamIR7Gqf9{35_wfE7@%h&<3n zKs;bQARC}!xiSZ6ESNJ5P+CoKB<O7nEod-NqPX>NU0kHoiM#Wkq*n&-SMq0^0~2cD TJ;x-N6hTeOp(eUDP!ruh^$B~#
literal 0 HcmV?d00001
diff --git a/include/mfapi.h b/include/mfapi.h index bc832bf95f..0230a08471 100644 --- a/include/mfapi.h +++ b/include/mfapi.h @@ -67,6 +67,8 @@ HRESULT WINAPI MFCancelWorkItem(MFWORKITEM_KEY key); HRESULT WINAPI MFCopyImage(BYTE *dest, LONG deststride, const BYTE *src, LONG srcstride, DWORD width, DWORD lines); HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size); HRESULT WINAPI MFCreateEventQueue(IMFMediaEventQueue **queue); +HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE openmode, MF_FILE_FLAGS flags, + LPCWSTR url, IMFByteStream **bytestream); HRESULT WINAPI MFCreateMediaType(IMFMediaType **type); HRESULT WINAPI MFCreateSample(IMFSample **sample); HRESULT WINAPI MFCreateMemoryBuffer(DWORD max_length, IMFMediaBuffer **buffer);
Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/mfplat/main.c | 184 +++++++++++++++++++++++++++++++++++++ dlls/mfplat/tests/mfplat.c | 37 +++++++- include/mfidl.idl | 47 ++++++++++ 3 files changed, 266 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index e7e7e30b3d..3affc885cf 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -1208,6 +1208,174 @@ HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size) return S_OK; }
+typedef struct _mfsource +{ + IMFMediaSource IMFMediaSource_iface; + LONG ref; +} mfsource; + +static inline mfsource *impl_from_IMFMediaSource(IMFMediaSource *iface) +{ + return CONTAINING_RECORD(iface, mfsource, IMFMediaSource_iface); +} + +static HRESULT WINAPI mfsource_QueryInterface(IMFMediaSource *iface, REFIID riid, void **out) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out); + + if (IsEqualIID(riid, &IID_IMFMediaSource) || + IsEqualIID(riid, &IID_IMFMediaEventGenerator) || + IsEqualIID(riid, &IID_IUnknown)) + { + *out = &This->IMFMediaSource_iface; + } + else + { + FIXME("(%s, %p)\n", debugstr_guid(riid), out); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*out); + return S_OK; +} + +static ULONG WINAPI mfsource_AddRef(IMFMediaSource *iface) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%u\n", This, ref); + + return ref; +} + +static ULONG WINAPI mfsource_Release(IMFMediaSource *iface) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%u\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI mfsource_GetEvent(IMFMediaSource *iface, DWORD flags, IMFMediaEvent **event) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p)->(%#x, %p)\n", This, flags, event); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_BeginGetEvent(IMFMediaSource *iface, IMFAsyncCallback *callback, IUnknown *state) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p)->(%p, %p)\n", This, callback, state); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_EndGetEvent(IMFMediaSource *iface, IMFAsyncResult *result, IMFMediaEvent **event) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p)->(%p, %p)\n", This, result, event); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_QueueEvent(IMFMediaSource *iface, MediaEventType event_type, REFGUID ext_type, + HRESULT hr, const PROPVARIANT *value) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p)->(%d, %s, %#x, %p)\n", This, event_type, debugstr_guid(ext_type), hr, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_GetCharacteristics(IMFMediaSource *iface, DWORD *characteristics) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p)->(%p): stub\n", This, characteristics); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **descriptor) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p)->(%p): stub\n", This, descriptor); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_Start(IMFMediaSource *iface, IMFPresentationDescriptor *descriptor, + const GUID *time_format, const PROPVARIANT *start_position) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p)->(%p, %p, %p): stub\n", This, descriptor, time_format, start_position); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_Stop(IMFMediaSource *iface) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p): stub\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_Pause(IMFMediaSource *iface) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p): stub\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfsource_Shutdown(IMFMediaSource *iface) +{ + mfsource *This = impl_from_IMFMediaSource(iface); + + FIXME("(%p): stub\n", This); + + return S_OK; +} + +static const IMFMediaSourceVtbl mfsourcevtbl = +{ + mfsource_QueryInterface, + mfsource_AddRef, + mfsource_Release, + mfsource_GetEvent, + mfsource_BeginGetEvent, + mfsource_EndGetEvent, + mfsource_QueueEvent, + mfsource_GetCharacteristics, + mfsource_CreatePresentationDescriptor, + mfsource_Start, + mfsource_Stop, + mfsource_Pause, + mfsource_Shutdown, +}; + typedef struct _mfsourceresolver { IMFSourceResolver IMFSourceResolver_iface; @@ -1281,6 +1449,22 @@ static HRESULT WINAPI mfsourceresolver_CreateObjectFromByteStream(IMFSourceResol
FIXME("(%p)->(%p, %s, %#x, %p, %p, %p): stub\n", This, stream, debugstr_w(url), flags, props, obj_type, object);
+ if (flags & MF_RESOLUTION_MEDIASOURCE) + { + mfsource *new_object; + + new_object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) ); + if (!new_object) + return E_OUTOFMEMORY; + + new_object->IMFMediaSource_iface.lpVtbl = &mfsourcevtbl; + new_object->ref = 1; + + *object = (IUnknown *)&new_object->IMFMediaSource_iface; + *obj_type = MF_OBJECT_MEDIASOURCE; + return S_OK; + } + return E_NOTIMPL; }
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 97fca67be6..64f95d5aec 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -40,6 +40,7 @@ static HRESULT (WINAPI *pMFCreateSourceResolver)(IMFSourceResolver **resolver); static HRESULT (WINAPI *pMFCreateMFByteStreamOnStream)(IStream *stream, IMFByteStream **bytestream); static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer **buffer);
+DEFINE_GUID(MF_BYTESTREAM_CONTENT_TYPE, 0xfc358289,0x3cb6,0x460c,0xa4,0x24,0xb6,0x68,0x12,0x60,0x37,0x5a);
DEFINE_GUID(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 0xa634a91c, 0x822b, 0x41b9, 0xa4, 0x94, 0x4d, 0xe4, 0x64, 0x36, 0x12, 0xb0);
@@ -199,6 +200,10 @@ if(0) static void test_source_resolver(void) { IMFSourceResolver *resolver, *resolver2; + IMFByteStream *bytestream; + IMFAttributes *attributes; + IMFMediaSource *mediasource; + MF_OBJECT_TYPE obj_type; HRESULT hr; WCHAR *filename;
@@ -226,8 +231,36 @@ static void test_source_resolver(void) ok(hr == S_OK, "got %#x\n", hr); ok(resolver != resolver2, "Expected new instance\n");
- IMFSourceResolver_Release(resolver); IMFSourceResolver_Release(resolver2); + + filename = load_resource(mp4file); + + hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, + MF_FILEFLAGS_NONE, filename, &bytestream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IUnknown_QueryInterface(bytestream, &IID_IMFAttributes, + (void **)&attributes); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IMFAttributes_SetString(attributes, &MF_BYTESTREAM_CONTENT_TYPE, file_type); + todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IMFSourceResolver_CreateObjectFromByteStream( + resolver, bytestream, NULL, MF_RESOLUTION_MEDIASOURCE, NULL, + &obj_type, (IUnknown **)&mediasource); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(mediasource != NULL, "got %p\n", mediasource); + ok(obj_type == MF_OBJECT_MEDIASOURCE, "got %d\n", obj_type); + + IMFMediaSource_Release(mediasource); + IMFAttributes_Release(attributes); + IMFByteStream_Release(bytestream); + + IMFSourceResolver_Release(resolver); + + MFShutdown(); + + DeleteFileW(filename); }
static void init_functions(void) @@ -481,13 +514,13 @@ START_TEST(mfplat) init_functions();
test_register(); - test_source_resolver(); test_MFCreateMediaType(); test_MFCreateAttributes(); test_MFSample(); test_MFCreateFile(); test_MFCreateMFByteStreamOnStream(); test_MFCreateMemoryBuffer(); + test_source_resolver();
CoUninitialize(); } diff --git a/include/mfidl.idl b/include/mfidl.idl index 84be055d09..ac5acc50f5 100644 --- a/include/mfidl.idl +++ b/include/mfidl.idl @@ -212,6 +212,53 @@ interface IMFStreamDescriptor : IMFAttributes HRESULT GetMediaTypeHandler([out] IMFMediaTypeHandler **handler); }
+[ + object, + uuid(03cb2711-24d7-4db6-a17f-f3a7a479a536), +] +interface IMFPresentationDescriptor : IMFAttributes +{ + HRESULT GetStreamDescriptorCount([out] DWORD *pdwDescriptorCount); + HRESULT GetStreamDescriptorByIndex([in] DWORD dwIndex, [out] BOOL *pfSelected, [out] IMFStreamDescriptor **ppDescriptor); + HRESULT SelectStream([in] DWORD dwDescriptorIndex); + HRESULT DeselectStream([in] DWORD dwDescriptorIndex); + HRESULT Clone([out] IMFPresentationDescriptor **ppPresentationDescriptor); +} + +[ + object, + uuid(279a808d-aec7-40c8-9c6b-a6b492c78a66), +] +interface IMFMediaSource : IMFMediaEventGenerator +{ + HRESULT GetCharacteristics([out] DWORD *pdwCharacteristics); + + [local] + HRESULT CreatePresentationDescriptor([out] IMFPresentationDescriptor **ppPresentationDescriptor); + [call_as(CreatePresentationDescriptor)] + HRESULT RemoteCreatePresentationDescriptor( + [out] DWORD *pcbPD, + [out, size_is(,*pcbPD)] BYTE **pbPD, + [out] IMFPresentationDescriptor **ppRemotePD); + + HRESULT Start( + [in] IMFPresentationDescriptor *pPresentationDescriptor, + [in, unique] const GUID *pguidTimeFormat, + [in, unique] const PROPVARIANT *pvarStartPosition); + + HRESULT Stop(); + HRESULT Pause(); + HRESULT Shutdown(); +} + +cpp_quote("#define MF_RESOLUTION_MEDIASOURCE 0x00000001") +cpp_quote("#define MF_RESOLUTION_BYTESTREAM 0x00000002") +cpp_quote("#define MF_RESOLUTION_CONTENT_DOES_NOT_HAVE_TO_MATCH_EXTENSION_OR_MIME_TYPE 0x00000010") +cpp_quote("#define MF_RESOLUTION_KEEP_BYTE_STREAM_ALIVE_ON_FAIL 0x00000020") +cpp_quote("#define MF_RESOLUTION_READ 0x00010000") +cpp_quote("#define MF_RESOLUTION_WRITE 0x00020000") +cpp_quote("#define MF_RESOLUTION_DISABLE_LOCAL_PLUGINS 0x00000040") + [ object, uuid(f6696e82-74f7-4f3d-a178-8a5e09c3659f)
Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/mfplat/main.c | 347 ++++++++++++++++++++++++++++++++++++- dlls/mfplat/tests/mfplat.c | 7 + 2 files changed, 353 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 3affc885cf..eabcb38558 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -1208,6 +1208,340 @@ HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size) return S_OK; }
+typedef struct _mfpresentationdescriptor +{ + mfattributes attributes; + IMFPresentationDescriptor IMFPresentationDescriptor_iface; +} mfpresentationdescriptor; + +static inline mfpresentationdescriptor *impl_from_IMFPresentationDescriptor(IMFPresentationDescriptor *iface) +{ + return CONTAINING_RECORD(iface, mfpresentationdescriptor, IMFPresentationDescriptor_iface); +} + +static HRESULT WINAPI mfpresentationdescriptor_QueryInterface(IMFPresentationDescriptor *iface, REFIID riid, void **out) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out); + + if(IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IMFAttributes) || + IsEqualGUID(riid, &IID_IMFPresentationDescriptor)) + { + *out = &This->IMFPresentationDescriptor_iface; + } + else + { + FIXME("(%s, %p)\n", debugstr_guid(riid), out); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*out); + return S_OK; +} + +static ULONG WINAPI mfpresentationdescriptor_AddRef(IMFPresentationDescriptor *iface) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + ULONG ref = InterlockedIncrement(&This->attributes.ref); + + TRACE("(%p) ref=%u\n", This, ref); + + return ref; +} + +static ULONG WINAPI mfpresentationdescriptor_Release(IMFPresentationDescriptor *iface) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + ULONG ref = InterlockedDecrement(&This->attributes.ref); + + TRACE("(%p) ref=%u\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI mfpresentationdescriptor_GetItem(IMFPresentationDescriptor *iface, REFGUID key, PROPVARIANT *value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetItem(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetItemType(IMFPresentationDescriptor *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetItemType(&This->attributes.IMFAttributes_iface, key, type); +} + +static HRESULT WINAPI mfpresentationdescriptor_CompareItem(IMFPresentationDescriptor *iface, REFGUID key, REFPROPVARIANT value, BOOL *result) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_CompareItem(&This->attributes.IMFAttributes_iface, key, value, result); +} + +static HRESULT WINAPI mfpresentationdescriptor_Compare(IMFPresentationDescriptor *iface, IMFAttributes *attrs, MF_ATTRIBUTES_MATCH_TYPE type, + BOOL *result) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_Compare(&This->attributes.IMFAttributes_iface, attrs, type, result); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetUINT32(IMFPresentationDescriptor *iface, REFGUID key, UINT32 *value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetUINT32(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetUINT64(IMFPresentationDescriptor *iface, REFGUID key, UINT64 *value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetUINT64(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetDouble(IMFPresentationDescriptor *iface, REFGUID key, double *value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetDouble(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetGUID(IMFPresentationDescriptor *iface, REFGUID key, GUID *value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetGUID(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetStringLength(IMFPresentationDescriptor *iface, REFGUID key, UINT32 *length) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetStringLength(&This->attributes.IMFAttributes_iface, key, length); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetString(IMFPresentationDescriptor *iface, REFGUID key, WCHAR *value, + UINT32 size, UINT32 *length) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetString(&This->attributes.IMFAttributes_iface, key, value, size, length); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetAllocatedString(IMFPresentationDescriptor *iface, REFGUID key, + WCHAR **value, UINT32 *length) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetAllocatedString(&This->attributes.IMFAttributes_iface, key, value, length); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetBlobSize(IMFPresentationDescriptor *iface, REFGUID key, UINT32 *size) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetBlobSize(&This->attributes.IMFAttributes_iface, key, size); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetBlob(IMFPresentationDescriptor *iface, REFGUID key, UINT8 *buf, + UINT32 bufsize, UINT32 *blobsize) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetBlob(&This->attributes.IMFAttributes_iface, key, buf, bufsize, blobsize); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetAllocatedBlob(IMFPresentationDescriptor *iface, REFGUID key, UINT8 **buf, UINT32 *size) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetAllocatedBlob(&This->attributes.IMFAttributes_iface, key, buf, size); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetUnknown(IMFPresentationDescriptor *iface, REFGUID key, REFIID riid, void **ppv) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetUnknown(&This->attributes.IMFAttributes_iface, key, riid, ppv); +} + +static HRESULT WINAPI mfpresentationdescriptor_SetItem(IMFPresentationDescriptor *iface, REFGUID key, REFPROPVARIANT value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_SetItem(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_DeleteItem(IMFPresentationDescriptor *iface, REFGUID key) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_DeleteItem(&This->attributes.IMFAttributes_iface, key); +} + +static HRESULT WINAPI mfpresentationdescriptor_DeleteAllItems(IMFPresentationDescriptor *iface) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_DeleteAllItems(&This->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mfpresentationdescriptor_SetUINT32(IMFPresentationDescriptor *iface, REFGUID key, UINT32 value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_SetUINT32(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_SetUINT64(IMFPresentationDescriptor *iface, REFGUID key, UINT64 value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_SetUINT64(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_SetDouble(IMFPresentationDescriptor *iface, REFGUID key, double value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_SetDouble(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_SetGUID(IMFPresentationDescriptor *iface, REFGUID key, REFGUID value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_SetGUID(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_SetString(IMFPresentationDescriptor *iface, REFGUID key, const WCHAR *value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_SetString(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_SetBlob(IMFPresentationDescriptor *iface, REFGUID key, const UINT8 *buf, UINT32 size) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_SetBlob(&This->attributes.IMFAttributes_iface, key, buf, size); +} + +static HRESULT WINAPI mfpresentationdescriptor_SetUnknown(IMFPresentationDescriptor *iface, REFGUID key, IUnknown *unknown) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_SetUnknown(&This->attributes.IMFAttributes_iface, key, unknown); +} + +static HRESULT WINAPI mfpresentationdescriptor_LockStore(IMFPresentationDescriptor *iface) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_LockStore(&This->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mfpresentationdescriptor_UnlockStore(IMFPresentationDescriptor *iface) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_UnlockStore(&This->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetCount(IMFPresentationDescriptor *iface, UINT32 *items) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetCount(&This->attributes.IMFAttributes_iface, items); +} + +static HRESULT WINAPI mfpresentationdescriptor_GetItemByIndex(IMFPresentationDescriptor *iface, UINT32 index, GUID *key, PROPVARIANT *value) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + return IMFAttributes_GetItemByIndex(&This->attributes.IMFAttributes_iface, index, key, value); +} + +static HRESULT WINAPI mfpresentationdescriptor_CopyAllItems(IMFPresentationDescriptor *iface, IMFAttributes *dest) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + + FIXME("%p, %p\n", This, dest); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfpresentationdescriptor_GetStreamDescriptorCount(IMFPresentationDescriptor *iface, DWORD *descriptor_count) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + + FIXME("%p, %p\n", This, descriptor_count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfpresentationdescriptor_GetStreamDescriptorByIndex(IMFPresentationDescriptor *iface, DWORD index, + BOOL *selected, IMFStreamDescriptor **descriptor) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + + FIXME("%p, %#x, %p, %p\n", This, index, selected, descriptor); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfpresentationdescriptor_SelectStream(IMFPresentationDescriptor *iface, DWORD index) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + + FIXME("%p, %#x\n", This, index); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfpresentationdescriptor_DeselectStream(IMFPresentationDescriptor *iface, DWORD index) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + + FIXME("%p, %#x\n", This, index); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfpresentationdescriptor_Clone(IMFPresentationDescriptor *iface, IMFPresentationDescriptor **descriptor) +{ + mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface); + + FIXME("%p, %p\n", This, descriptor); + + return E_NOTIMPL; +} + +static const IMFPresentationDescriptorVtbl mfpresentationdescriptor_vtbl = +{ + mfpresentationdescriptor_QueryInterface, + mfpresentationdescriptor_AddRef, + mfpresentationdescriptor_Release, + mfpresentationdescriptor_GetItem, + mfpresentationdescriptor_GetItemType, + mfpresentationdescriptor_CompareItem, + mfpresentationdescriptor_Compare, + mfpresentationdescriptor_GetUINT32, + mfpresentationdescriptor_GetUINT64, + mfpresentationdescriptor_GetDouble, + mfpresentationdescriptor_GetGUID, + mfpresentationdescriptor_GetStringLength, + mfpresentationdescriptor_GetString, + mfpresentationdescriptor_GetAllocatedString, + mfpresentationdescriptor_GetBlobSize, + mfpresentationdescriptor_GetBlob, + mfpresentationdescriptor_GetAllocatedBlob, + mfpresentationdescriptor_GetUnknown, + mfpresentationdescriptor_SetItem, + mfpresentationdescriptor_DeleteItem, + mfpresentationdescriptor_DeleteAllItems, + mfpresentationdescriptor_SetUINT32, + mfpresentationdescriptor_SetUINT64, + mfpresentationdescriptor_SetDouble, + mfpresentationdescriptor_SetGUID, + mfpresentationdescriptor_SetString, + mfpresentationdescriptor_SetBlob, + mfpresentationdescriptor_SetUnknown, + mfpresentationdescriptor_LockStore, + mfpresentationdescriptor_UnlockStore, + mfpresentationdescriptor_GetCount, + mfpresentationdescriptor_GetItemByIndex, + mfpresentationdescriptor_CopyAllItems, + mfpresentationdescriptor_GetStreamDescriptorCount, + mfpresentationdescriptor_GetStreamDescriptorByIndex, + mfpresentationdescriptor_SelectStream, + mfpresentationdescriptor_DeselectStream, + mfpresentationdescriptor_Clone, +}; + typedef struct _mfsource { IMFMediaSource IMFMediaSource_iface; @@ -1317,9 +1651,20 @@ static HRESULT WINAPI mfsource_CreatePresentationDescriptor(IMFMediaSource *ifac { mfsource *This = impl_from_IMFMediaSource(iface);
+ mfpresentationdescriptor *object; + FIXME("(%p)->(%p): stub\n", This, descriptor);
- return E_NOTIMPL; + object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) ); + if (!object) + return E_OUTOFMEMORY; + + init_attribute_object(&object->attributes, 0); + object->IMFPresentationDescriptor_iface.lpVtbl = &mfpresentationdescriptor_vtbl; + + *descriptor = &object->IMFPresentationDescriptor_iface; + return S_OK; + }
static HRESULT WINAPI mfsource_Start(IMFMediaSource *iface, IMFPresentationDescriptor *descriptor, diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 64f95d5aec..c507338cf0 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -203,6 +203,7 @@ static void test_source_resolver(void) IMFByteStream *bytestream; IMFAttributes *attributes; IMFMediaSource *mediasource; + IMFPresentationDescriptor *presentation_descriptor; MF_OBJECT_TYPE obj_type; HRESULT hr; WCHAR *filename; @@ -252,6 +253,12 @@ static void test_source_resolver(void) ok(mediasource != NULL, "got %p\n", mediasource); ok(obj_type == MF_OBJECT_MEDIASOURCE, "got %d\n", obj_type);
+ hr = IMFMediaSource_CreatePresentationDescriptor( + mediasource, &presentation_descriptor); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(presentation_descriptor != NULL, "got %p\n", presentation_descriptor); + + IMFPresentationDescriptor_Release(presentation_descriptor); IMFMediaSource_Release(mediasource); IMFAttributes_Release(attributes); IMFByteStream_Release(bytestream);
Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/mfplat/main.c | 361 +++++++++++++++++++++++++++++++++++++ dlls/mfplat/mfplat.spec | 2 +- dlls/mfplat/tests/mfplat.c | 59 ++++++ include/mfapi.h | 2 + include/mfobjects.idl | 103 +++++++++++ 5 files changed, 526 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index eabcb38558..41e4cd873f 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -2259,6 +2259,367 @@ HRESULT WINAPI MFCreateMediaType(IMFMediaType **type) return S_OK; }
+typedef struct _mfmediaevent +{ + mfattributes attributes; + IMFMediaEvent IMFMediaEvent_iface; + + MediaEventType type; + GUID extended_type; + HRESULT status; + PROPVARIANT value; +} mfmediaevent; + +static inline mfmediaevent *impl_from_IMFMediaEvent(IMFMediaEvent *iface) +{ + return CONTAINING_RECORD(iface, mfmediaevent, IMFMediaEvent_iface); +} + +static HRESULT WINAPI mfmediaevent_QueryInterface(IMFMediaEvent *iface, REFIID riid, void **out) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out); + + if(IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IMFAttributes) || + IsEqualGUID(riid, &IID_IMFMediaEvent)) + { + *out = &This->IMFMediaEvent_iface; + } + else + { + FIXME("(%s, %p)\n", debugstr_guid(riid), out); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*out); + return S_OK; +} + +static ULONG WINAPI mfmediaevent_AddRef(IMFMediaEvent *iface) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + ULONG ref = InterlockedIncrement(&This->attributes.ref); + + TRACE("(%p) ref=%u\n", This, ref); + + return ref; +} + +static ULONG WINAPI mfmediaevent_Release(IMFMediaEvent *iface) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + ULONG ref = InterlockedDecrement(&This->attributes.ref); + + TRACE("(%p) ref=%u\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI mfmediaevent_GetItem(IMFMediaEvent *iface, REFGUID key, PROPVARIANT *value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetItem(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_GetItemType(IMFMediaEvent *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetItemType(&This->attributes.IMFAttributes_iface, key, type); +} + +static HRESULT WINAPI mfmediaevent_CompareItem(IMFMediaEvent *iface, REFGUID key, REFPROPVARIANT value, BOOL *result) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_CompareItem(&This->attributes.IMFAttributes_iface, key, value, result); +} + +static HRESULT WINAPI mfmediaevent_Compare(IMFMediaEvent *iface, IMFAttributes *attrs, MF_ATTRIBUTES_MATCH_TYPE type, + BOOL *result) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_Compare(&This->attributes.IMFAttributes_iface, attrs, type, result); +} + +static HRESULT WINAPI mfmediaevent_GetUINT32(IMFMediaEvent *iface, REFGUID key, UINT32 *value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetUINT32(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_GetUINT64(IMFMediaEvent *iface, REFGUID key, UINT64 *value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetUINT64(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_GetDouble(IMFMediaEvent *iface, REFGUID key, double *value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetDouble(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_GetGUID(IMFMediaEvent *iface, REFGUID key, GUID *value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetGUID(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_GetStringLength(IMFMediaEvent *iface, REFGUID key, UINT32 *length) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetStringLength(&This->attributes.IMFAttributes_iface, key, length); +} + +static HRESULT WINAPI mfmediaevent_GetString(IMFMediaEvent *iface, REFGUID key, WCHAR *value, + UINT32 size, UINT32 *length) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetString(&This->attributes.IMFAttributes_iface, key, value, size, length); +} + +static HRESULT WINAPI mfmediaevent_GetAllocatedString(IMFMediaEvent *iface, REFGUID key, + WCHAR **value, UINT32 *length) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetAllocatedString(&This->attributes.IMFAttributes_iface, key, value, length); +} + +static HRESULT WINAPI mfmediaevent_GetBlobSize(IMFMediaEvent *iface, REFGUID key, UINT32 *size) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetBlobSize(&This->attributes.IMFAttributes_iface, key, size); +} + +static HRESULT WINAPI mfmediaevent_GetBlob(IMFMediaEvent *iface, REFGUID key, UINT8 *buf, + UINT32 bufsize, UINT32 *blobsize) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetBlob(&This->attributes.IMFAttributes_iface, key, buf, bufsize, blobsize); +} + +static HRESULT WINAPI mfmediaevent_GetAllocatedBlob(IMFMediaEvent *iface, REFGUID key, UINT8 **buf, UINT32 *size) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetAllocatedBlob(&This->attributes.IMFAttributes_iface, key, buf, size); +} + +static HRESULT WINAPI mfmediaevent_GetUnknown(IMFMediaEvent *iface, REFGUID key, REFIID riid, void **ppv) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetUnknown(&This->attributes.IMFAttributes_iface, key, riid, ppv); +} + +static HRESULT WINAPI mfmediaevent_SetItem(IMFMediaEvent *iface, REFGUID key, REFPROPVARIANT value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_SetItem(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_DeleteItem(IMFMediaEvent *iface, REFGUID key) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_DeleteItem(&This->attributes.IMFAttributes_iface, key); +} + +static HRESULT WINAPI mfmediaevent_DeleteAllItems(IMFMediaEvent *iface) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_DeleteAllItems(&This->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mfmediaevent_SetUINT32(IMFMediaEvent *iface, REFGUID key, UINT32 value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_SetUINT32(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_SetUINT64(IMFMediaEvent *iface, REFGUID key, UINT64 value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_SetUINT64(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_SetDouble(IMFMediaEvent *iface, REFGUID key, double value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_SetDouble(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_SetGUID(IMFMediaEvent *iface, REFGUID key, REFGUID value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_SetGUID(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_SetString(IMFMediaEvent *iface, REFGUID key, const WCHAR *value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_SetString(&This->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mfmediaevent_SetBlob(IMFMediaEvent *iface, REFGUID key, const UINT8 *buf, UINT32 size) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_SetBlob(&This->attributes.IMFAttributes_iface, key, buf, size); +} + +static HRESULT WINAPI mfmediaevent_SetUnknown(IMFMediaEvent *iface, REFGUID key, IUnknown *unknown) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_SetUnknown(&This->attributes.IMFAttributes_iface, key, unknown); +} + +static HRESULT WINAPI mfmediaevent_LockStore(IMFMediaEvent *iface) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_LockStore(&This->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mfmediaevent_UnlockStore(IMFMediaEvent *iface) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_UnlockStore(&This->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mfmediaevent_GetCount(IMFMediaEvent *iface, UINT32 *items) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetCount(&This->attributes.IMFAttributes_iface, items); +} + +static HRESULT WINAPI mfmediaevent_GetItemByIndex(IMFMediaEvent *iface, UINT32 index, GUID *key, PROPVARIANT *value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + return IMFAttributes_GetItemByIndex(&This->attributes.IMFAttributes_iface, index, key, value); +} + +static HRESULT WINAPI mfmediaevent_CopyAllItems(IMFMediaEvent *iface, IMFAttributes *dest) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + + FIXME("%p, %p\n", This, dest); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mfmediaevent_GetType(IMFMediaEvent *iface, MediaEventType *type) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + + TRACE("%p, %p\n", This, type); + + *type = This->type; + + return S_OK; +} + +static HRESULT WINAPI mfmediaevent_GetExtendedType(IMFMediaEvent *iface, GUID *extended_type) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + + TRACE("%p, %p\n", This, extended_type); + + *extended_type = This->extended_type; + + return S_OK; +} + +static HRESULT WINAPI mfmediaevent_GetStatus(IMFMediaEvent *iface, HRESULT *status) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + + TRACE("%p, %p\n", This, status); + + *status = This->status; + + return S_OK; +} + +static HRESULT WINAPI mfmediaevent_GetValue(IMFMediaEvent *iface, PROPVARIANT *value) +{ + mfmediaevent *This = impl_from_IMFMediaEvent(iface); + + PropVariantCopy(value, &This->value); + + return S_OK; +} + +static const IMFMediaEventVtbl mfmediaevent_vtbl = +{ + mfmediaevent_QueryInterface, + mfmediaevent_AddRef, + mfmediaevent_Release, + mfmediaevent_GetItem, + mfmediaevent_GetItemType, + mfmediaevent_CompareItem, + mfmediaevent_Compare, + mfmediaevent_GetUINT32, + mfmediaevent_GetUINT64, + mfmediaevent_GetDouble, + mfmediaevent_GetGUID, + mfmediaevent_GetStringLength, + mfmediaevent_GetString, + mfmediaevent_GetAllocatedString, + mfmediaevent_GetBlobSize, + mfmediaevent_GetBlob, + mfmediaevent_GetAllocatedBlob, + mfmediaevent_GetUnknown, + mfmediaevent_SetItem, + mfmediaevent_DeleteItem, + mfmediaevent_DeleteAllItems, + mfmediaevent_SetUINT32, + mfmediaevent_SetUINT64, + mfmediaevent_SetDouble, + mfmediaevent_SetGUID, + mfmediaevent_SetString, + mfmediaevent_SetBlob, + mfmediaevent_SetUnknown, + mfmediaevent_LockStore, + mfmediaevent_UnlockStore, + mfmediaevent_GetCount, + mfmediaevent_GetItemByIndex, + mfmediaevent_CopyAllItems, + mfmediaevent_GetType, + mfmediaevent_GetExtendedType, + mfmediaevent_GetStatus, + mfmediaevent_GetValue, +}; + +HRESULT WINAPI MFCreateMediaEvent(MediaEventType type, REFGUID extended_type, HRESULT status, + const PROPVARIANT *value, IMFMediaEvent **event) +{ + mfmediaevent *object; + + TRACE("%#x, %s, %08x, %p, %p\n", type, debugstr_guid(extended_type), status, value, event); + + object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) ); + if(!object) + return E_OUTOFMEMORY; + + init_attribute_object(&object->attributes, 0); + object->IMFMediaEvent_iface.lpVtbl = &mfmediaevent_vtbl; + + object->type = type; + object->extended_type = *extended_type; + object->status = status; + + PropVariantInit(&object->value); + if (value) + PropVariantCopy(&object->value, value); + + *event = &object->IMFMediaEvent_iface; + + return S_OK; +} + typedef struct _mfeventqueue { IMFMediaEventQueue IMFMediaEventQueue_iface; diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec index 4533eeb71c..c828aeab8f 100644 --- a/dlls/mfplat/mfplat.spec +++ b/dlls/mfplat/mfplat.spec @@ -48,7 +48,7 @@ @ stdcall MFCreateMFByteStreamOnStream(ptr ptr) @ stub MFCreateMFVideoFormatFromMFMediaType @ stub MFCreateMediaBufferWrapper -@ stub MFCreateMediaEvent +@ stdcall MFCreateMediaEvent(long ptr long ptr ptr) @ stdcall MFCreateMediaType(ptr) @ stub MFCreateMediaTypeFromRepresentation @ stdcall MFCreateMemoryBuffer(long ptr) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index c507338cf0..a9163a1c28 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -40,6 +40,8 @@ static HRESULT (WINAPI *pMFCreateSourceResolver)(IMFSourceResolver **resolver); static HRESULT (WINAPI *pMFCreateMFByteStreamOnStream)(IStream *stream, IMFByteStream **bytestream); static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer **buffer);
+DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); + DEFINE_GUID(MF_BYTESTREAM_CONTENT_TYPE, 0xfc358289,0x3cb6,0x460c,0xa4,0x24,0xb6,0x68,0x12,0x60,0x37,0x5a);
DEFINE_GUID(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 0xa634a91c, 0x822b, 0x41b9, 0xa4, 0x94, 0x4d, 0xe4, 0x64, 0x36, 0x12, 0xb0); @@ -310,6 +312,62 @@ if(0) MFShutdown(); }
+static void test_MFCreateMediaEvent(void) +{ + HRESULT hr; + IMFMediaEvent *mediaevent; + + MediaEventType type; + GUID extended_type; + HRESULT status; + PROPVARIANT value; + + PropVariantInit(&value); + value.vt = VT_UNKNOWN; + + hr = MFCreateMediaEvent(MEError, &GUID_NULL, E_FAIL, &value, &mediaevent); + ok(hr == S_OK, "got 0x%08x\n", hr); + + PropVariantClear(&value); + + IMFMediaEvent_GetType(mediaevent, &type); + ok(type == MEError, "got %#x\n", type); + + IMFMediaEvent_GetExtendedType(mediaevent, &extended_type); + ok(IsEqualGUID(&extended_type, &GUID_NULL), "got %s\n", + wine_dbgstr_guid(&extended_type)); + + IMFMediaEvent_GetStatus(mediaevent, &status); + ok(status == E_FAIL, "got 0x%08x\n", status); + + PropVariantInit(&value); + IMFMediaEvent_GetValue(mediaevent, &value); + ok(value.vt == VT_UNKNOWN, "got %#x\n", value.vt); + PropVariantClear(&value); + + IMFMediaEvent_Release(mediaevent); + + hr = MFCreateMediaEvent(MEUnknown, &DUMMY_GUID1, S_OK, NULL, &mediaevent); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IMFMediaEvent_GetType(mediaevent, &type); + ok(type == MEUnknown, "got %#x\n", type); + + IMFMediaEvent_GetExtendedType(mediaevent, &extended_type); + ok(IsEqualGUID(&extended_type, &DUMMY_GUID1), "got %s\n", + wine_dbgstr_guid(&extended_type)); + + IMFMediaEvent_GetStatus(mediaevent, &status); + ok(status == S_OK, "got 0x%08x\n", status); + + PropVariantInit(&value); + IMFMediaEvent_GetValue(mediaevent, &value); + ok(value.vt == VT_EMPTY, "got %#x\n", value.vt); + PropVariantClear(&value); + + IMFMediaEvent_Release(mediaevent); +} + static void test_MFCreateAttributes(void) { IMFAttributes *attributes; @@ -522,6 +580,7 @@ START_TEST(mfplat)
test_register(); test_MFCreateMediaType(); + test_MFCreateMediaEvent(); test_MFCreateAttributes(); test_MFSample(); test_MFCreateFile(); diff --git a/include/mfapi.h b/include/mfapi.h index 0230a08471..4697f50c44 100644 --- a/include/mfapi.h +++ b/include/mfapi.h @@ -69,6 +69,8 @@ HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size); HRESULT WINAPI MFCreateEventQueue(IMFMediaEventQueue **queue); HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE openmode, MF_FILE_FLAGS flags, LPCWSTR url, IMFByteStream **bytestream); +HRESULT WINAPI MFCreateMediaEvent(MediaEventType type, REFGUID extended_type, HRESULT status, + const PROPVARIANT *value, IMFMediaEvent **event); HRESULT WINAPI MFCreateMediaType(IMFMediaType **type); HRESULT WINAPI MFCreateSample(IMFSample **sample); HRESULT WINAPI MFCreateMemoryBuffer(DWORD max_length, IMFMediaBuffer **buffer); diff --git a/include/mfobjects.idl b/include/mfobjects.idl index 67055d3423..5ea26b2c67 100644 --- a/include/mfobjects.idl +++ b/include/mfobjects.idl @@ -435,6 +435,109 @@ cpp_quote("#define MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION 0x00000007") cpp_quote("#define MFASYNC_CALLBACK_QUEUE_PRIVATE_MASK 0xffff0000") cpp_quote("#define MFASYNC_CALLBACK_QUEUE_ALL 0xffffffff")
+enum { + MEUnknown = 0, + MEError = 1, + MEExtendedType = 2, + MENonFatalError = 3, + MEGenericV1Anchor = MENonFatalError, + MESessionUnknown = 100, + MESessionTopologySet = 101, + MESessionTopologiesCleared = 102, + MESessionStarted = 103, + MESessionPaused = 104, + MESessionStopped = 105, + MESessionClosed = 106, + MESessionEnded = 107, + MESessionRateChanged = 108, + MESessionScrubSampleComplete = 109, + MESessionCapabilitiesChanged = 110, + MESessionTopologyStatus = 111, + MESessionNotifyPresentationTime = 112, + MENewPresentation = 113, + MELicenseAcquisitionStart = 114, + MELicenseAcquisitionCompleted = 115, + MEIndividualizationStart = 116, + MEIndividualizationCompleted = 117, + MEEnablerProgress = 118, + MEEnablerCompleted = 119, + MEPolicyError = 120, + MEPolicyReport = 121, + MEBufferingStarted = 122, + MEBufferingStopped = 123, + MEConnectStart = 124, + MEConnectEnd = 125, + MEReconnectStart = 126, + MEReconnectEnd = 127, + MERendererEvent = 128, + MESessionStreamSinkFormatChanged = 129, + MESessionV1Anchor = MESessionStreamSinkFormatChanged, + MESourceUnknown = 200, + MESourceStarted = 201, + MEStreamStarted = 202, + MESourceSeeked = 203, + MEStreamSeeked = 204, + MENewStream = 205, + MEUpdatedStream = 206, + MESourceStopped = 207, + MEStreamStopped = 208, + MESourcePaused = 209, + MEStreamPaused = 210, + MEEndOfPresentation = 211, + MEEndOfStream = 212, + MEMediaSample = 213, + MEStreamTick = 214, + MEStreamThinMode = 215, + MEStreamFormatChanged = 216, + MESourceRateChanged = 217, + MEEndOfPresentationSegment = 218, + MESourceCharacteristicsChanged = 219, + MESourceRateChangeRequested = 220, + MESourceMetadataChanged = 221, + MESequencerSourceTopologyUpdated = 222, + MESourceV1Anchor = MESequencerSourceTopologyUpdated, + MESinkUnknown = 300, + MEStreamSinkStarted = 301, + MEStreamSinkStopped = 302, + MEStreamSinkPaused = 303, + MEStreamSinkRateChanged = 304, + MEStreamSinkRequestSample = 305, + MEStreamSinkMarker = 306, + MEStreamSinkPrerolled = 307, + MEStreamSinkScrubSampleComplete = 308, + MEStreamSinkFormatChanged = 309, + MEStreamSinkDeviceChanged = 310, + MEQualityNotify = 311, + MESinkInvalidated = 312, + MEAudioSessionNameChanged = 313, + MEAudioSessionVolumeChanged = 314, + MEAudioSessionDeviceRemoved = 315, + MEAudioSessionServerShutdown = 316, + MEAudioSessionGroupingParamChanged = 317, + MEAudioSessionIconChanged = 318, + MEAudioSessionFormatChanged = 319, + MEAudioSessionDisconnected = 320, + MEAudioSessionExclusiveModeOverride = 321, + MESinkV1Anchor = MEAudioSessionExclusiveModeOverride, + METrustUnknown = 400, + MEPolicyChanged = 401, + MEContentProtectionMessage = 402, + MEPolicySet = 403, + METrustV1Anchor = MEPolicySet, + MEWMDRMLicenseBackupCompleted = 500, + MEWMDRMLicenseBackupProgress = 501, + MEWMDRMLicenseRestoreCompleted = 502, + MEWMDRMLicenseRestoreProgress = 503, + MEWMDRMLicenseAcquisitionCompleted = 506, + MEWMDRMIndividualizationCompleted = 508, + MEWMDRMIndividualizationProgress = 513, + MEWMDRMProximityCompleted = 514, + MEWMDRMLicenseStoreCleaned = 515, + MEWMDRMRevocationDownloadCompleted = 516, + MEWMDRMV1Anchor = MEWMDRMRevocationDownloadCompleted, + MEReservedMax = 10000 +}; + typedef DWORD MediaEventType;
[
Signed-off-by: Sven Baars sven.wine@gmail.com --- This feels like a hack, but without it, Disgaea 5 will be stuck in an infinite loop waiting for the right event, which is of type MEEndOfPresentation. If I just return this event, however, other applications may get stuck in the same infinite loop for a different event. I am open to suggestions.
dlls/mf/Makefile.in | 1 + dlls/mf/session.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/Makefile.in b/dlls/mf/Makefile.in index 9c61d94c8a..f05364bca6 100644 --- a/dlls/mf/Makefile.in +++ b/dlls/mf/Makefile.in @@ -1,5 +1,6 @@ MODULE = mf.dll IMPORTLIB = mf +IMPORTS = mfplat
C_SRCS = \ main.c \ diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 18c5f3bf01..4cea5ec6f4 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -23,16 +23,23 @@
#include "windef.h" #include "winbase.h" + +#include "mfapi.h" #include "mfidl.h"
+#include "initguid.h" + #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
+DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); + typedef struct mfsession { IMFMediaSession IMFMediaSession_iface; LONG ref; + LONG event; } mfsession;
static inline mfsession *impl_from_IMFMediaSession(IMFMediaSession *iface) @@ -94,7 +101,11 @@ static HRESULT WINAPI mfsession_GetEvent(IMFMediaSession *iface, DWORD flags, IM
FIXME("(%p)->(%#x, %p)\n", This, flags, event);
- return E_NOTIMPL; + This->event = ++This->event % 10000; + TRACE("using event %d\n", This->event); + MFCreateMediaEvent(This->event, &GUID_NULL, S_OK, NULL, event); + + return S_OK; }
static HRESULT WINAPI mfsession_BeginGetEvent(IMFMediaSession *iface, IMFAsyncCallback *callback, IUnknown *state) @@ -257,6 +268,7 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses
object->IMFMediaSession_iface.lpVtbl = &mfmediasessionvtbl; object->ref = 1; + object->event = 0;
*session = &object->IMFMediaSession_iface;
On 10/29/18 3:12 PM, Sven Baars wrote:
Signed-off-by: Sven Baars sven.wine@gmail.com
This feels like a hack, but without it, Disgaea 5 will be stuck in an infinite loop waiting for the right event, which is of type MEEndOfPresentation. If I just return this event, however, other applications may get stuck in the same infinite loop for a different event. I am open to suggestions.
dlls/mf/Makefile.in | 1 + dlls/mf/session.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
This is indeed an awful hack. Surely we could fake having played the media file somehow, in a much more realistic manner?
Sven Baars sven.wine@gmail.com wrote:
@@ -500,6 +506,8 @@ static ULONG WINAPI mfbytestream_Release(IMFByteStream *iface)
if (!ref) {
if (This->attributes)
IUnknown_Release((IUnknown*)This->attributes);
Probably this should be 'IMFAttributes_Release(attributes);' instead.
On 10/29/2018 11:11 PM, Sven Baars wrote:
- hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST,
MF_FILEFLAGS_NONE, filename, &bytestream);
- ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IUnknown_QueryInterface(bytestream, &IID_IMFAttributes,
(void **)&attributes);
- ok(hr == S_OK, "got 0x%08x\n", hr);
- ok((void *)attributes != (void *)bytestream, "got %p\n", bytestream);
- hr = IUnknown_QueryInterface(bytestream, &IID_IMFByteStream,
(void **)&bytestream2);
- ok(hr == S_OK, "got 0x%08x\n", hr);
- ok(bytestream == bytestream2, "got %p\n", bytestream2);
This does not really show anything unexpected. Both conditions won't ever fail. If you're going to test QueryInterface behavior, interesting case is to query for IUnknown from IMFAttributes and main interface and see if that returns same pointer.