qedit: Try all possible splitter filters instead of only the first one.
This commit is contained in:
parent
09849ed929
commit
b769a266cf
|
@ -378,52 +378,56 @@ static HRESULT GetSplitter(MediaDetImpl *This)
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
hr = IEnumMoniker_Next(filters, 1, &mon, NULL);
|
hr = E_NOINTERFACE;
|
||||||
IEnumMoniker_Release(filters);
|
while (IEnumMoniker_Next(filters, 1, &mon, NULL) == S_OK)
|
||||||
if (hr != S_OK) /* No matches, what do we do? */
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
|
|
||||||
hr = GetFilterInfo(mon, &clsid, &var);
|
|
||||||
IMoniker_Release(mon);
|
|
||||||
if (FAILED(hr))
|
|
||||||
return hr;
|
|
||||||
|
|
||||||
hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
|
|
||||||
&IID_IBaseFilter, (void **) &splitter);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
{
|
||||||
|
hr = GetFilterInfo(mon, &clsid, &var);
|
||||||
|
IMoniker_Release(mon);
|
||||||
|
if (FAILED(hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_IBaseFilter, (void **) &splitter);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
VariantClear(&var);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IGraphBuilder_AddFilter(This->graph, splitter,
|
||||||
|
V_UNION(&var, bstrVal));
|
||||||
VariantClear(&var);
|
VariantClear(&var);
|
||||||
return hr;
|
This->splitter = splitter;
|
||||||
}
|
if (FAILED(hr))
|
||||||
|
goto retry;
|
||||||
|
|
||||||
hr = IGraphBuilder_AddFilter(This->graph, splitter,
|
hr = IBaseFilter_EnumPins(This->source, &pins);
|
||||||
V_UNION(&var, bstrVal));
|
if (FAILED(hr))
|
||||||
VariantClear(&var);
|
goto retry;
|
||||||
if (FAILED(hr))
|
IEnumPins_Next(pins, 1, &source_pin, NULL);
|
||||||
{
|
IEnumPins_Release(pins);
|
||||||
IBaseFilter_Release(splitter);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
This->splitter = splitter;
|
|
||||||
|
|
||||||
hr = IBaseFilter_EnumPins(This->source, &pins);
|
hr = IBaseFilter_EnumPins(splitter, &pins);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
{
|
||||||
IEnumPins_Next(pins, 1, &source_pin, NULL);
|
IPin_Release(source_pin);
|
||||||
IEnumPins_Release(pins);
|
goto retry;
|
||||||
|
}
|
||||||
|
IEnumPins_Next(pins, 1, &splitter_pin, NULL);
|
||||||
|
IEnumPins_Release(pins);
|
||||||
|
|
||||||
hr = IBaseFilter_EnumPins(splitter, &pins);
|
hr = IPin_Connect(source_pin, splitter_pin, NULL);
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IPin_Release(source_pin);
|
IPin_Release(source_pin);
|
||||||
return hr;
|
IPin_Release(splitter_pin);
|
||||||
}
|
if (SUCCEEDED(hr))
|
||||||
IEnumPins_Next(pins, 1, &splitter_pin, NULL);
|
break;
|
||||||
IEnumPins_Release(pins);
|
|
||||||
|
|
||||||
hr = IPin_Connect(source_pin, splitter_pin, NULL);
|
retry:
|
||||||
IPin_Release(source_pin);
|
IBaseFilter_Release(splitter);
|
||||||
IPin_Release(splitter_pin);
|
This->splitter = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumMoniker_Release(filters);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue