ReactOS 0.4.17-dev-966-gf06eace
memallocator.c File Reference
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "vfwmsgs.h"
#include "quartz_private.h"
#include "wine/debug.h"
Include dependency graph for memallocator.c:

Go to the source code of this file.

Classes

struct  StdMediaSample2
 
struct  BaseMemAllocator
 
struct  StdMemAllocator
 

Macros

#define AM_SAMPLE2_PROP_SIZE_WRITABLE   FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer)
 

Typedefs

typedef struct StdMediaSample2 StdMediaSample2
 
typedef struct BaseMemAllocator BaseMemAllocator
 
typedef struct StdMemAllocator StdMemAllocator
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static BaseMemAllocator * impl_from_IMemAllocator (IMemAllocator *iface)
 
static StdMediaSample2 * unsafe_impl_from_IMediaSample (IMediaSample *iface)
 
static HRESULT BaseMemAllocator_Init (HRESULT(*fnAlloc)(IMemAllocator *), HRESULT(*fnFree)(IMemAllocator *), HRESULT(*fnVerify)(IMemAllocator *, ALLOCATOR_PROPERTIES *), HRESULT(*fnBufferPrepare)(IMemAllocator *, StdMediaSample2 *, DWORD), HRESULT(*fnBufferReleased)(IMemAllocator *, StdMediaSample2 *), void(*fnDestroyed)(IMemAllocator *), CRITICAL_SECTION *pCritSect, BaseMemAllocator *pMemAlloc)
 
static HRESULT WINAPI BaseMemAllocator_QueryInterface (IMemAllocator *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI BaseMemAllocator_AddRef (IMemAllocator *iface)
 
static ULONG WINAPI BaseMemAllocator_Release (IMemAllocator *iface)
 
static HRESULT WINAPI BaseMemAllocator_SetProperties (IMemAllocator *iface, ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual)
 
static HRESULT WINAPI BaseMemAllocator_GetProperties (IMemAllocator *iface, ALLOCATOR_PROPERTIES *pProps)
 
static HRESULT WINAPI BaseMemAllocator_Commit (IMemAllocator *iface)
 
static HRESULT WINAPI BaseMemAllocator_Decommit (IMemAllocator *iface)
 
static HRESULT WINAPI BaseMemAllocator_GetBuffer (IMemAllocator *iface, IMediaSample **pSample, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime, DWORD dwFlags)
 
static HRESULT WINAPI BaseMemAllocator_ReleaseBuffer (IMemAllocator *iface, IMediaSample *pSample)
 
static HRESULT StdMediaSample2_Construct (BYTE *pbBuffer, LONG cbBuffer, IMemAllocator *pParent, StdMediaSample2 **ppSample)
 
static void StdMediaSample2_Delete (StdMediaSample2 *This)
 
static StdMediaSample2 * impl_from_IMediaSample2 (IMediaSample2 *iface)
 
static HRESULT WINAPI StdMediaSample2_QueryInterface (IMediaSample2 *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI StdMediaSample2_AddRef (IMediaSample2 *iface)
 
static ULONG WINAPI StdMediaSample2_Release (IMediaSample2 *iface)
 
static HRESULT WINAPI StdMediaSample2_GetPointer (IMediaSample2 *iface, BYTE **ppBuffer)
 
static LONG WINAPI StdMediaSample2_GetSize (IMediaSample2 *iface)
 
static HRESULT WINAPI StdMediaSample2_GetTime (IMediaSample2 *iface, REFERENCE_TIME *pStart, REFERENCE_TIME *pEnd)
 
static HRESULT WINAPI StdMediaSample2_SetTime (IMediaSample2 *iface, REFERENCE_TIME *start, REFERENCE_TIME *end)
 
static HRESULT WINAPI StdMediaSample2_IsSyncPoint (IMediaSample2 *iface)
 
static HRESULT WINAPI StdMediaSample2_SetSyncPoint (IMediaSample2 *iface, BOOL bIsSyncPoint)
 
static HRESULT WINAPI StdMediaSample2_IsPreroll (IMediaSample2 *iface)
 
static HRESULT WINAPI StdMediaSample2_SetPreroll (IMediaSample2 *iface, BOOL bIsPreroll)
 
static LONG WINAPI StdMediaSample2_GetActualDataLength (IMediaSample2 *iface)
 
static HRESULT WINAPI StdMediaSample2_SetActualDataLength (IMediaSample2 *iface, LONG len)
 
static HRESULT WINAPI StdMediaSample2_GetMediaType (IMediaSample2 *iface, AM_MEDIA_TYPE **ppMediaType)
 
static HRESULT WINAPI StdMediaSample2_SetMediaType (IMediaSample2 *iface, AM_MEDIA_TYPE *pMediaType)
 
static HRESULT WINAPI StdMediaSample2_IsDiscontinuity (IMediaSample2 *iface)
 
static HRESULT WINAPI StdMediaSample2_SetDiscontinuity (IMediaSample2 *iface, BOOL bIsDiscontinuity)
 
static HRESULT WINAPI StdMediaSample2_GetMediaTime (IMediaSample2 *iface, LONGLONG *pStart, LONGLONG *pEnd)
 
static HRESULT WINAPI StdMediaSample2_SetMediaTime (IMediaSample2 *iface, LONGLONG *start, LONGLONG *end)
 
static HRESULT WINAPI StdMediaSample2_GetProperties (IMediaSample2 *iface, DWORD cbProperties, BYTE *pbProperties)
 
static HRESULT WINAPI StdMediaSample2_SetProperties (IMediaSample2 *iface, DWORD cbProperties, const BYTE *pbProperties)
 
static StdMemAllocator * StdMemAllocator_from_IMemAllocator (IMemAllocator *iface)
 
static HRESULT StdMemAllocator_Alloc (IMemAllocator *iface)
 
static HRESULT StdMemAllocator_Free (IMemAllocator *iface)
 
static void StdMemAllocator_Destroy (IMemAllocator *iface)
 
HRESULT mem_allocator_create (IUnknown *lpUnkOuter, IUnknown **out)
 

Variables

static const IMemAllocatorVtbl BaseMemAllocator_VTable
 
static const IMediaSample2Vtbl StdMediaSample2_VTable
 

Macro Definition Documentation

◆ AM_SAMPLE2_PROP_SIZE_WRITABLE

#define AM_SAMPLE2_PROP_SIZE_WRITABLE   FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, pbBuffer)

Definition at line 76 of file memallocator.c.

Typedef Documentation

◆ BaseMemAllocator

◆ StdMediaSample2

◆ StdMemAllocator

Function Documentation

◆ BaseMemAllocator_AddRef()

static ULONG WINAPI BaseMemAllocator_AddRef ( IMemAllocator *  iface)
static

Definition at line 133 of file memallocator.c.

134{
137
138 TRACE("%p increasing refcount to %lu.\n", This, ref);
139
140 return ref;
141}
#define InterlockedIncrement
Definition: armddk.h:53
static BaseMemAllocator * impl_from_IMemAllocator(IMemAllocator *iface)
Definition: memallocator.c:67
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ BaseMemAllocator_Commit()

static HRESULT WINAPI BaseMemAllocator_Commit ( IMemAllocator *  iface)
static

Definition at line 213 of file memallocator.c.

214{
216 HRESULT hr;
217
218 TRACE("(%p)->()\n", This);
219
220 EnterCriticalSection(This->pCritSect);
221 {
222 if (!This->props.cbAlign)
224 else if (!This->props.cbBuffer)
226 else if (!This->props.cBuffers)
228 else if (This->bDecommitQueued && This->bCommitted)
229 {
230 This->bDecommitQueued = FALSE;
231 hr = S_OK;
232 }
233 else if (This->bCommitted)
234 hr = S_OK;
235 else
236 {
237 if (!(This->hSemWaiting = CreateSemaphoreW(NULL, This->props.cBuffers, This->props.cBuffers, NULL)))
238 {
239 ERR("Failed to create semaphore, error %lu.\n", GetLastError());
241 }
242 else
243 {
244 hr = This->fnAlloc(iface);
245 if (SUCCEEDED(hr))
246 This->bCommitted = TRUE;
247 else
248 ERR("Failed to allocate, hr %#lx.\n", hr);
249 }
250 }
251 }
252 LeaveCriticalSection(This->pCritSect);
253
254 return hr;
255}
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:406
#define VFW_E_BADALIGN
Definition: vfwmsgs.h:53
#define VFW_E_SIZENOTSET
Definition: vfwmsgs.h:57
#define VFW_E_BUFFER_NOTSET
Definition: vfwmsgs.h:51
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210

◆ BaseMemAllocator_Decommit()

static HRESULT WINAPI BaseMemAllocator_Decommit ( IMemAllocator *  iface)
static

Definition at line 257 of file memallocator.c.

258{
260 HRESULT hr;
261
262 TRACE("(%p)->()\n", This);
263
264 EnterCriticalSection(This->pCritSect);
265 {
266 if (!This->bCommitted)
267 hr = S_OK;
268 else
269 {
270 if (!list_empty(&This->used_list))
271 {
272 This->bDecommitQueued = TRUE;
273 /* notify ALL waiting threads that they cannot be allocated a buffer any more */
274 ReleaseSemaphore(This->hSemWaiting, This->lWaiting, NULL);
275
276 hr = S_OK;
277 }
278 else
279 {
280 if (This->lWaiting != 0)
281 ERR("Waiting: %ld\n", This->lWaiting);
282
283 This->bCommitted = FALSE;
284 CloseHandle(This->hSemWaiting);
285 This->hSemWaiting = NULL;
286
287 hr = This->fnFree(iface);
288 }
289 }
290 }
291 LeaveCriticalSection(This->pCritSect);
292
293 return hr;
294}
static int list_empty(struct list_entry *head)
Definition: list.h:58
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:491

◆ BaseMemAllocator_GetBuffer()

static HRESULT WINAPI BaseMemAllocator_GetBuffer ( IMemAllocator *  iface,
IMediaSample **  pSample,
REFERENCE_TIME *  pStartTime,
REFERENCE_TIME *  pEndTime,
DWORD  dwFlags 
)
static

Definition at line 296 of file memallocator.c.

297{
299 HRESULT hr = S_OK;
300
301 /* NOTE: The pStartTime and pEndTime parameters are not applied to the sample.
302 * The allocator might use these values to determine which buffer it retrieves */
303
304 TRACE("allocator %p, sample %p, start_time %p, end_time %p, flags %#lx.\n",
305 This, pSample, pStartTime, pEndTime, dwFlags);
306
307 *pSample = NULL;
308
309 EnterCriticalSection(This->pCritSect);
310 if (!This->bCommitted || This->bDecommitQueued)
311 {
312 WARN("Not committed\n");
314 }
315 else
316 ++This->lWaiting;
317 LeaveCriticalSection(This->pCritSect);
318 if (FAILED(hr))
319 return hr;
320
321 if (WaitForSingleObject(This->hSemWaiting, (dwFlags & AM_GBF_NOWAIT) ? 0 : INFINITE) != WAIT_OBJECT_0)
322 {
323 EnterCriticalSection(This->pCritSect);
324 --This->lWaiting;
325 LeaveCriticalSection(This->pCritSect);
326 WARN("Timed out\n");
327 return VFW_E_TIMEOUT;
328 }
329
330 EnterCriticalSection(This->pCritSect);
331 {
332 --This->lWaiting;
333 if (!This->bCommitted)
335 else if (This->bDecommitQueued)
337 else
338 {
339 StdMediaSample2 *ms;
340 struct list * free = list_head(&This->free_list);
342 list_add_head(&This->used_list, free);
343
344 ms = LIST_ENTRY(free, StdMediaSample2, listentry);
345 assert(ms->ref == 0);
346 *pSample = (IMediaSample *)&ms->IMediaSample2_iface;
347 IMediaSample_AddRef(*pSample);
348 }
349 }
350 LeaveCriticalSection(This->pCritSect);
351
352 if (hr != S_OK)
353 WARN("Returning hr %#lx.\n", hr);
354 return hr;
355}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define WARN(fmt,...)
Definition: precomp.h:61
Definition: list.h:39
#define free
Definition: debug_ros.c:5
#define assert(_expr)
Definition: assert.h:32
#define INFINITE
Definition: serial.h:102
#define FAILED(hr)
Definition: intsafe.h:51
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
IMediaSample2 IMediaSample2_iface
Definition: memallocator.c:36
Definition: list.h:15
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define LIST_ENTRY(type)
Definition: queue.h:175
#define VFW_E_NOT_COMMITTED
Definition: vfwmsgs.h:56
#define VFW_E_TIMEOUT
Definition: vfwmsgs.h:85
#define WAIT_OBJECT_0
Definition: winbase.h:383

◆ BaseMemAllocator_GetProperties()

static HRESULT WINAPI BaseMemAllocator_GetProperties ( IMemAllocator *  iface,
ALLOCATOR_PROPERTIES *  pProps 
)
static

Definition at line 198 of file memallocator.c.

199{
201
202 TRACE("(%p)->(%p)\n", This, pProps);
203
204 EnterCriticalSection(This->pCritSect);
205 {
206 memcpy(pProps, &This->props, sizeof(*pProps));
207 }
208 LeaveCriticalSection(This->pCritSect);
209
210 return S_OK;
211}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ BaseMemAllocator_Init()

static HRESULT BaseMemAllocator_Init ( HRESULT(*)(IMemAllocator *)  fnAlloc,
HRESULT(*)(IMemAllocator *)  fnFree,
HRESULT(*)(IMemAllocator *, ALLOCATOR_PROPERTIES *)  fnVerify,
HRESULT(*)(IMemAllocator *, StdMediaSample2 *, DWORD)  fnBufferPrepare,
HRESULT(*)(IMemAllocator *, StdMediaSample2 *)  fnBufferReleased,
void(*)(IMemAllocator *)  fnDestroyed,
CRITICAL_SECTION *  pCritSect,
BaseMemAllocator *  pMemAlloc 
)
static

Definition at line 78 of file memallocator.c.

86{
87 assert(fnAlloc && fnFree && fnDestroyed);
88
90
91 pMemAlloc->ref = 1;
92 ZeroMemory(&pMemAlloc->props, sizeof(pMemAlloc->props));
93 list_init(&pMemAlloc->free_list);
94 list_init(&pMemAlloc->used_list);
95 pMemAlloc->fnAlloc = fnAlloc;
96 pMemAlloc->fnFree = fnFree;
97 pMemAlloc->fnVerify = fnVerify;
98 pMemAlloc->fnBufferPrepare = fnBufferPrepare;
99 pMemAlloc->fnBufferReleased = fnBufferReleased;
100 pMemAlloc->fnDestroyed = fnDestroyed;
101 pMemAlloc->bDecommitQueued = FALSE;
102 pMemAlloc->bCommitted = FALSE;
103 pMemAlloc->hSemWaiting = NULL;
104 pMemAlloc->lWaiting = 0;
105 pMemAlloc->pCritSect = pCritSect;
106
107 return S_OK;
108}
static void list_init(struct list_entry *head)
Definition: list.h:51
static const IMemAllocatorVtbl BaseMemAllocator_VTable
Definition: memallocator.c:72
#define ZeroMemory
Definition: minwinbase.h:31
HRESULT(* fnVerify)(IMemAllocator *, ALLOCATOR_PROPERTIES *)
Definition: memallocator.c:54
HRESULT(* fnFree)(IMemAllocator *)
Definition: memallocator.c:53
void(* fnDestroyed)(IMemAllocator *)
Definition: memallocator.c:57
struct list used_list
Definition: memallocator.c:63
IMemAllocator IMemAllocator_iface
Definition: memallocator.c:48
struct list free_list
Definition: memallocator.c:62
CRITICAL_SECTION * pCritSect
Definition: memallocator.c:64
HRESULT(* fnAlloc)(IMemAllocator *)
Definition: memallocator.c:52
ALLOCATOR_PROPERTIES props
Definition: memallocator.c:51
HRESULT(* fnBufferPrepare)(IMemAllocator *, StdMediaSample2 *, DWORD flags)
Definition: memallocator.c:55
HRESULT(* fnBufferReleased)(IMemAllocator *, StdMediaSample2 *)
Definition: memallocator.c:56

Referenced by mem_allocator_create().

◆ BaseMemAllocator_QueryInterface()

static HRESULT WINAPI BaseMemAllocator_QueryInterface ( IMemAllocator *  iface,
REFIID  riid,
LPVOID *  ppv 
)
static

Definition at line 110 of file memallocator.c.

111{
113 TRACE("(%p)->(%s, %p)\n", This, qzdebugstr_guid(riid), ppv);
114
115 *ppv = NULL;
116
118 *ppv = &This->IMemAllocator_iface;
119 else if (IsEqualIID(riid, &IID_IMemAllocator))
120 *ppv = &This->IMemAllocator_iface;
121
122 if (*ppv)
123 {
124 IUnknown_AddRef((IUnknown *)(*ppv));
125 return S_OK;
126 }
127
128 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
129
130 return E_NOINTERFACE;
131}
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
const char * qzdebugstr_guid(const GUID *id)
Definition: main.c:671
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ BaseMemAllocator_Release()

static ULONG WINAPI BaseMemAllocator_Release ( IMemAllocator *  iface)
static

Definition at line 143 of file memallocator.c.

144{
147
148 TRACE("%p decreasing refcount to %lu.\n", This, ref);
149
150 if (!ref)
151 {
152 CloseHandle(This->hSemWaiting);
153 if (This->bCommitted)
154 This->fnFree(iface);
155
156 This->fnDestroyed(iface);
157 return 0;
158 }
159 return ref;
160}
#define InterlockedDecrement
Definition: armddk.h:52

◆ BaseMemAllocator_ReleaseBuffer()

static HRESULT WINAPI BaseMemAllocator_ReleaseBuffer ( IMemAllocator *  iface,
IMediaSample *  pSample 
)
static

Definition at line 357 of file memallocator.c.

358{
360 StdMediaSample2 * pStdSample = unsafe_impl_from_IMediaSample(pSample);
361 HRESULT hr = S_OK;
362
363 TRACE("(%p)->(%p)\n", This, pSample);
364
365 /* FIXME: make sure that sample is currently on the used list */
366
367 /* FIXME: we should probably check the ref count on the sample before freeing
368 * it to make sure that it is not still in use */
369 EnterCriticalSection(This->pCritSect);
370 {
371 if (!This->bCommitted)
372 ERR("Releasing a buffer when the allocator is not committed?!?\n");
373
374 /* remove from used_list */
375 list_remove(&pStdSample->listentry);
376
377 list_add_head(&This->free_list, &pStdSample->listentry);
378
379 if (list_empty(&This->used_list) && This->bDecommitQueued && This->bCommitted)
380 {
381 if (This->lWaiting != 0)
382 ERR("Waiting: %ld\n", This->lWaiting);
383
384 This->bCommitted = FALSE;
385 This->bDecommitQueued = FALSE;
386
387 CloseHandle(This->hSemWaiting);
388 This->hSemWaiting = NULL;
389
390 This->fnFree(iface);
391 }
392 }
393 LeaveCriticalSection(This->pCritSect);
394
395 /* notify a waiting thread that there is now a free buffer */
396 if (This->hSemWaiting && !ReleaseSemaphore(This->hSemWaiting, 1, NULL))
397 {
398 ERR("Failed to release semaphore, error %lu.\n", GetLastError());
400 }
401
402 return hr;
403}
static StdMediaSample2 * unsafe_impl_from_IMediaSample(IMediaSample *iface)
Definition: memallocator.c:809
struct list listentry
Definition: memallocator.c:40

◆ BaseMemAllocator_SetProperties()

static HRESULT WINAPI BaseMemAllocator_SetProperties ( IMemAllocator *  iface,
ALLOCATOR_PROPERTIES *  pRequest,
ALLOCATOR_PROPERTIES *  pActual 
)
static

Definition at line 162 of file memallocator.c.

163{
165 HRESULT hr;
166
167 TRACE("(%p)->(%p, %p)\n", This, pRequest, pActual);
168
169 TRACE("Requested %ld buffers, size %ld, alignment %ld, prefix %ld.\n",
170 pRequest->cBuffers, pRequest->cbBuffer, pRequest->cbAlign, pRequest->cbPrefix);
171
172 EnterCriticalSection(This->pCritSect);
173 {
174 if (!list_empty(&This->used_list))
176 else if (This->bCommitted)
178 else if (pRequest->cbAlign == 0)
180 else
181 {
182 if (This->fnVerify)
183 hr = This->fnVerify(iface, pRequest);
184 else
185 hr = S_OK;
186
187 if (SUCCEEDED(hr))
188 This->props = *pRequest;
189
190 *pActual = This->props;
191 }
192 }
193 LeaveCriticalSection(This->pCritSect);
194
195 return hr;
196}
FxRequest * pRequest
#define VFW_E_BUFFERS_OUTSTANDING
Definition: vfwmsgs.h:55
#define VFW_E_ALREADY_COMMITTED
Definition: vfwmsgs.h:54

◆ impl_from_IMediaSample2()

◆ impl_from_IMemAllocator()

◆ mem_allocator_create()

HRESULT mem_allocator_create ( IUnknown *  lpUnkOuter,
IUnknown **  out 
)

Definition at line 912 of file memallocator.c.

913{
914 StdMemAllocator * pMemAlloc;
915 HRESULT hr;
916
917 if (lpUnkOuter)
919
920 if (!(pMemAlloc = CoTaskMemAlloc(sizeof(*pMemAlloc))))
921 return E_OUTOFMEMORY;
922
924 pMemAlloc->csState.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": StdMemAllocator.csState");
925
926 pMemAlloc->pMemory = NULL;
927
929 *out = (IUnknown *)&pMemAlloc->base.IMemAllocator_iface;
930 else
931 CoTaskMemFree(pMemAlloc);
932
933 return hr;
934}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT StdMemAllocator_Alloc(IMemAllocator *iface)
Definition: memallocator.c:831
static HRESULT BaseMemAllocator_Init(HRESULT(*fnAlloc)(IMemAllocator *), HRESULT(*fnFree)(IMemAllocator *), HRESULT(*fnVerify)(IMemAllocator *, ALLOCATOR_PROPERTIES *), HRESULT(*fnBufferPrepare)(IMemAllocator *, StdMediaSample2 *, DWORD), HRESULT(*fnBufferReleased)(IMemAllocator *, StdMediaSample2 *), void(*fnDestroyed)(IMemAllocator *), CRITICAL_SECTION *pCritSect, BaseMemAllocator *pMemAlloc)
Definition: memallocator.c:78
static HRESULT StdMemAllocator_Free(IMemAllocator *iface)
Definition: memallocator.c:869
static void StdMemAllocator_Destroy(IMemAllocator *iface)
Definition: memallocator.c:902
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
CRITICAL_SECTION csState
Definition: memallocator.c:822
BaseMemAllocator base
Definition: memallocator.c:821
PRTL_CRITICAL_SECTION_DEBUG DebugInfo
Definition: rtltypes.h:1478
#define DWORD_PTR
Definition: treelist.c:76
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1156

◆ StdMediaSample2_AddRef()

static ULONG WINAPI StdMediaSample2_AddRef ( IMediaSample2 *  iface)
static

Definition at line 473 of file memallocator.c.

474{
477
478 TRACE("%p increasing refcount to %lu.\n", This, ref);
479
480 return ref;
481}
static StdMediaSample2 * impl_from_IMediaSample2(IMediaSample2 *iface)
Definition: memallocator.c:450

◆ StdMediaSample2_Construct()

static HRESULT StdMediaSample2_Construct ( BYTE *  pbBuffer,
LONG  cbBuffer,
IMemAllocator *  pParent,
StdMediaSample2 **  ppSample 
)
static

Definition at line 418 of file memallocator.c.

419{
420 assert(pbBuffer && pParent && (cbBuffer > 0));
421
422 if (!(*ppSample = CoTaskMemAlloc(sizeof(StdMediaSample2))))
423 return E_OUTOFMEMORY;
424
425 (*ppSample)->IMediaSample2_iface.lpVtbl = &StdMediaSample2_VTable;
426 (*ppSample)->ref = 0;
427 ZeroMemory(&(*ppSample)->props, sizeof((*ppSample)->props));
428
429 /* NOTE: no need to AddRef as the parent is guaranteed to be around
430 * at least as long as us and we don't want to create circular
431 * dependencies on the ref count */
432 (*ppSample)->pParent = pParent;
433 (*ppSample)->props.cbData = sizeof(AM_SAMPLE2_PROPERTIES);
434 (*ppSample)->props.cbBuffer = (*ppSample)->props.lActual = cbBuffer;
435 (*ppSample)->props.pbBuffer = pbBuffer;
436 (*ppSample)->media_time_valid = FALSE;
437
438 return S_OK;
439}
struct tagAM_SAMPLE2_PROPERTIES AM_SAMPLE2_PROPERTIES
static const IMediaSample2Vtbl StdMediaSample2_VTable
Definition: memallocator.c:73
FxObject * pParent
Definition: fxdpcapi.cpp:86

Referenced by StdMemAllocator_Alloc().

◆ StdMediaSample2_Delete()

static void StdMediaSample2_Delete ( StdMediaSample2 *  This)
static

Definition at line 441 of file memallocator.c.

442{
443 if (This->props.pMediaType)
444 DeleteMediaType(This->props.pMediaType);
445
446 /* NOTE: does not remove itself from the list it belongs to */
448}
void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:193

Referenced by StdMediaSample2_Release(), and StdMemAllocator_Free().

◆ StdMediaSample2_GetActualDataLength()

static LONG WINAPI StdMediaSample2_GetActualDataLength ( IMediaSample2 *  iface)
static

Definition at line 631 of file memallocator.c.

632{
634
635 TRACE("(%p)->()\n", iface);
636
637 return This->props.lActual;
638}

◆ StdMediaSample2_GetMediaTime()

static HRESULT WINAPI StdMediaSample2_GetMediaTime ( IMediaSample2 *  iface,
LONGLONG *  pStart,
LONGLONG *  pEnd 
)
static

Definition at line 726 of file memallocator.c.

727{
729
730 TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
731
732 if (!This->media_time_valid)
734
735 *pStart = This->tMediaStart;
736 *pEnd = This->tMediaEnd;
737
738 return S_OK;
739}
#define VFW_E_MEDIA_TIME_NOT_SET
Definition: vfwmsgs.h:105

◆ StdMediaSample2_GetMediaType()

static HRESULT WINAPI StdMediaSample2_GetMediaType ( IMediaSample2 *  iface,
AM_MEDIA_TYPE **  ppMediaType 
)
static

Definition at line 658 of file memallocator.c.

659{
661
662 TRACE("(%p)->(%p)\n", iface, ppMediaType);
663
664 if (!This->props.pMediaType) {
665 /* Make sure we return a NULL pointer (required by native Quartz dll) */
666 if (ppMediaType)
667 *ppMediaType = NULL;
668 return S_FALSE;
669 }
670
671 if (!(*ppMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
672 return E_OUTOFMEMORY;
673
674 return CopyMediaType(*ppMediaType, This->props.pMediaType);
675}
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
Definition: mediatype.c:150
#define S_FALSE
Definition: winerror.h:3451

◆ StdMediaSample2_GetPointer()

static HRESULT WINAPI StdMediaSample2_GetPointer ( IMediaSample2 *  iface,
BYTE **  ppBuffer 
)
static

Definition at line 506 of file memallocator.c.

507{
509
510 TRACE("(%p)->(%p)\n", iface, ppBuffer);
511
512 *ppBuffer = This->props.pbBuffer;
513
514 if (!*ppBuffer)
515 {
516 ERR("Requested an unlocked surface and trying to lock regardless\n");
517 return E_FAIL;
518 }
519
520 return S_OK;
521}
#define E_FAIL
Definition: ddrawi.h:102

◆ StdMediaSample2_GetProperties()

static HRESULT WINAPI StdMediaSample2_GetProperties ( IMediaSample2 *  iface,
DWORD  cbProperties,
BYTE *  pbProperties 
)
static

Definition at line 761 of file memallocator.c.

762{
764
765 TRACE("sample %p, size %lu, properties %p.\n", This, cbProperties, pbProperties);
766
767 memcpy(pbProperties, &This->props, min(cbProperties, sizeof(This->props)));
768
769 return S_OK;
770}
#define min(a, b)
Definition: monoChain.cc:55

◆ StdMediaSample2_GetSize()

static LONG WINAPI StdMediaSample2_GetSize ( IMediaSample2 *  iface)
static

Definition at line 523 of file memallocator.c.

524{
526
527 TRACE("StdMediaSample2_GetSize()\n");
528
529 return This->props.cbBuffer;
530}

◆ StdMediaSample2_GetTime()

static HRESULT WINAPI StdMediaSample2_GetTime ( IMediaSample2 *  iface,
REFERENCE_TIME *  pStart,
REFERENCE_TIME *  pEnd 
)
static

Definition at line 532 of file memallocator.c.

533{
535 HRESULT hr;
536
537 TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
538
539 if (!(This->props.dwSampleFlags & AM_SAMPLE_TIMEVALID))
541 else if (!(This->props.dwSampleFlags & AM_SAMPLE_STOPVALID))
542 {
543 *pStart = This->props.tStart;
544 *pEnd = This->props.tStart + 1;
545
547 }
548 else
549 {
550 *pStart = This->props.tStart;
551 *pEnd = This->props.tStop;
552
553 hr = S_OK;
554 }
555
556 return hr;
557}
@ AM_SAMPLE_TIMEVALID
Definition: axcore.idl:441
@ AM_SAMPLE_STOPVALID
Definition: axcore.idl:444
#define VFW_E_SAMPLE_TIME_NOT_SET
Definition: vfwmsgs.h:104
#define VFW_S_NO_STOP_TIME
Definition: vfwmsgs.h:34

◆ StdMediaSample2_IsDiscontinuity()

static HRESULT WINAPI StdMediaSample2_IsDiscontinuity ( IMediaSample2 *  iface)
static

Definition at line 703 of file memallocator.c.

704{
706
707 TRACE("(%p)->()\n", iface);
708
709 return (This->props.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) ? S_OK : S_FALSE;
710}
@ AM_SAMPLE_DATADISCONTINUITY
Definition: axcore.idl:439

◆ StdMediaSample2_IsPreroll()

static HRESULT WINAPI StdMediaSample2_IsPreroll ( IMediaSample2 *  iface)
static

Definition at line 608 of file memallocator.c.

609{
611
612 TRACE("(%p)->()\n", iface);
613
614 return (This->props.dwSampleFlags & AM_SAMPLE_PREROLL) ? S_OK : S_FALSE;
615}
@ AM_SAMPLE_PREROLL
Definition: axcore.idl:438

◆ StdMediaSample2_IsSyncPoint()

static HRESULT WINAPI StdMediaSample2_IsSyncPoint ( IMediaSample2 *  iface)
static

Definition at line 585 of file memallocator.c.

586{
588
589 TRACE("(%p)->()\n", iface);
590
591 return (This->props.dwSampleFlags & AM_SAMPLE_SPLICEPOINT) ? S_OK : S_FALSE;
592}
@ AM_SAMPLE_SPLICEPOINT
Definition: axcore.idl:437

◆ StdMediaSample2_QueryInterface()

static HRESULT WINAPI StdMediaSample2_QueryInterface ( IMediaSample2 *  iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 455 of file memallocator.c.

456{
457 TRACE("(%s, %p)\n", qzdebugstr_guid(riid), ppv);
458
459 *ppv = NULL;
460
461 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMediaSample) ||
462 IsEqualIID(riid, &IID_IMediaSample2))
463 {
464 *ppv = iface;
465 IMediaSample2_AddRef(iface);
466 return S_OK;
467 }
468
469 FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
470 return E_NOINTERFACE;
471}

◆ StdMediaSample2_Release()

static ULONG WINAPI StdMediaSample2_Release ( IMediaSample2 *  iface)
static

Definition at line 483 of file memallocator.c.

484{
487
488 TRACE("%p decreasing refcount to %lu.\n", This, ref);
489
490 if (!ref)
491 {
492 if (This->props.pMediaType)
493 DeleteMediaType(This->props.pMediaType);
494 This->props.pMediaType = NULL;
495 This->props.dwSampleFlags = 0;
496 This->media_time_valid = FALSE;
497
498 if (This->pParent)
499 IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
500 else
502 }
503 return ref;
504}
static void StdMediaSample2_Delete(StdMediaSample2 *This)
Definition: memallocator.c:441

◆ StdMediaSample2_SetActualDataLength()

static HRESULT WINAPI StdMediaSample2_SetActualDataLength ( IMediaSample2 *  iface,
LONG  len 
)
static

Definition at line 640 of file memallocator.c.

641{
643
644 TRACE("sample %p, len %ld.\n", This, len);
645
646 if ((len > This->props.cbBuffer) || (len < 0))
647 {
648 ERR("Length %ld exceeds maximum %ld.\n", len, This->props.cbBuffer);
650 }
651 else
652 {
653 This->props.lActual = len;
654 return S_OK;
655 }
656}
GLenum GLsizei len
Definition: glext.h:6722
#define VFW_E_BUFFER_OVERFLOW
Definition: vfwmsgs.h:52

◆ StdMediaSample2_SetDiscontinuity()

static HRESULT WINAPI StdMediaSample2_SetDiscontinuity ( IMediaSample2 *  iface,
BOOL  bIsDiscontinuity 
)
static

Definition at line 712 of file memallocator.c.

713{
715
716 TRACE("(%p)->(%s)\n", iface, bIsDiscontinuity ? "TRUE" : "FALSE");
717
718 if (bIsDiscontinuity)
719 This->props.dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
720 else
721 This->props.dwSampleFlags &= ~AM_SAMPLE_DATADISCONTINUITY;
722
723 return S_OK;
724}

◆ StdMediaSample2_SetMediaTime()

static HRESULT WINAPI StdMediaSample2_SetMediaTime ( IMediaSample2 *  iface,
LONGLONG *  start,
LONGLONG *  end 
)
static

Definition at line 741 of file memallocator.c.

742{
744
745 TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)",
746 end ? debugstr_time(*end) : "(null)");
747
748 if (start)
749 {
750 if (!end) return E_POINTER;
751 sample->tMediaStart = *start;
752 sample->tMediaEnd = *end;
753 sample->media_time_valid = TRUE;
754 }
755 else
756 sample->media_time_valid = FALSE;
757
758 return S_OK;
759}
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
static const char * debugstr_time(REFERENCE_TIME time)
Definition: strmbase.h:32
Definition: wave.c:25
#define E_POINTER
Definition: winerror.h:3480

◆ StdMediaSample2_SetMediaType()

static HRESULT WINAPI StdMediaSample2_SetMediaType ( IMediaSample2 *  iface,
AM_MEDIA_TYPE *  pMediaType 
)
static

Definition at line 677 of file memallocator.c.

678{
680
681 TRACE("(%p)->(%p)\n", iface, pMediaType);
682
683 if (This->props.pMediaType)
684 {
685 DeleteMediaType(This->props.pMediaType);
686 This->props.pMediaType = NULL;
687 }
688
689 if (!pMediaType)
690 {
691 This->props.dwSampleFlags &= ~AM_SAMPLE_TYPECHANGED;
692 return S_OK;
693 }
694
695 This->props.dwSampleFlags |= AM_SAMPLE_TYPECHANGED;
696
697 if (!(This->props.pMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
698 return E_OUTOFMEMORY;
699
700 return CopyMediaType(This->props.pMediaType, pMediaType);
701}
@ AM_SAMPLE_TYPECHANGED
Definition: axcore.idl:440

◆ StdMediaSample2_SetPreroll()

static HRESULT WINAPI StdMediaSample2_SetPreroll ( IMediaSample2 *  iface,
BOOL  bIsPreroll 
)
static

Definition at line 617 of file memallocator.c.

618{
620
621 TRACE("(%p)->(%s)\n", iface, bIsPreroll ? "TRUE" : "FALSE");
622
623 if (bIsPreroll)
624 This->props.dwSampleFlags |= AM_SAMPLE_PREROLL;
625 else
626 This->props.dwSampleFlags &= ~AM_SAMPLE_PREROLL;
627
628 return S_OK;
629}

◆ StdMediaSample2_SetProperties()

static HRESULT WINAPI StdMediaSample2_SetProperties ( IMediaSample2 *  iface,
DWORD  cbProperties,
const BYTE *  pbProperties 
)
static

Definition at line 772 of file memallocator.c.

773{
775
776 TRACE("sample %p, size %lu, properties %p.\n", This, cbProperties, pbProperties);
777
778 /* NOTE: pbBuffer and cbBuffer are read-only */
779 memcpy(&This->props, pbProperties, min(cbProperties, AM_SAMPLE2_PROP_SIZE_WRITABLE));
780
781 return S_OK;
782}
#define AM_SAMPLE2_PROP_SIZE_WRITABLE
Definition: memallocator.c:76

◆ StdMediaSample2_SetSyncPoint()

static HRESULT WINAPI StdMediaSample2_SetSyncPoint ( IMediaSample2 *  iface,
BOOL  bIsSyncPoint 
)
static

Definition at line 594 of file memallocator.c.

595{
597
598 TRACE("(%p)->(%s)\n", iface, bIsSyncPoint ? "TRUE" : "FALSE");
599
600 if (bIsSyncPoint)
601 This->props.dwSampleFlags |= AM_SAMPLE_SPLICEPOINT;
602 else
603 This->props.dwSampleFlags &= ~AM_SAMPLE_SPLICEPOINT;
604
605 return S_OK;
606}

◆ StdMediaSample2_SetTime()

static HRESULT WINAPI StdMediaSample2_SetTime ( IMediaSample2 *  iface,
REFERENCE_TIME *  start,
REFERENCE_TIME *  end 
)
static

Definition at line 559 of file memallocator.c.

560{
562
563 TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)",
564 end ? debugstr_time(*end) : "(null)");
565
566 if (start)
567 {
568 sample->props.tStart = *start;
569 sample->props.dwSampleFlags |= AM_SAMPLE_TIMEVALID;
570
571 if (end)
572 {
573 sample->props.tStop = *end;
574 sample->props.dwSampleFlags |= AM_SAMPLE_STOPVALID;
575 }
576 else
577 sample->props.dwSampleFlags &= ~AM_SAMPLE_STOPVALID;
578 }
579 else
580 sample->props.dwSampleFlags &= ~(AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID);
581
582 return S_OK;
583}

