[PATCH 1/3] include/wine/strmbase.h: BaseOutputPin should store its chosen IMemAllocator

Damjan Jovanovic damjan.jov at gmail.com
Tue Jan 15 00:43:33 CST 2013


Changelog:
* include/wine/strmbase.h: BaseOutputPin should store its chosen IMemAllocator

When DirectShow filter pins connect to each other, they negotiate
for a memory allocator (IMemAlloc). The input pin can provide a
proposed allocator through IMemInputPin_GetAllocator(), but the output
pin makes the final choice and notifies the input pin through
IMemInputPin_NotifyAllocator(). The input pin is then meant
to remember the allocator that was chosen, and return it on subsequent
calls to IMemInputPin_GetAllocator().

Wine broadly assumes this will always hold, ie. that the input
pin will remember the chosen allocator and return it through
IMemInputPin_GetAllocator(). Unfortunately this is not the case
in the real world: VLC refuses to capture from webcams because its
STDMETHODIMP CapturePin::GetAllocator( IMemAllocator ** )
(http://git.videolan.org/?p=vlc.git;a=blob;f=modules/access/dshow/filter.cpp;h=8dafe2fbd87ebc7ec670d84be319289d1240230c;hb=HEAD)
always returns a hardcoded VFW_E_NO_ALLOCATOR, causing the code
in qcap/v4l.c to fail.

Seeing as VLC's filter doesn't implement IAsyncReader either,
the only remaining possibility is that the output pin must
store the IMemAllocator it is going to use, and not rely
on the input pin to do it. The CBaseOutputPin class on MSDN
also does this, storing the allocator in m_pAllocator:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd319039%28v=vs.85%29.aspx

I've fixed it and gotten VLC to capture video by patching
the BaseOutputPin structure to store the allocator,
and BaseOutputPin_AttemptConnection() to initialize it with what
was chosen by BaseOutputPin_DecideAllocator(). Other places
that obtain the allocator from the input pin were then patched
to obtain it from the output pin instead.

Damjan Jovanovic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-add-imemallocator-to-baseoutputpin.patch
Type: application/octet-stream
Size: 376 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20130115/49ca7e8f/attachment.obj>


More information about the wine-patches mailing list