From: "Gabriel Ivăncescu" Subject: [PATCH v5 4/5] qedit: Use the pin's media type instead of querying for IFileSourceFilter. Message-Id: <3262a799259581de417d0c252992c51a73d85590.1587991507.git.gabrielopcode@gmail.com> Date: Mon, 27 Apr 2020 16:07:44 +0300 In-Reply-To: <1270952f2dbad41272028579a21921c3f9cb40ce.1587991507.git.gabrielopcode@gmail.com> References: <1270952f2dbad41272028579a21921c3f9cb40ce.1587991507.git.gabrielopcode@gmail.com> Signed-off-by: Gabriel Ivăncescu --- dlls/qedit/mediadet.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/dlls/qedit/mediadet.c b/dlls/qedit/mediadet.c index ac382ff..ff7f0f9 100644 --- a/dlls/qedit/mediadet.c +++ b/dlls/qedit/mediadet.c @@ -128,12 +128,10 @@ static HRESULT get_pin_media_type(IPin *pin, AM_MEDIA_TYPE *out) static HRESULT find_splitter(MediaDetImpl *detector) { IPin *source_pin, *splitter_pin; - IFileSourceFilter *file_source; IEnumMoniker *enum_moniker; IFilterMapper2 *mapper; IBaseFilter *splitter; IEnumPins *enum_pins; - LPOLESTR filename; AM_MEDIA_TYPE mt; IMoniker *mon; GUID type[2]; @@ -141,25 +139,6 @@ static HRESULT find_splitter(MediaDetImpl *detector) HRESULT hr; GUID clsid; - if (FAILED(hr = IBaseFilter_QueryInterface(detector->source, - &IID_IFileSourceFilter, (void **)&file_source))) - { - ERR("Failed to get file source interface.\n"); - return hr; - } - - hr = IFileSourceFilter_GetCurFile(file_source, &filename, &mt); - IFileSourceFilter_Release(file_source); - CoTaskMemFree(filename); - if (FAILED(hr)) - { - ERR("Failed to get current file, hr %#x.\n", hr); - return hr; - } - type[0] = mt.majortype; - type[1] = mt.subtype; - FreeMediaType(&mt); - if (FAILED(hr = IBaseFilter_EnumPins(detector->source, &enum_pins))) { ERR("Failed to enumerate source pins, hr %#x.\n", hr); @@ -173,6 +152,17 @@ static HRESULT find_splitter(MediaDetImpl *detector) return hr; } + if (FAILED(hr = get_pin_media_type(source_pin, &mt))) + { + ERR("Failed to get media type, hr %#x.\n", hr); + IPin_Release(source_pin); + return hr; + } + + type[0] = mt.majortype; + type[1] = mt.subtype; + FreeMediaType(&mt); + if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (void **)&mapper))) { -- 2.21.0