qedit: Implement IMediaDet::get_Filter().

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2020-04-17 15:02:08 -05:00 committed by Alexandre Julliard
parent 15ea804a17
commit 7a1a93a70a
2 changed files with 63 additions and 5 deletions

View File

@ -144,11 +144,22 @@ static ULONG WINAPI MediaDet_Release(IMediaDet *iface)
return IUnknown_Release(This->outer_unk);
}
static HRESULT WINAPI MediaDet_get_Filter(IMediaDet* iface, IUnknown **pVal)
static HRESULT WINAPI MediaDet_get_Filter(IMediaDet *iface, IUnknown **filter)
{
MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p)->(%p): not implemented!\n", This, pVal);
return E_NOTIMPL;
MediaDetImpl *detector = impl_from_IMediaDet(iface);
TRACE("detector %p, filter %p.\n", detector, filter);
if (!filter)
return E_POINTER;
*filter = (IUnknown *)detector->source;
if (*filter)
IUnknown_AddRef(*filter);
else
return S_FALSE;
return S_OK;
}
static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *newVal)

View File

@ -188,13 +188,19 @@ static BOOL init_tests(void)
static void test_mediadet(void)
{
HRESULT hr;
FILTER_INFO filter_info;
AM_MEDIA_TYPE mt, *pmt;
IEnumMediaTypes *type;
IMediaDet *pM = NULL;
BSTR filename = NULL;
IBaseFilter *filter;
IEnumPins *enumpins;
LONG nstrms = 0;
IUnknown *unk;
IPin *pin;
LONG strm;
GUID guid;
BSTR bstr;
AM_MEDIA_TYPE mt;
double fps;
int flags;
int i;
@ -256,6 +262,14 @@ static void test_mediadet(void)
hr = IMediaDet_get_StreamTypeB(pM, NULL);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IMediaDet_get_Filter(pM, NULL);
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
unk = (IUnknown*)0xdeadbeef;
hr = IMediaDet_get_Filter(pM, &unk);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(!unk, "Got filter %p.\n", unk);
filename = SysAllocString(test_avi_filename);
hr = IMediaDet_put_Filename(pM, filename);
ok(hr == S_OK, "IMediaDet_put_Filename failed: %08x\n", hr);
@ -430,6 +444,39 @@ static void test_mediadet(void)
ok(hr == S_OK, "IMediaDet_get_CurrentStream failed: %08x\n", hr);
ok(strm == 1, "IMediaDet_get_CurrentStream: strm is %i\n", strm);
unk = NULL;
hr = IMediaDet_get_Filter(pM, &unk);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!!unk, "Expected a non-NULL filter.\n");
hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void**)&filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
IUnknown_Release(unk);
hr = IBaseFilter_EnumPins(filter, &enumpins);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumPins_Next(enumpins, 1, &pin, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_EnumMediaTypes(pin, &type);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IEnumMediaTypes_Next(type, 1, &pmt, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(IsEqualGUID(&pmt->majortype, &MEDIATYPE_Stream), "Got major type %s.\n",
debugstr_guid(&pmt->majortype));
IEnumMediaTypes_Release(type);
CoTaskMemFree(pmt->pbFormat);
CoTaskMemFree(pmt);
IPin_Release(pin);
hr = IEnumPins_Next(enumpins, 1, &pin, NULL);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
IEnumPins_Release(enumpins);
hr = IBaseFilter_QueryFilterInfo(filter, &filter_info);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(!wcscmp(filter_info.achName, L"Source"), "Got name %s.\n", debugstr_w(filter_info.achName));
IFilterGraph_Release(filter_info.pGraph);
IBaseFilter_Release(filter);
hr = IMediaDet_Release(pM);
ok(hr == 0, "IMediaDet_Release returned: %x\n", hr);