qcap: Add better findpin stub for CaptureGraphBuilder.
ICaptureGraphBuilder::RenderStream needs to enumerate pins, and to prevent duplication I implemented a bit of findpin first.
This commit is contained in:
parent
9617b32618
commit
7e32b11ab6
@ -34,10 +34,10 @@
|
|||||||
#include "evcode.h"
|
#include "evcode.h"
|
||||||
#include "strmif.h"
|
#include "strmif.h"
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
|
#include "vfwmsgs.h"
|
||||||
/*
|
/*
|
||||||
*#include "amvideo.h"
|
*#include "amvideo.h"
|
||||||
*#include "mmreg.h"
|
*#include "mmreg.h"
|
||||||
*#include "vfwmsgs.h"
|
|
||||||
*#include "dshow.h"
|
*#include "dshow.h"
|
||||||
*#include "ddraw.h"
|
*#include "ddraw.h"
|
||||||
*/
|
*/
|
||||||
@ -326,6 +326,27 @@ fnCaptureGraphBuilder2_CopyCaptureFile(ICaptureGraphBuilder2 * iface,
|
|||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, const GUID *type, BOOL unconnected)
|
||||||
|
{
|
||||||
|
IPin *partner;
|
||||||
|
PIN_DIRECTION pindir;
|
||||||
|
|
||||||
|
IPin_QueryDirection(pin, &pindir);
|
||||||
|
if (pindir != direction)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (unconnected && IPin_ConnectedTo(pin, &partner) == S_OK)
|
||||||
|
{
|
||||||
|
IPin_Release(partner);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cat || type)
|
||||||
|
FIXME("Ignoring category/type\n");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI
|
||||||
fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
|
fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
|
||||||
IUnknown *pSource,
|
IUnknown *pSource,
|
||||||
@ -333,16 +354,76 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
|
|||||||
const GUID *pCategory,
|
const GUID *pCategory,
|
||||||
const GUID *pType,
|
const GUID *pType,
|
||||||
BOOL fUnconnected,
|
BOOL fUnconnected,
|
||||||
int num,
|
INT num,
|
||||||
IPin **ppPin)
|
IPin **ppPin)
|
||||||
{
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
IEnumPins *enumpins = NULL;
|
||||||
|
IPin *pin;
|
||||||
CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
|
CaptureGraphImpl *This = impl_from_ICaptureGraphBuilder2(iface);
|
||||||
|
|
||||||
FIXME("(%p/%p)->(%p, %x, %s, %s, %d, %i, %p) Stub!\n", This, iface,
|
TRACE("(%p/%p)->(%p, %x, %s, %s, %d, %i, %p)\n", This, iface,
|
||||||
pSource, pindir, debugstr_guid(pCategory), debugstr_guid(pType),
|
pSource, pindir, debugstr_guid(pCategory), debugstr_guid(pType),
|
||||||
fUnconnected, num, ppPin);
|
fUnconnected, num, ppPin);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
pin = NULL;
|
||||||
|
|
||||||
|
hr = IUnknown_QueryInterface(pSource, &IID_IPin, (void**)&pin);
|
||||||
|
if (hr == E_NOINTERFACE)
|
||||||
|
{
|
||||||
|
IBaseFilter *filter = NULL;
|
||||||
|
int numcurrent = 0;
|
||||||
|
|
||||||
|
hr = IUnknown_QueryInterface(pSource, &IID_IBaseFilter, (void**)&filter);
|
||||||
|
if (hr == E_NOINTERFACE)
|
||||||
|
{
|
||||||
|
WARN("Input not filter or pin?!\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IBaseFilter_EnumPins(filter, &enumpins);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
WARN("Could not enumerate\n");
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumPins_Reset(enumpins);
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
hr = IEnumPins_Next(enumpins, 1, &pin, NULL);
|
||||||
|
if (hr == VFW_E_ENUM_OUT_OF_SYNC)
|
||||||
|
{
|
||||||
|
numcurrent = 0;
|
||||||
|
IEnumPins_Reset(enumpins);
|
||||||
|
pin = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hr != S_OK)
|
||||||
|
break;
|
||||||
|
if (pin_matches(pin, pindir, pCategory, pType, fUnconnected) && numcurrent++ == num)
|
||||||
|
break;
|
||||||
|
IPin_Release(pin);
|
||||||
|
pin = NULL;
|
||||||
|
}
|
||||||
|
IEnumPins_Release(enumpins);
|
||||||
|
|
||||||
|
if (hr != S_OK)
|
||||||
|
{
|
||||||
|
WARN("Could not find pin # %d\n", numcurrent);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!pin_matches(pin, pindir, pCategory, pType, fUnconnected))
|
||||||
|
{
|
||||||
|
IPin_Release(pin);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppPin = pin;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const ICaptureGraphBuilder2Vtbl builder2_Vtbl =
|
static const ICaptureGraphBuilder2Vtbl builder2_Vtbl =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user