◆ StdMemAllocator_Alloc()

static HRESULT StdMemAllocator_Alloc ( IMemAllocator *  iface)
static

Definition at line 831 of file memallocator.c.

832{
834 StdMediaSample2 * pSample = NULL;
836 LONG i;
837
838 assert(list_empty(&This->base.free_list));
839
840 /* check alignment */
842
843 /* we do not allow a courser alignment than the OS page size */
844 if ((si.dwPageSize % This->base.props.cbAlign) != 0)
845 return VFW_E_BADALIGN;
846
847 /* FIXME: each sample has to have its buffer start on the right alignment.
848 * We don't do this at the moment */
849
850 /* allocate memory */
851 This->pMemory = VirtualAlloc(NULL, (This->base.props.cbBuffer + This->base.props.cbPrefix) * This->base.props.cBuffers, MEM_COMMIT, PAGE_READWRITE);
852
853 if (!This->pMemory)
854 return E_OUTOFMEMORY;
855
856 for (i = This->base.props.cBuffers - 1; i >= 0; i--)
857 {
858 /* pbBuffer does not start at the base address, it starts at base + cbPrefix */
859 BYTE * pbBuffer = (BYTE *)This->pMemory + i * (This->base.props.cbBuffer + This->base.props.cbPrefix) + This->base.props.cbPrefix;
860
861 StdMediaSample2_Construct(pbBuffer, This->base.props.cbBuffer, iface, &pSample);
862
863 list_add_head(&This->base.free_list, &pSample->listentry);
864 }
865
866 return S_OK;
867}
static StdMemAllocator * StdMemAllocator_from_IMemAllocator(IMemAllocator *iface)
Definition: memallocator.c:826
static HRESULT StdMediaSample2_Construct(BYTE *pbBuffer, LONG cbBuffer, IMemAllocator *pParent, StdMediaSample2 **ppSample)
Definition: memallocator.c:418
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static SYSTEM_INFO si
Definition: virtual.c:39
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define MEM_COMMIT
Definition: nt_native.h:1316
long LONG
Definition: pedump.c:60
DWORD dwPageSize
Definition: winbase.h:896
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65
unsigned char BYTE
Definition: xxhash.c:193

Referenced by mem_allocator_create().

◆ StdMemAllocator_Destroy()

static void StdMemAllocator_Destroy ( IMemAllocator *  iface)
static

Definition at line 902 of file memallocator.c.

903{
905
906 This->csState.DebugInfo->Spare[0] = 0;
907 DeleteCriticalSection(&This->csState);
908
910}
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by mem_allocator_create().

◆ StdMemAllocator_Free()

static HRESULT StdMemAllocator_Free ( IMemAllocator *  iface)
static

Definition at line 869 of file memallocator.c.

870{
872 struct list * cursor;
873
874 if (!list_empty(&This->base.used_list))
875 {
876 WARN("Freeing allocator with outstanding samples!\n");
877 while ((cursor = list_head(&This->base.used_list)) != NULL)
878 {
879 StdMediaSample2 *pSample;
881 pSample = LIST_ENTRY(cursor, StdMediaSample2, listentry);
882 pSample->pParent = NULL;
883 }
884 }
885
886 while ((cursor = list_head(&This->base.free_list)) != NULL)
887 {
890 }
891
892 /* free memory */
893 if (!VirtualFree(This->pMemory, 0, MEM_RELEASE))
894 {
895 ERR("Failed to free memory, error %lu.\n", GetLastError());
897 }
898
899 return S_OK;
900}
const char cursor[]
Definition: icontest.c:13
#define MEM_RELEASE
Definition: nt_native.h:1319
IMemAllocator * pParent
Definition: memallocator.c:39
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119

Referenced by mem_allocator_create().

◆ StdMemAllocator_from_IMemAllocator()

static StdMemAllocator * StdMemAllocator_from_IMemAllocator ( IMemAllocator *  iface)
inlinestatic

Definition at line 826 of file memallocator.c.

827{
828 return CONTAINING_RECORD(iface, StdMemAllocator, base.IMemAllocator_iface);
829}

Referenced by StdMemAllocator_Alloc(), StdMemAllocator_Destroy(), and StdMemAllocator_Free().

◆ unsafe_impl_from_IMediaSample()

static StdMediaSample2 * unsafe_impl_from_IMediaSample ( IMediaSample *  iface)
inlinestatic

Definition at line 809 of file memallocator.c.

810{
811 IMediaSample2 *iface2 = (IMediaSample2 *)iface;
812
813 if (!iface)
814 return NULL;
815 assert(iface2->lpVtbl == &StdMediaSample2_VTable);
816 return impl_from_IMediaSample2(iface2);
817}

Referenced by BaseMemAllocator_ReleaseBuffer().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )

Variable Documentation

◆ BaseMemAllocator_VTable

static const IMemAllocatorVtbl BaseMemAllocator_VTable
static
Initial value:
=
{
}
static HRESULT WINAPI BaseMemAllocator_QueryInterface(IMemAllocator *iface, REFIID riid, LPVOID *ppv)
Definition: memallocator.c:110
static HRESULT WINAPI BaseMemAllocator_Decommit(IMemAllocator *iface)
Definition: memallocator.c:257
static HRESULT WINAPI BaseMemAllocator_GetBuffer(IMemAllocator *iface, IMediaSample **pSample, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime, DWORD dwFlags)
Definition: memallocator.c:296
static HRESULT WINAPI BaseMemAllocator_SetProperties(IMemAllocator *iface, ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual)
Definition: memallocator.c:162
static ULONG WINAPI BaseMemAllocator_AddRef(IMemAllocator *iface)
Definition: memallocator.c:133
static HRESULT WINAPI BaseMemAllocator_ReleaseBuffer(IMemAllocator *iface, IMediaSample *pSample)
Definition: memallocator.c:357
static HRESULT WINAPI BaseMemAllocator_GetProperties(IMemAllocator *iface, ALLOCATOR_PROPERTIES *pProps)
Definition: memallocator.c:198
static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator *iface)
Definition: memallocator.c:143
static HRESULT WINAPI BaseMemAllocator_Commit(IMemAllocator *iface)
Definition: memallocator.c:213

Definition at line 72 of file memallocator.c.

Referenced by BaseMemAllocator_Init().

◆ StdMediaSample2_VTable

static const IMediaSample2Vtbl StdMediaSample2_VTable
static
Initial value:
=
{
}
static LONG WINAPI StdMediaSample2_GetActualDataLength(IMediaSample2 *iface)
Definition: memallocator.c:631
static HRESULT WINAPI StdMediaSample2_SetPreroll(IMediaSample2 *iface, BOOL bIsPreroll)
Definition: memallocator.c:617
static HRESULT WINAPI StdMediaSample2_SetDiscontinuity(IMediaSample2 *iface, BOOL bIsDiscontinuity)
Definition: memallocator.c:712
static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 *iface, AM_MEDIA_TYPE *pMediaType)
Definition: memallocator.c:677
static LONG WINAPI StdMediaSample2_GetSize(IMediaSample2 *iface)
Definition: memallocator.c:523
static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 *iface, LONGLONG *pStart, LONGLONG *pEnd)
Definition: memallocator.c:726
static HRESULT WINAPI StdMediaSample2_GetMediaType(IMediaSample2 *iface, AM_MEDIA_TYPE **ppMediaType)
Definition: memallocator.c:658
static HRESULT WINAPI StdMediaSample2_GetTime(IMediaSample2 *iface, REFERENCE_TIME *pStart, REFERENCE_TIME *pEnd)
Definition: memallocator.c:532
static HRESULT WINAPI StdMediaSample2_GetPointer(IMediaSample2 *iface, BYTE **ppBuffer)
Definition: memallocator.c:506
static HRESULT WINAPI StdMediaSample2_GetProperties(IMediaSample2 *iface, DWORD cbProperties, BYTE *pbProperties)
Definition: memallocator.c:761
static HRESULT WINAPI StdMediaSample2_SetSyncPoint(IMediaSample2 *iface, BOOL bIsSyncPoint)
Definition: memallocator.c:594
static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 *iface)
Definition: memallocator.c:483
static HRESULT WINAPI StdMediaSample2_QueryInterface(IMediaSample2 *iface, REFIID riid, void **ppv)
Definition: memallocator.c:455
static ULONG WINAPI StdMediaSample2_AddRef(IMediaSample2 *iface)
Definition: memallocator.c:473
static HRESULT WINAPI StdMediaSample2_IsDiscontinuity(IMediaSample2 *iface)
Definition: memallocator.c:703
static HRESULT WINAPI StdMediaSample2_SetProperties(IMediaSample2 *iface, DWORD cbProperties, const BYTE *pbProperties)
Definition: memallocator.c:772
static HRESULT WINAPI StdMediaSample2_IsPreroll(IMediaSample2 *iface)
Definition: memallocator.c:608
static HRESULT WINAPI StdMediaSample2_IsSyncPoint(IMediaSample2 *iface)
Definition: memallocator.c:585
static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLONG *start, LONGLONG *end)
Definition: memallocator.c:741
static HRESULT WINAPI StdMediaSample2_SetActualDataLength(IMediaSample2 *iface, LONG len)
Definition: memallocator.c:640
static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TIME *start, REFERENCE_TIME *end)
Definition: memallocator.c:559

Definition at line 73 of file memallocator.c.

Referenced by StdMediaSample2_Construct(), and unsafe_impl_from_IMediaSample().