strmbase: COM cleanup for cleanup SourceSeeking.

This commit is contained in:
Aric Stewart 2012-03-24 11:43:09 -05:00 committed by Alexandre Julliard
parent eb5d8b969f
commit d3c5b2c4f1
8 changed files with 27 additions and 22 deletions

View File

@ -102,7 +102,7 @@ struct thread_args {
static inline AVISplitterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
{
return (AVISplitterImpl *)((char*)iface - FIELD_OFFSET(AVISplitterImpl, Parser.sourceSeeking.lpVtbl));
return CONTAINING_RECORD(iface, AVISplitterImpl, Parser.sourceSeeking.IMediaSeeking_iface);
}
/* The threading stuff cries for an explanation

View File

@ -78,7 +78,7 @@ typedef struct MPEGSplitterImpl
static inline MPEGSplitterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
{
return (MPEGSplitterImpl *)((char*)iface - FIELD_OFFSET(MPEGSplitterImpl, Parser.sourceSeeking.lpVtbl));
return CONTAINING_RECORD(iface, MPEGSplitterImpl, Parser.sourceSeeking.IMediaSeeking_iface);
}
static int MPEGSplitter_head_check(const BYTE *header)

View File

@ -50,7 +50,7 @@ static HRESULT WINAPI Parser_OutputPin_BreakConnect(BaseOutputPin *This);
static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
{
return (ParserImpl *)((char*)iface - FIELD_OFFSET(ParserImpl, sourceSeeking.lpVtbl));
return CONTAINING_RECORD(iface, ParserImpl, sourceSeeking.IMediaSeeking_iface);
}
/* FIXME: WRONG */

View File

@ -50,7 +50,7 @@ typedef struct WAVEParserImpl
static inline WAVEParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
{
return (WAVEParserImpl*)((char*)iface - FIELD_OFFSET(WAVEParserImpl, Parser.sourceSeeking.lpVtbl));
return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.sourceSeeking.IMediaSeeking_iface);
}
static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)

View File

@ -32,11 +32,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
static inline SourceSeeking *impl_from_IMediaSeeking(IMediaSeeking *iface)
{
return CONTAINING_RECORD(iface, SourceSeeking, IMediaSeeking_iface);
}
HRESULT SourceSeeking_Init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtbl, SourceSeeking_ChangeStop fnChangeStop, SourceSeeking_ChangeStart fnChangeStart, SourceSeeking_ChangeRate fnChangeRate, PCRITICAL_SECTION crit_sect)
{
assert(fnChangeStop && fnChangeStart && fnChangeRate);
pSeeking->lpVtbl = Vtbl;
pSeeking->IMediaSeeking_iface.lpVtbl = Vtbl;
pSeeking->refCount = 1;
pSeeking->fnChangeRate = fnChangeRate;
pSeeking->fnChangeStop = fnChangeStop;
@ -57,7 +62,7 @@ HRESULT SourceSeeking_Init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtb
HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", pCapabilities);
@ -68,7 +73,7 @@ HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD *
HRESULT WINAPI SourceSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
HRESULT hr;
DWORD dwCommonCaps;
@ -104,7 +109,7 @@ HRESULT WINAPI SourceSeekingImpl_QueryPreferredFormat(IMediaSeeking * iface, GUI
HRESULT WINAPI SourceSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFormat)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%s)\n", debugstr_guid(pFormat));
EnterCriticalSection(This->crst);
@ -116,7 +121,7 @@ HRESULT WINAPI SourceSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFo
HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const GUID * pFormat)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
HRESULT hr = S_OK;
TRACE("(%s)\n", debugstr_guid(pFormat));
@ -131,7 +136,7 @@ HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const
HRESULT WINAPI SourceSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID * pFormat)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("%p %s\n", This, debugstr_guid(pFormat));
return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : E_INVALIDARG);
}
@ -139,7 +144,7 @@ HRESULT WINAPI SourceSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID
HRESULT WINAPI SourceSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * pDuration)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", pDuration);
@ -152,7 +157,7 @@ HRESULT WINAPI SourceSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * p
HRESULT WINAPI SourceSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG * pStop)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", pStop);
@ -166,7 +171,7 @@ HRESULT WINAPI SourceSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG
/* FIXME: Make use of the info the filter should expose */
HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGLONG * pCurrent)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", pCurrent);
@ -179,7 +184,7 @@ HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGL
HRESULT WINAPI SourceSeekingImpl_ConvertTimeFormat(IMediaSeeking * iface, LONGLONG * pTarget, const GUID * pTargetFormat, LONGLONG Source, const GUID * pSourceFormat)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
if (!pTargetFormat)
pTargetFormat = &This->timeformat;
if (!pSourceFormat)
@ -212,7 +217,7 @@ static inline LONGLONG Adjust(LONGLONG value, const LONGLONG * pModifier, DWORD
HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, DWORD dwCurrentFlags, LONGLONG * pStop, DWORD dwStopFlags)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
BOOL bChangeCurrent = FALSE, bChangeStop = FALSE;
LONGLONG llNewCurrent, llNewStop;
@ -248,7 +253,7 @@ HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG *
HRESULT WINAPI SourceSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, LONGLONG * pStop)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p, %p)\n", pCurrent, pStop);
@ -262,7 +267,7 @@ HRESULT WINAPI SourceSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG *
HRESULT WINAPI SourceSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG * pEarliest, LONGLONG * pLatest)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p, %p)\n", pEarliest, pLatest);
@ -276,7 +281,7 @@ HRESULT WINAPI SourceSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG *
HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
BOOL bChangeRate = (dRate != This->dRate);
HRESULT hr = S_OK;
@ -299,7 +304,7 @@ HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate)
HRESULT WINAPI SourceSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate)
{
SourceSeeking *This = (SourceSeeking *)iface;
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", dRate);

View File

@ -998,7 +998,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI
}
static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface ) {
return (GSTOutPin *)((char*)iface - FIELD_OFFSET(GSTOutPin, seek.lpVtbl));
return CONTAINING_RECORD(iface, GSTOutPin, seek.IMediaSeeking_iface);
}
static IPin* WINAPI GST_GetPin(BaseFilter *iface, int pos)

View File

@ -185,7 +185,7 @@ static HRESULT WINAPI QTSplitter_ChangeRate(IMediaSeeking *iface);
static inline QTSplitter *impl_from_IMediaSeeking( IMediaSeeking *iface )
{
return (QTSplitter *)((char*)iface - FIELD_OFFSET(QTSplitter, sourceSeeking.lpVtbl));
return CONTAINING_RECORD(iface, QTSplitter, sourceSeeking.IMediaSeeking_iface);
}
/*

View File

@ -287,7 +287,7 @@ typedef HRESULT (WINAPI *SourceSeeking_ChangeStop)(IMediaSeeking *iface);
typedef struct SourceSeeking
{
const IMediaSeekingVtbl * lpVtbl;
IMediaSeeking IMediaSeeking_iface;
ULONG refCount;
SourceSeeking_ChangeStop fnChangeStop;