Re: [PATCH] quartz: implement AsyncReader_FindPin
Hi, what about if ppPin is NULL? I think that this patch needs test cases to prove that it is correct? David 2010/8/6 Anton Khirnov <wyskas(a)gmail.com>
--- dlls/quartz/filesource.c | 32 ++++++++++++++++++++++++++++++-- 1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 110415d..00a91c8 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -548,9 +548,37 @@ static HRESULT WINAPI AsyncReader_EnumPins(IBaseFilter * iface, IEnumPins **ppEn
static HRESULT WINAPI AsyncReader_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin) { - FIXME("(%s, %p)\n", debugstr_w(Id), ppPin); + IEnumPins *enumpins; + HRESULT hr;
- return E_NOTIMPL; + hr = AsyncReader_EnumPins(iface, &enumpins); + if (FAILED(hr)) + return S_FALSE; + + while (hr == S_OK) { + IPin *pin; + LPWSTR pinname; + + hr = IEnumPins_Next(enumpins, 1, &pin, NULL); + if (FAILED(hr)) + break; + + hr = IPin_QueryId(pin, &pinname); + if (SUCCEEDED(hr)) { + if (!strcmpW(pinname, Id)) { + *ppPin = pin; + IPin_AddRef(*ppPin); + CoTaskMemFree(pinname); + break; + } + CoTaskMemFree(pinname); + } + } + + IEnumPins_Release(enumpins); + if (SUCCEEDED(hr)) + return S_OK; + return S_FALSE; }
static HRESULT WINAPI AsyncReader_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo) -- 1.7.1
On Sat, Aug 07, 2010 at 11:53:36AM +0200, David Adam wrote:
Hi,
what about if ppPin is NULL? then it will crash spectacularly, which is exactly what the client throwing around invalid pointers deserves ;) the surrounding code assumes that it's passed valid pointers too.
anyway, dshow seems to require this, so added a check locally
I think that this patch needs test cases to prove that it is correct? I'll try to write something, but i'm not familiar with wine/quartz API (i just wanted to get video playback in a game working :) ) so it might be problematic.
anyway, i've looked around some more and it seems that this function can be shared for all IBaseFilter subclasses. same probably goes for some other, e.g. IBaseFilter_EnumPins. is there a reason they're not? Anton Khirnov
participants (2)
-
Anton Khirnov -
David Adam