avifil32: Use an iface instead of a vtbl pointer in IAVIStreamImpl.

This commit is contained in:
Michael Stefaniuc 2010-12-27 23:12:14 +01:00 committed by Alexandre Julliard
parent 13e1997860
commit a45ae7ba88
1 changed files with 22 additions and 17 deletions

View File

@ -72,8 +72,8 @@ static const struct IAVIStreamVtbl iicmst = {
typedef struct _IAVIStreamImpl {
/* IUnknown stuff */
const IAVIStreamVtbl *lpVtbl;
LONG ref;
IAVIStream IAVIStream_iface;
LONG ref;
/* IAVIStream stuff */
PAVISTREAM pStream;
@ -107,6 +107,11 @@ static HRESULT AVIFILE_EncodeFrame(IAVIStreamImpl *This,
LPBITMAPINFOHEADER lpbi, LPVOID lpBits);
static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This);
static inline IAVIStreamImpl *impl_from_IAVIStream(IAVIStream *iface)
{
return CONTAINING_RECORD(iface, IAVIStreamImpl, IAVIStream_iface);
}
static inline void AVIFILE_Reset(IAVIStreamImpl *This)
{
This->lCurrent = -1;
@ -128,10 +133,10 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
if (pstream == NULL)
return AVIERR_MEMORY;
pstream->lpVtbl = &iicmst;
pstream->IAVIStream_iface.lpVtbl = &iicmst;
AVIFILE_Reset(pstream);
hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv);
hr = IAVIStream_QueryInterface(&pstream->IAVIStream_iface, riid, ppv);
if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, pstream);
@ -141,7 +146,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
static HRESULT WINAPI ICMStream_fnQueryInterface(IAVIStream *iface,
REFIID refiid, LPVOID *obj)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(refiid), obj);
@ -158,7 +163,7 @@ static HRESULT WINAPI ICMStream_fnQueryInterface(IAVIStream *iface,
static ULONG WINAPI ICMStream_fnAddRef(IAVIStream *iface)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) -> %d\n", iface, ref);
@ -172,7 +177,7 @@ static ULONG WINAPI ICMStream_fnAddRef(IAVIStream *iface)
static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) -> %d\n", iface, ref);
@ -231,7 +236,7 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
static HRESULT WINAPI ICMStream_fnCreate(IAVIStream *iface, LPARAM lParam1,
LPARAM lParam2)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
ICINFO icinfo;
ICCOMPRESSFRAMES icFrames;
@ -320,7 +325,7 @@ static HRESULT WINAPI ICMStream_fnCreate(IAVIStream *iface, LPARAM lParam1,
static HRESULT WINAPI ICMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi,
LONG size)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%p,%d)\n", iface, psi, size);
@ -339,7 +344,7 @@ static HRESULT WINAPI ICMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi,
static LONG WINAPI ICMStream_fnFindSample(IAVIStream *iface, LONG pos,
LONG flags)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%d,0x%08X)\n",iface,pos,flags);
@ -376,7 +381,7 @@ static LONG WINAPI ICMStream_fnFindSample(IAVIStream *iface, LONG pos,
static HRESULT WINAPI ICMStream_fnReadFormat(IAVIStream *iface, LONG pos,
LPVOID format, LONG *formatsize)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
LPBITMAPINFOHEADER lpbi;
HRESULT hr;
@ -427,7 +432,7 @@ static HRESULT WINAPI ICMStream_fnReadFormat(IAVIStream *iface, LONG pos,
static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
LPVOID format, LONG formatsize)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%d,%p,%d)\n", iface, pos, format, formatsize);
@ -579,7 +584,7 @@ static HRESULT WINAPI ICMStream_fnRead(IAVIStream *iface, LONG start,
LONG buffersize, LPLONG bytesread,
LPLONG samplesread)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
LPBITMAPINFOHEADER lpbi;
@ -673,7 +678,7 @@ static HRESULT WINAPI ICMStream_fnWrite(IAVIStream *iface, LONG start,
LPLONG sampwritten,
LPLONG byteswritten)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
HRESULT hr;
@ -718,7 +723,7 @@ static HRESULT WINAPI ICMStream_fnWrite(IAVIStream *iface, LONG start,
static HRESULT WINAPI ICMStream_fnDelete(IAVIStream *iface, LONG start,
LONG samples)
{
IAVIStreamImpl *This = (IAVIStreamImpl *)iface;
IAVIStreamImpl *This = impl_from_IAVIStream(iface);
TRACE("(%p,%d,%d)\n", iface, start, samples);
@ -728,7 +733,7 @@ static HRESULT WINAPI ICMStream_fnDelete(IAVIStream *iface, LONG start,
static HRESULT WINAPI ICMStream_fnReadData(IAVIStream *iface, DWORD fcc,
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);
@ -740,7 +745,7 @@ static HRESULT WINAPI ICMStream_fnReadData(IAVIStream *iface, DWORD fcc,
static HRESULT WINAPI ICMStream_fnWriteData(IAVIStream *iface, DWORD fcc,
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);