From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/mediadet.c | 22 ++++++++++++++++++---- dlls/qedit/tests/mediadet.c | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c index ecfafc44cbb..92c154a50a5 100644 --- a/dlls/qedit/mediadet.c +++ b/dlls/qedit/mediadet.c @@ -28,6 +28,7 @@ #include "ole2.h"
#include "qedit_private.h" +#include "wine/strmbase.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(qedit); @@ -280,11 +281,24 @@ static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet* iface, LONG newVal) return S_OK; }
-static HRESULT WINAPI MediaDet_get_StreamType(IMediaDet* iface, GUID *pVal) +static HRESULT WINAPI MediaDet_get_StreamType(IMediaDet *iface, GUID *majortype) { - MediaDetImpl *This = impl_from_IMediaDet(iface); - FIXME("(%p)->(%s): not implemented!\n", This, debugstr_guid(pVal)); - return E_NOTIMPL; + MediaDetImpl *detector = impl_from_IMediaDet(iface); + AM_MEDIA_TYPE mt; + HRESULT hr; + + TRACE("detector %p, majortype %p.\n", detector, majortype); + + if (!majortype) + return E_POINTER; + + if (SUCCEEDED(hr = IMediaDet_get_StreamMediaType(iface, &mt))) + { + *majortype = mt.majortype; + FreeMediaType(&mt); + } + + return hr; }
static HRESULT WINAPI MediaDet_get_StreamTypeB(IMediaDet* iface, BSTR *pVal) diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c index 65f5af79c7e..1d8db732c88 100644 --- a/dlls/qedit/tests/mediadet.c +++ b/dlls/qedit/tests/mediadet.c @@ -192,6 +192,7 @@ static void test_mediadet(void) BSTR filename = NULL; LONG nstrms = 0; LONG strm; + GUID guid; AM_MEDIA_TYPE mt; double fps; int flags; @@ -242,6 +243,12 @@ static void test_mediadet(void) hr = IMediaDet_get_StreamMediaType(pM, NULL); ok(hr == E_POINTER, "IMediaDet_get_StreamMediaType failed: %08x\n", hr);
+ hr = IMediaDet_get_StreamType(pM, &guid); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IMediaDet_get_StreamType(pM, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + filename = SysAllocString(test_avi_filename); hr = IMediaDet_put_Filename(pM, filename); ok(hr == S_OK, "IMediaDet_put_Filename failed: %08x\n", hr); @@ -258,6 +265,10 @@ static void test_mediadet(void) ok(hr == S_OK, "IMediaDet_get_StreamMediaType failed: %08x\n", hr); CoTaskMemFree(mt.pbFormat);
+ hr = IMediaDet_get_StreamType(pM, &guid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&guid, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&guid)); + /* Even before get_OutputStreams. */ hr = IMediaDet_put_CurrentStream(pM, 1); ok(hr == E_INVALIDARG, "IMediaDet_put_CurrentStream failed: %08x\n", hr); @@ -311,6 +322,10 @@ static void test_mediadet(void) "IMediaDet_get_StreamMediaType\n"); CoTaskMemFree(mt.pbFormat);
+ hr = IMediaDet_get_StreamType(pM, &guid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&guid, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&guid)); + hr = IMediaDet_get_FrameRate(pM, NULL); ok(hr == E_POINTER, "IMediaDet_get_FrameRate failed: %08x\n", hr);
@@ -370,6 +385,10 @@ static void test_mediadet(void)
if (IsEqualGUID(&mt.majortype, &MEDIATYPE_Audio)) { + hr = IMediaDet_get_StreamType(pM, &guid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(IsEqualGUID(&guid, &MEDIATYPE_Audio), "Got major type %s.\n", debugstr_guid(&guid)); + hr = IMediaDet_get_FrameRate(pM, &fps); ok(hr == VFW_E_INVALIDMEDIATYPE, "IMediaDet_get_FrameRate failed: %08x\n", hr); }
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/mediadet.c | 18 ++++++++++++++---- dlls/qedit/tests/mediadet.c | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c index 92c154a50a5..0d0240aff36 100644 --- a/dlls/qedit/mediadet.c +++ b/dlls/qedit/mediadet.c @@ -301,11 +301,21 @@ static HRESULT WINAPI MediaDet_get_StreamType(IMediaDet *iface, GUID *majortype) return hr; }
-static HRESULT WINAPI MediaDet_get_StreamTypeB(IMediaDet* iface, BSTR *pVal) +static HRESULT WINAPI MediaDet_get_StreamTypeB(IMediaDet *iface, BSTR *bstr) { - MediaDetImpl *This = impl_from_IMediaDet(iface); - FIXME("(%p)->(%p): not implemented!\n", This, pVal); - return E_NOTIMPL; + MediaDetImpl *detector = impl_from_IMediaDet(iface); + HRESULT hr; + GUID guid; + + TRACE("detector %p, bstr %p.\n", detector, bstr); + + if (SUCCEEDED(hr = IMediaDet_get_StreamType(iface, &guid))) + { + if (!(*bstr = SysAllocStringLen(NULL, CHARS_IN_GUID - 1))) + return E_OUTOFMEMORY; + StringFromGUID2(&guid, *bstr, CHARS_IN_GUID); + } + return hr; }
static HRESULT WINAPI MediaDet_get_StreamLength(IMediaDet* iface, double *pVal) diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c index 1d8db732c88..7f1bdc7ab64 100644 --- a/dlls/qedit/tests/mediadet.c +++ b/dlls/qedit/tests/mediadet.c @@ -193,6 +193,7 @@ static void test_mediadet(void) LONG nstrms = 0; LONG strm; GUID guid; + BSTR bstr; AM_MEDIA_TYPE mt; double fps; int flags; @@ -249,6 +250,12 @@ static void test_mediadet(void) hr = IMediaDet_get_StreamType(pM, NULL); ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+ hr = IMediaDet_get_StreamTypeB(pM, &bstr); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IMediaDet_get_StreamTypeB(pM, NULL); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + filename = SysAllocString(test_avi_filename); hr = IMediaDet_put_Filename(pM, filename); ok(hr == S_OK, "IMediaDet_put_Filename failed: %08x\n", hr); @@ -269,6 +276,12 @@ static void test_mediadet(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(IsEqualGUID(&guid, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&guid));
+ hr = IMediaDet_get_StreamTypeB(pM, &bstr); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!wcscmp(bstr, L"{73646976-0000-0010-8000-00AA00389B71}"), + "Got major type %s.\n", debugstr_w(bstr)); + SysFreeString(bstr); + /* Even before get_OutputStreams. */ hr = IMediaDet_put_CurrentStream(pM, 1); ok(hr == E_INVALIDARG, "IMediaDet_put_CurrentStream failed: %08x\n", hr); @@ -326,6 +339,12 @@ static void test_mediadet(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(IsEqualGUID(&guid, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&guid));
+ hr = IMediaDet_get_StreamTypeB(pM, &bstr); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!wcscmp(bstr, L"{73646976-0000-0010-8000-00AA00389B71}"), + "Got major type %s.\n", debugstr_w(bstr)); + SysFreeString(bstr); + hr = IMediaDet_get_FrameRate(pM, NULL); ok(hr == E_POINTER, "IMediaDet_get_FrameRate failed: %08x\n", hr);
@@ -389,6 +408,12 @@ static void test_mediadet(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(IsEqualGUID(&guid, &MEDIATYPE_Audio), "Got major type %s.\n", debugstr_guid(&guid));
+ hr = IMediaDet_get_StreamTypeB(pM, &bstr); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!wcscmp(bstr, L"{73647561-0000-0010-8000-00AA00389B71}"), + "Got major type %s.\n", debugstr_w(bstr)); + SysFreeString(bstr); + hr = IMediaDet_get_FrameRate(pM, &fps); ok(hr == VFW_E_INVALIDMEDIATYPE, "IMediaDet_get_FrameRate failed: %08x\n", hr); }
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/mediadet.c | 19 +++++++++++--- dlls/qedit/tests/mediadet.c | 49 ++++++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 5 deletions(-)
diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c index 0d0240aff36..f122b81b3af 100644 --- a/dlls/qedit/mediadet.c +++ b/dlls/qedit/mediadet.c @@ -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) diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c index 7f1bdc7ab64..b7787f03ea4 100644 --- a/dlls/qedit/tests/mediadet.c +++ b/dlls/qedit/tests/mediadet.c @@ -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);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/mediadet.c | 2 +- dlls/qedit/tests/mediadet.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c index f122b81b3af..0b64e189830 100644 --- a/dlls/qedit/mediadet.c +++ b/dlls/qedit/mediadet.c @@ -535,7 +535,7 @@ static HRESULT WINAPI MediaDet_put_Filename(IMediaDet* iface, BSTR newVal) if (FAILED(hr)) return hr;
- if (FAILED(hr = IGraphBuilder_AddSourceFilter(gb, newVal, L"Reader", &bf))) + if (FAILED(hr = IGraphBuilder_AddSourceFilter(gb, newVal, L"Source", &bf))) { IGraphBuilder_Release(gb); return hr; diff --git a/dlls/qedit/tests/mediadet.c b/dlls/qedit/tests/mediadet.c index b7787f03ea4..ea10f5783e0 100644 --- a/dlls/qedit/tests/mediadet.c +++ b/dlls/qedit/tests/mediadet.c @@ -473,7 +473,7 @@ static void test_mediadet(void)
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)); + ok(!wcscmp(filter_info.achName, L"Source"), "Got name %s.\n", debugstr_w(filter_info.achName)); IFilterGraph_Release(filter_info.pGraph); IBaseFilter_Release(filter);