Commit d3c5b2c4 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

strmbase: COM cleanup for cleanup SourceSeeking.

parent eb5d8b96
...@@ -102,7 +102,7 @@ struct thread_args { ...@@ -102,7 +102,7 @@ struct thread_args {
static inline AVISplitterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) 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 /* The threading stuff cries for an explanation
......
...@@ -78,7 +78,7 @@ typedef struct MPEGSplitterImpl ...@@ -78,7 +78,7 @@ typedef struct MPEGSplitterImpl
static inline MPEGSplitterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) 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) static int MPEGSplitter_head_check(const BYTE *header)
......
...@@ -50,7 +50,7 @@ static HRESULT WINAPI Parser_OutputPin_BreakConnect(BaseOutputPin *This); ...@@ -50,7 +50,7 @@ static HRESULT WINAPI Parser_OutputPin_BreakConnect(BaseOutputPin *This);
static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) 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 */ /* FIXME: WRONG */
......
...@@ -50,7 +50,7 @@ typedef struct WAVEParserImpl ...@@ -50,7 +50,7 @@ typedef struct WAVEParserImpl
static inline WAVEParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) 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) static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)
......
...@@ -32,11 +32,16 @@ ...@@ -32,11 +32,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase); 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) 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); assert(fnChangeStop && fnChangeStart && fnChangeRate);
pSeeking->lpVtbl = Vtbl; pSeeking->IMediaSeeking_iface.lpVtbl = Vtbl;
pSeeking->refCount = 1; pSeeking->refCount = 1;
pSeeking->fnChangeRate = fnChangeRate; pSeeking->fnChangeRate = fnChangeRate;
pSeeking->fnChangeStop = fnChangeStop; pSeeking->fnChangeStop = fnChangeStop;
...@@ -57,7 +62,7 @@ HRESULT SourceSeeking_Init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtb ...@@ -57,7 +62,7 @@ HRESULT SourceSeeking_Init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtb
HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities) HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
{ {
SourceSeeking *This = (SourceSeeking *)iface; SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", pCapabilities); TRACE("(%p)\n", pCapabilities);
...@@ -68,7 +73,7 @@ HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * ...@@ -68,7 +73,7 @@ HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD *
HRESULT WINAPI SourceSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * pCapabilities) HRESULT WINAPI SourceSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
{ {
SourceSeeking *This = (SourceSeeking *)iface; SourceSeeking *This = impl_from_IMediaSeeking(iface);
HRESULT hr; HRESULT hr;
DWORD dwCommonCaps; DWORD dwCommonCaps;
...@@ -104,7 +109,7 @@ HRESULT WINAPI SourceSeekingImpl_QueryPreferredFormat(IMediaSeeking * iface, GUI ...@@ -104,7 +109,7 @@ HRESULT WINAPI SourceSeekingImpl_QueryPreferredFormat(IMediaSeeking * iface, GUI
HRESULT WINAPI SourceSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFormat) HRESULT WINAPI SourceSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFormat)
{ {
SourceSeeking *This = (SourceSeeking *)iface; SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%s)\n", debugstr_guid(pFormat)); TRACE("(%s)\n", debugstr_guid(pFormat));
EnterCriticalSection(This->crst); EnterCriticalSection(This->crst);
...@@ -116,7 +121,7 @@ HRESULT WINAPI SourceSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFo ...@@ -116,7 +121,7 @@ HRESULT WINAPI SourceSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFo
HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const GUID * pFormat) HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const GUID * pFormat)
{ {
SourceSeeking *This = (SourceSeeking *)iface; SourceSeeking *This = impl_from_IMediaSeeking(iface);
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%s)\n", debugstr_guid(pFormat)); TRACE("(%s)\n", debugstr_guid(pFormat));
...@@ -131,7 +136,7 @@ HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const ...@@ -131,7 +136,7 @@ HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const
HRESULT WINAPI SourceSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID * pFormat) 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)); TRACE("%p %s\n", This, debugstr_guid(pFormat));
return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : E_INVALIDARG); return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : E_INVALIDARG);
} }
...@@ -139,7 +144,7 @@ HRESULT WINAPI SourceSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID ...@@ -139,7 +144,7 @@ HRESULT WINAPI SourceSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID
HRESULT WINAPI SourceSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * pDuration) HRESULT WINAPI SourceSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * pDuration)
{ {
SourceSeeking *This = (SourceSeeking *)iface; SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", pDuration); TRACE("(%p)\n", pDuration);
...@@ -152,7 +157,7 @@ HRESULT WINAPI SourceSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * p ...@@ -152,7 +157,7 @@ HRESULT WINAPI SourceSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * p
HRESULT WINAPI SourceSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG * pStop) HRESULT WINAPI SourceSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG * pStop)
{ {
SourceSeeking *This = (SourceSeeking *)iface; SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", pStop); TRACE("(%p)\n", pStop);
...@@ -166,7 +171,7 @@ HRESULT WINAPI SourceSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG ...@@ -166,7 +171,7 @@ HRESULT WINAPI SourceSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG
/* FIXME: Make use of the info the filter should expose */ /* FIXME: Make use of the info the filter should expose */
HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGLONG * pCurrent) HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGLONG * pCurrent)
{ {
SourceSeeking *This = (SourceSeeking *)iface; SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%p)\n", pCurrent); TRACE("(%p)\n", pCurrent);
...@@ -179,7 +184,7 @@ HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGL ...@@ -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) 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) if (!pTargetFormat)
pTargetFormat = &This->timeformat; pTargetFormat = &This->timeformat;
if (!pSourceFormat) if (!pSourceFormat)
...@@ -212,7 +217,7 @@ static inline LONGLONG Adjust(LONGLONG value, const LONGLONG * pModifier, DWORD ...@@ -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) 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; BOOL bChangeCurrent = FALSE, bChangeStop = FALSE;
LONGLONG llNewCurrent, llNewStop; LONGLONG llNewCurrent, llNewStop;
...@@ -248,7 +253,7 @@ HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * ...@@ -248,7 +253,7 @@ HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG *
HRESULT WINAPI SourceSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, LONGLONG * pStop) 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); TRACE("(%p, %p)\n", pCurrent, pStop);
...@@ -262,7 +267,7 @@ HRESULT WINAPI SourceSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG * ...@@ -262,7 +267,7 @@ HRESULT WINAPI SourceSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG *
HRESULT WINAPI SourceSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG * pEarliest, LONGLONG * pLatest) 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); TRACE("(%p, %p)\n", pEarliest, pLatest);
...@@ -276,7 +281,7 @@ HRESULT WINAPI SourceSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG * ...@@ -276,7 +281,7 @@ HRESULT WINAPI SourceSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG *
HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate) HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate)
{ {
SourceSeeking *This = (SourceSeeking *)iface; SourceSeeking *This = impl_from_IMediaSeeking(iface);
BOOL bChangeRate = (dRate != This->dRate); BOOL bChangeRate = (dRate != This->dRate);
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -299,7 +304,7 @@ HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate) ...@@ -299,7 +304,7 @@ HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate)
HRESULT WINAPI SourceSeekingImpl_GetRate(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); TRACE("(%p)\n", dRate);
......
...@@ -998,7 +998,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI ...@@ -998,7 +998,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI
} }
static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface ) { 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) static IPin* WINAPI GST_GetPin(BaseFilter *iface, int pos)
......
...@@ -185,7 +185,7 @@ static HRESULT WINAPI QTSplitter_ChangeRate(IMediaSeeking *iface); ...@@ -185,7 +185,7 @@ static HRESULT WINAPI QTSplitter_ChangeRate(IMediaSeeking *iface);
static inline QTSplitter *impl_from_IMediaSeeking( 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);
} }
/* /*
......
...@@ -287,7 +287,7 @@ typedef HRESULT (WINAPI *SourceSeeking_ChangeStop)(IMediaSeeking *iface); ...@@ -287,7 +287,7 @@ typedef HRESULT (WINAPI *SourceSeeking_ChangeStop)(IMediaSeeking *iface);
typedef struct SourceSeeking typedef struct SourceSeeking
{ {
const IMediaSeekingVtbl * lpVtbl; IMediaSeeking IMediaSeeking_iface;
ULONG refCount; ULONG refCount;
SourceSeeking_ChangeStop fnChangeStop; SourceSeeking_ChangeStop fnChangeStop;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment