Commit b904b694 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

quartz: COM cleanup for IMediaSample2.

parent bb684aab
......@@ -31,6 +31,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
typedef struct StdMediaSample2
{
IMediaSample2 IMediaSample2_iface;
LONG ref;
AM_SAMPLE2_PROPERTIES props;
IMemAllocator * pParent;
struct list listentry;
LONGLONG tMediaStart;
LONGLONG tMediaEnd;
} StdMediaSample2;
typedef struct BaseMemAllocator
{
IMemAllocator IMemAllocator_iface;
......@@ -413,7 +424,7 @@ static HRESULT StdMediaSample2_Construct(BYTE * pbBuffer, LONG cbBuffer, IMemAll
if (!(*ppSample = CoTaskMemAlloc(sizeof(StdMediaSample2))))
return E_OUTOFMEMORY;
(*ppSample)->lpvtbl = &StdMediaSample2_VTable;
(*ppSample)->IMediaSample2_iface.lpVtbl = &StdMediaSample2_VTable;
(*ppSample)->ref = 0;
ZeroMemory(&(*ppSample)->props, sizeof((*ppSample)->props));
......@@ -436,47 +447,45 @@ static void StdMediaSample2_Delete(StdMediaSample2 * This)
CoTaskMemFree(This);
}
static HRESULT WINAPI StdMediaSample2_QueryInterface(IMediaSample2 * iface, REFIID riid, LPVOID * ppv)
static inline StdMediaSample2 *impl_from_IMediaSample2(IMediaSample2 * iface)
{
return CONTAINING_RECORD(iface, StdMediaSample2, IMediaSample2_iface);
}
static HRESULT WINAPI StdMediaSample2_QueryInterface(IMediaSample2 * iface, REFIID riid, void ** ppv)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
TRACE("(%s, %p)\n", qzdebugstr_guid(riid), ppv);
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown))
*ppv = This;
else if (IsEqualIID(riid, &IID_IMediaSample))
*ppv = This;
else if (IsEqualIID(riid, &IID_IMediaSample2))
*ppv = This;
if (*ppv)
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMediaSample) ||
IsEqualIID(riid, &IID_IMediaSample2))
{
IUnknown_AddRef((IUnknown *)(*ppv));
*ppv = iface;
IMediaSample2_AddRef(iface);
return S_OK;
}
FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI StdMediaSample2_AddRef(IMediaSample2 * iface)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->() AddRef from %d\n", iface, ref - 1);
TRACE("(%p)->(): new ref = %d\n", This, ref);
return ref;
}
static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() Release from %d\n", iface, ref + 1);
TRACE("(%p)->(): new ref = %d\n", This, ref);
if (!ref)
{
......@@ -484,14 +493,13 @@ static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
else
StdMediaSample2_Delete(This);
return 0;
}
return ref;
}
static HRESULT WINAPI StdMediaSample2_GetPointer(IMediaSample2 * iface, BYTE ** ppBuffer)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%p)\n", iface, ppBuffer);
......@@ -508,7 +516,7 @@ static HRESULT WINAPI StdMediaSample2_GetPointer(IMediaSample2 * iface, BYTE **
static LONG WINAPI StdMediaSample2_GetSize(IMediaSample2 * iface)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("StdMediaSample2_GetSize()\n");
......@@ -517,8 +525,8 @@ static LONG WINAPI StdMediaSample2_GetSize(IMediaSample2 * iface)
static HRESULT WINAPI StdMediaSample2_GetTime(IMediaSample2 * iface, REFERENCE_TIME * pStart, REFERENCE_TIME * pEnd)
{
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
HRESULT hr;
StdMediaSample2 *This = (StdMediaSample2 *)iface;
TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
......@@ -544,7 +552,7 @@ static HRESULT WINAPI StdMediaSample2_GetTime(IMediaSample2 * iface, REFERENCE_T
static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 * iface, REFERENCE_TIME * pStart, REFERENCE_TIME * pEnd)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
......@@ -569,7 +577,7 @@ static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 * iface, REFERENCE_T
static HRESULT WINAPI StdMediaSample2_IsSyncPoint(IMediaSample2 * iface)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->()\n", iface);
......@@ -578,7 +586,7 @@ static HRESULT WINAPI StdMediaSample2_IsSyncPoint(IMediaSample2 * iface)
static HRESULT WINAPI StdMediaSample2_SetSyncPoint(IMediaSample2 * iface, BOOL bIsSyncPoint)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%s)\n", iface, bIsSyncPoint ? "TRUE" : "FALSE");
......@@ -592,7 +600,7 @@ static HRESULT WINAPI StdMediaSample2_SetSyncPoint(IMediaSample2 * iface, BOOL b
static HRESULT WINAPI StdMediaSample2_IsPreroll(IMediaSample2 * iface)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->()\n", iface);
......@@ -601,7 +609,7 @@ static HRESULT WINAPI StdMediaSample2_IsPreroll(IMediaSample2 * iface)
static HRESULT WINAPI StdMediaSample2_SetPreroll(IMediaSample2 * iface, BOOL bIsPreroll)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%s)\n", iface, bIsPreroll ? "TRUE" : "FALSE");
......@@ -615,7 +623,7 @@ static HRESULT WINAPI StdMediaSample2_SetPreroll(IMediaSample2 * iface, BOOL bIs
static LONG WINAPI StdMediaSample2_GetActualDataLength(IMediaSample2 * iface)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->()\n", iface);
......@@ -624,7 +632,7 @@ static LONG WINAPI StdMediaSample2_GetActualDataLength(IMediaSample2 * iface)
static HRESULT WINAPI StdMediaSample2_SetActualDataLength(IMediaSample2 * iface, LONG len)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%d)\n", iface, len);
......@@ -642,7 +650,7 @@ static HRESULT WINAPI StdMediaSample2_SetActualDataLength(IMediaSample2 * iface,
static HRESULT WINAPI StdMediaSample2_GetMediaType(IMediaSample2 * iface, AM_MEDIA_TYPE ** ppMediaType)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%p)\n", iface, ppMediaType);
......@@ -661,7 +669,7 @@ static HRESULT WINAPI StdMediaSample2_GetMediaType(IMediaSample2 * iface, AM_MED
static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 * iface, AM_MEDIA_TYPE * pMediaType)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%p)\n", iface, pMediaType);
......@@ -680,7 +688,7 @@ static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 * iface, AM_MED
static HRESULT WINAPI StdMediaSample2_IsDiscontinuity(IMediaSample2 * iface)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->()\n", iface);
......@@ -689,7 +697,7 @@ static HRESULT WINAPI StdMediaSample2_IsDiscontinuity(IMediaSample2 * iface)
static HRESULT WINAPI StdMediaSample2_SetDiscontinuity(IMediaSample2 * iface, BOOL bIsDiscontinuity)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%s)\n", iface, bIsDiscontinuity ? "TRUE" : "FALSE");
......@@ -703,7 +711,7 @@ static HRESULT WINAPI StdMediaSample2_SetDiscontinuity(IMediaSample2 * iface, BO
static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 * iface, LONGLONG * pStart, LONGLONG * pEnd)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
......@@ -718,7 +726,7 @@ static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 * iface, LONGLO
static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 * iface, LONGLONG * pStart, LONGLONG * pEnd)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
......@@ -737,7 +745,7 @@ static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 * iface, LONGLO
static HRESULT WINAPI StdMediaSample2_GetProperties(IMediaSample2 * iface, DWORD cbProperties, BYTE * pbProperties)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%d, %p)\n", iface, cbProperties, pbProperties);
......@@ -748,7 +756,7 @@ static HRESULT WINAPI StdMediaSample2_GetProperties(IMediaSample2 * iface, DWORD
static HRESULT WINAPI StdMediaSample2_SetProperties(IMediaSample2 * iface, DWORD cbProperties, const BYTE * pbProperties)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%d, %p)\n", iface, cbProperties, pbProperties);
......
......@@ -67,16 +67,4 @@ extern void video_unregister_windowclass(void) DECLSPEC_HIDDEN;
BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, BOOL bWildcards);
void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt) DECLSPEC_HIDDEN;
typedef struct StdMediaSample2
{
const IMediaSample2Vtbl * lpvtbl;
LONG ref;
AM_SAMPLE2_PROPERTIES props;
IMemAllocator * pParent;
struct list listentry;
LONGLONG tMediaStart;
LONGLONG tMediaEnd;
} StdMediaSample2;
#endif /* __QUARTZ_PRIVATE_INCLUDED__ */
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