avifil32: COM cleanup for acmstream.c.

This commit is contained in:
Michael Stefaniuc 2011-01-12 11:19:49 +01:00 committed by Alexandre Julliard
parent 97fa635fc7
commit 1f8e505dc2
1 changed files with 21 additions and 16 deletions

View File

@ -70,7 +70,7 @@ static const struct IAVIStreamVtbl iacmst = {
typedef struct _IAVIStreamImpl { typedef struct _IAVIStreamImpl {
/* IUnknown stuff */ /* IUnknown stuff */
const IAVIStreamVtbl *lpVtbl; IAVIStream IAVIStream_iface;
LONG ref; LONG ref;
/* IAVIStream stuff */ /* IAVIStream stuff */
@ -117,19 +117,24 @@ HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv)
if (pstream == NULL) if (pstream == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
pstream->lpVtbl = &iacmst; pstream->IAVIStream_iface.lpVtbl = &iacmst;
hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv); hr = IAVIStream_QueryInterface(&pstream->IAVIStream_iface, riid, ppv);
if (FAILED(hr)) if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, pstream); HeapFree(GetProcessHeap(), 0, pstream);
return hr; return hr;
} }
static inline IAVIStreamImpl *impl_from_IAVIStream(IAVIStream *iface)
{
return CONTAINING_RECORD(iface, IAVIStreamImpl, IAVIStream_iface);
}
static HRESULT WINAPI ACMStream_fnQueryInterface(IAVIStream *iface, static HRESULT WINAPI ACMStream_fnQueryInterface(IAVIStream *iface,
REFIID refiid, LPVOID *obj) REFIID refiid, LPVOID *obj)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(refiid), obj); TRACE("(%p,%s,%p)\n", iface, debugstr_guid(refiid), obj);
@ -146,7 +151,7 @@ static HRESULT WINAPI ACMStream_fnQueryInterface(IAVIStream *iface,
static ULONG WINAPI ACMStream_fnAddRef(IAVIStream *iface) static ULONG WINAPI ACMStream_fnAddRef(IAVIStream *iface)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) -> %d\n", iface, ref); TRACE("(%p) -> %d\n", iface, ref);
@ -160,7 +165,7 @@ static ULONG WINAPI ACMStream_fnAddRef(IAVIStream *iface)
static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface) static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) -> %d\n", iface, ref); TRACE("(%p) -> %d\n", iface, ref);
@ -209,7 +214,7 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1, static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1,
LPARAM lParam2) LPARAM lParam2)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,0x%08lX,0x%08lX)\n", iface, lParam1, lParam2); TRACE("(%p,0x%08lX,0x%08lX)\n", iface, lParam1, lParam2);
@ -262,7 +267,7 @@ static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1,
static HRESULT WINAPI ACMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi, static HRESULT WINAPI ACMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi,
LONG size) LONG size)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%p,%d)\n", iface, psi, size); TRACE("(%p,%p,%d)\n", iface, psi, size);
@ -289,7 +294,7 @@ static HRESULT WINAPI ACMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi,
static LONG WINAPI ACMStream_fnFindSample(IAVIStream *iface, LONG pos, static LONG WINAPI ACMStream_fnFindSample(IAVIStream *iface, LONG pos,
LONG flags) LONG flags)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%d,0x%08X)\n",iface,pos,flags); TRACE("(%p,%d,0x%08X)\n",iface,pos,flags);
@ -317,7 +322,7 @@ static LONG WINAPI ACMStream_fnFindSample(IAVIStream *iface, LONG pos,
static HRESULT WINAPI ACMStream_fnReadFormat(IAVIStream *iface, LONG pos, static HRESULT WINAPI ACMStream_fnReadFormat(IAVIStream *iface, LONG pos,
LPVOID format, LONG *formatsize) LPVOID format, LONG *formatsize)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%d,%p,%p)\n", iface, pos, format, formatsize); TRACE("(%p,%d,%p,%p)\n", iface, pos, format, formatsize);
@ -352,7 +357,7 @@ static HRESULT WINAPI ACMStream_fnReadFormat(IAVIStream *iface, LONG pos,
static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream *iface, LONG pos, static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream *iface, LONG pos,
LPVOID format, LONG formatsize) LPVOID format, LONG formatsize)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
HRESULT hr; HRESULT hr;
@ -399,7 +404,7 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start,
LONG buffersize, LPLONG bytesread, LONG buffersize, LPLONG bytesread,
LPLONG samplesread) LPLONG samplesread)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
HRESULT hr; HRESULT hr;
DWORD size; DWORD size;
@ -520,7 +525,7 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start,
LPLONG sampwritten, LPLONG sampwritten,
LPLONG byteswritten) LPLONG byteswritten)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
HRESULT hr; HRESULT hr;
ULONG size; ULONG size;
@ -613,7 +618,7 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start,
static HRESULT WINAPI ACMStream_fnDelete(IAVIStream *iface, LONG start, static HRESULT WINAPI ACMStream_fnDelete(IAVIStream *iface, LONG start,
LONG samples) LONG samples)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%d,%d)\n", iface, start, samples); TRACE("(%p,%d,%d)\n", iface, start, samples);
@ -647,7 +652,7 @@ static HRESULT WINAPI ACMStream_fnDelete(IAVIStream *iface, LONG start,
static HRESULT WINAPI ACMStream_fnReadData(IAVIStream *iface, DWORD fcc, static HRESULT WINAPI ACMStream_fnReadData(IAVIStream *iface, DWORD fcc,
LPVOID lp, LPLONG lpread) LPVOID lp, LPLONG lpread)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,0x%08X,%p,%p)\n", iface, fcc, lp, lpread); TRACE("(%p,0x%08X,%p,%p)\n", iface, fcc, lp, lpread);
@ -659,7 +664,7 @@ static HRESULT WINAPI ACMStream_fnReadData(IAVIStream *iface, DWORD fcc,
static HRESULT WINAPI ACMStream_fnWriteData(IAVIStream *iface, DWORD fcc, static HRESULT WINAPI ACMStream_fnWriteData(IAVIStream *iface, DWORD fcc,
LPVOID lp, LONG size) LPVOID lp, LONG size)
{ {
IAVIStreamImpl *This = (IAVIStreamImpl *)iface; IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,0x%08x,%p,%d)\n", iface, fcc, lp, size); TRACE("(%p,0x%08x,%p,%d)\n", iface, fcc, lp, size);