On 11/2/18 3:27 PM, Sven Baars wrote:
+static HRESULT WINAPI mfbytestream_mfattributes_QueryInterface( + IMFAttributes *iface, REFIID riid, void **out) +{ + mfbytestream *This = impl_from_IMFByteStream_IMFAttributes(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out); + + if(IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IMFByteStream)) + { + *out = &This->IMFByteStream_iface; + } + else if(IsEqualGUID(riid, &IID_IMFAttributes)) + { + *out = &This->IMFAttributes_iface; + } + else + { + FIXME("(%s, %p)\n", debugstr_guid(riid), out); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*out); + return S_OK; +} + +static ULONG WINAPI mfbytestream_mfattributes_AddRef(IMFAttributes *iface) +{ + mfbytestream *This = impl_from_IMFByteStream_IMFAttributes(iface); + ULONG ref = InterlockedIncrement(&This->attributes.ref); + + TRACE("(%p) ref=%u\n", This, ref); + + return ref; +} + +static ULONG WINAPI mfbytestream_mfattributes_Release(IMFAttributes *iface) +{ + mfbytestream *This = impl_from_IMFByteStream_IMFAttributes(iface); + ULONG ref = InterlockedDecrement(&This->attributes.ref); + + TRACE("(%p) ref=%u\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +}
You should forward these methods to the IMFByteStream implementation to avoid duplicating code. Otherwise this patch looks fine to me.