quartz: Use CONTAINING_RECORD instead of casting.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-05-17 00:31:03 -05:00 committed by Alexandre Julliard
parent 23320d05b6
commit 69e654a684
4 changed files with 23 additions and 14 deletions

View File

@ -105,6 +105,11 @@ static inline AVISplitterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
return CONTAINING_RECORD(iface, AVISplitterImpl, Parser.sourceSeeking.IMediaSeeking_iface);
}
static inline AVISplitterImpl *impl_from_IBaseFilter(IBaseFilter *iface)
{
return CONTAINING_RECORD(iface, AVISplitterImpl, Parser.filter.IBaseFilter_iface);
}
/* The threading stuff cries for an explanation
*
* PullPin starts processing and calls AVISplitter_first_request
@ -1025,6 +1030,7 @@ static HRESULT AVISplitter_Disconnect(LPVOID iface);
static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, ALLOCATOR_PROPERTIES *props)
{
PullPin *This = impl_PullPin_from_IPin(iface);
AVISplitterImpl *pAviSplit = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
HRESULT hr;
RIFFLIST list;
LONGLONG pos = 0; /* in bytes */
@ -1034,8 +1040,6 @@ static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
ULONG x;
DWORD indexes;
AVISplitterImpl * pAviSplit = (AVISplitterImpl *)This->pin.pinInfo.pFilter;
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
pos += sizeof(list);
@ -1264,7 +1268,7 @@ static HRESULT AVISplitter_Disconnect(LPVOID iface)
static ULONG WINAPI AVISplitter_Release(IBaseFilter *iface)
{
AVISplitterImpl *This = (AVISplitterImpl *)iface;
AVISplitterImpl *This = impl_from_IBaseFilter(iface);
ULONG ref;
ref = InterlockedDecrement(&This->Parser.filter.refCount);

View File

@ -759,8 +759,8 @@ static ULONG WINAPI DSoundRender_Release(IBaseFilter * iface)
static HRESULT WINAPI DSoundRender_Pause(IBaseFilter * iface)
{
DSoundRenderImpl *This = impl_from_IBaseFilter(iface);
HRESULT hr = S_OK;
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
TRACE("(%p/%p)->()\n", This, iface);

View File

@ -485,7 +485,7 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
{
PullPin *pPin = impl_PullPin_from_IPin(iface);
MPEGSplitterImpl *This = (MPEGSplitterImpl*)pPin->pin.pinInfo.pFilter;
MPEGSplitterImpl *This = impl_from_IBaseFilter(pPin->pin.pinInfo.pFilter);
HRESULT hr;
LONGLONG pos = 0; /* in bytes */
BYTE header[10];

View File

@ -206,6 +206,11 @@ static inline VMR9DefaultAllocatorPresenterImpl *impl_from_IVMRSurfaceAllocatorE
static HRESULT VMR9DefaultAllocatorPresenterImpl_create(struct quartz_vmr *parent, LPVOID * ppv);
static inline struct quartz_vmr *impl_from_IBaseFilter(IBaseFilter *iface)
{
return CONTAINING_RECORD(iface, struct quartz_vmr, renderer.filter.IBaseFilter_iface);
}
static DWORD VMR9_SendSampleData(struct quartz_vmr *This, VMR9PresentationInfo *info, LPBYTE data,
DWORD size)
{
@ -286,7 +291,7 @@ static DWORD VMR9_SendSampleData(struct quartz_vmr *This, VMR9PresentationInfo *
static HRESULT WINAPI VMR9_DoRenderSample(BaseRenderer *iface, IMediaSample * pSample)
{
struct quartz_vmr *This = (struct quartz_vmr*)iface;
struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
LPBYTE pbSrcStream = NULL;
long cbSrcStream = 0;
REFERENCE_TIME tStart, tStop;
@ -351,7 +356,7 @@ static HRESULT WINAPI VMR9_DoRenderSample(BaseRenderer *iface, IMediaSample * pS
static HRESULT WINAPI VMR9_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TYPE * pmt)
{
struct quartz_vmr *This = (struct quartz_vmr*)iface;
struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video) || !pmt->pbFormat)
return S_FALSE;
@ -445,7 +450,7 @@ static HRESULT VMR9_maybe_init(struct quartz_vmr *This, BOOL force)
static VOID WINAPI VMR9_OnStartStreaming(BaseRenderer* iface)
{
struct quartz_vmr *This = (struct quartz_vmr*)iface;
struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
TRACE("(%p)\n", This);
@ -463,7 +468,7 @@ static VOID WINAPI VMR9_OnStartStreaming(BaseRenderer* iface)
static VOID WINAPI VMR9_OnStopStreaming(BaseRenderer* iface)
{
struct quartz_vmr *This = (struct quartz_vmr*)iface;
struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
TRACE("(%p)\n", This);
@ -481,7 +486,7 @@ static HRESULT WINAPI VMR9_ShouldDrawSampleNow(BaseRenderer *This, IMediaSample
static HRESULT WINAPI VMR9_CompleteConnect(BaseRenderer *This, IPin *pReceivePin)
{
struct quartz_vmr *pVMR9 = (struct quartz_vmr*)This;
struct quartz_vmr *pVMR9 = impl_from_IBaseFilter(&This->filter.IBaseFilter_iface);
HRESULT hr;
TRACE("(%p)\n", This);
@ -495,7 +500,7 @@ static HRESULT WINAPI VMR9_CompleteConnect(BaseRenderer *This, IPin *pReceivePin
static HRESULT WINAPI VMR9_BreakConnect(BaseRenderer *This)
{
struct quartz_vmr *pVMR9 = (struct quartz_vmr*)This;
struct quartz_vmr *pVMR9 = impl_from_IBaseFilter(&This->filter.IBaseFilter_iface);
HRESULT hr = S_OK;
if (!pVMR9->mode)
@ -863,7 +868,7 @@ static const IUnknownVtbl IInner_VTable =
static HRESULT WINAPI VMR9_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
{
struct quartz_vmr *This = (struct quartz_vmr*)iface;
struct quartz_vmr *This = impl_from_IBaseFilter(iface);
if (This->bAggregatable)
This->bUnkOuterValid = TRUE;
@ -893,7 +898,7 @@ static HRESULT WINAPI VMR9_QueryInterface(IBaseFilter * iface, REFIID riid, LPVO
static ULONG WINAPI VMR9_AddRef(IBaseFilter * iface)
{
struct quartz_vmr *This = (struct quartz_vmr*)iface;
struct quartz_vmr *This = impl_from_IBaseFilter(iface);
LONG ret;
if (This->outer_unk && This->bUnkOuterValid)
@ -908,7 +913,7 @@ static ULONG WINAPI VMR9_AddRef(IBaseFilter * iface)
static ULONG WINAPI VMR9_Release(IBaseFilter * iface)
{
struct quartz_vmr *This = (struct quartz_vmr*)iface;
struct quartz_vmr *This = impl_from_IBaseFilter(iface);
LONG ret;
if (This->outer_unk && This->bUnkOuterValid)