Commit 9f053430 authored by Brendan McGrath's avatar Brendan McGrath Committed by Alexandre Julliard

quartz/filtergraph: Iterate over all source pins in ExploreGraph().

parent 6db5a3a1
......@@ -974,68 +974,6 @@ static HRESULT GetFilterInfo(IMoniker* pMoniker, VARIANT* pvar)
return hr;
}
static HRESULT GetInternalConnections(IBaseFilter* pfilter, IPin* pinputpin, IPin*** pppins, ULONG* pnb)
{
HRESULT hr;
ULONG nb = 0;
TRACE("(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
hr = IPin_QueryInternalConnections(pinputpin, NULL, &nb);
if (hr == S_OK) {
/* Rendered input */
} else if (hr == S_FALSE) {
*pppins = CoTaskMemAlloc(sizeof(IPin*)*nb);
hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
if (hr != S_OK) {
WARN("Error (%x)\n", hr);
}
} else if (hr == E_NOTIMPL) {
/* Input connected to all outputs */
IEnumPins* penumpins;
IPin* ppin;
int i = 0;
TRACE("E_NOTIMPL\n");
hr = IBaseFilter_EnumPins(pfilter, &penumpins);
if (FAILED(hr)) {
WARN("filter Enumpins failed (%x)\n", hr);
return hr;
}
i = 0;
/* Count output pins */
while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
PIN_DIRECTION pindir;
IPin_QueryDirection(ppin, &pindir);
if (pindir == PINDIR_OUTPUT)
i++;
IPin_Release(ppin);
}
*pppins = CoTaskMemAlloc(sizeof(IPin*)*i);
/* Retrieve output pins */
IEnumPins_Reset(penumpins);
i = 0;
while(IEnumPins_Next(penumpins, 1, &ppin, &nb) == S_OK) {
PIN_DIRECTION pindir;
IPin_QueryDirection(ppin, &pindir);
if (pindir == PINDIR_OUTPUT)
(*pppins)[i++] = ppin;
else
IPin_Release(ppin);
}
IEnumPins_Release(penumpins);
nb = i;
if (FAILED(hr)) {
WARN("Next failed (%x)\n", hr);
return hr;
}
} else if (FAILED(hr)) {
WARN("Cannot get internal connection (%x)\n", hr);
return hr;
}
*pnb = nb;
return S_OK;
}
/* Attempt to connect one of the output pins on filter to sink. Helper for
* FilterGraph2_Connect(). */
static HRESULT connect_output_pin(IFilterGraphImpl *graph, IBaseFilter *filter, IPin *sink)
......@@ -2087,12 +2025,12 @@ static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundF
{
IAMFilterMiscFlags *flags;
IMediaSeeking *seeking;
IEnumPins *enumpins;
PIN_DIRECTION dir;
HRESULT hr;
IPin* pInputPin;
IPin** ppPins;
ULONG nb;
ULONG i;
PIN_INFO PinInfo;
IPin *pin;
TRACE("%p %p\n", pGraph, pOutputPin);
PinInfo.pFilter = NULL;
......@@ -2102,26 +2040,23 @@ static HRESULT ExploreGraph(IFilterGraphImpl* pGraph, IPin* pOutputPin, fnFoundF
if (SUCCEEDED(hr))
{
hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
if (SUCCEEDED(hr))
hr = GetInternalConnections(PinInfo.pFilter, pInputPin, &ppPins, &nb);
IPin_Release(pInputPin);
}
if (SUCCEEDED(hr))
hr = IBaseFilter_EnumPins(PinInfo.pFilter, &enumpins);
if (SUCCEEDED(hr))
{
if (nb)
while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
{
for(i = 0; i < nb; i++)
{
/* Explore the graph downstream from this pin
* FIXME: We should prevent exploring from a pin more than once. This can happens when
* several input pins are connected to the same output (a MUX for instance). */
ExploreGraph(pGraph, ppPins[i], FoundFilter, data);
IPin_Release(ppPins[i]);
}
CoTaskMemFree(ppPins);
IPin_QueryDirection(pin, &dir);
if (dir == PINDIR_OUTPUT)
ExploreGraph(pGraph, pin, FoundFilter, data);
IPin_Release(pin);
}
IEnumPins_Release(enumpins);
TRACE("Doing stuff with filter %p\n", PinInfo.pFilter);
if (SUCCEEDED(IBaseFilter_QueryInterface(PinInfo.pFilter,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment