168
|
1 #ifndef ALLOCATOR_H
|
|
2 #define ALLOCATOR_H
|
|
3
|
|
4 #include "interfaces.h"
|
|
5 #include "cmediasample.h"
|
|
6 #include <list>
|
|
7 #include "iunk.h"
|
|
8 #include "default.h"
|
713
|
9
|
168
|
10 class MemAllocator: public IMemAllocator
|
|
11 {
|
|
12 ALLOCATOR_PROPERTIES props;
|
713
|
13 std::list<CMediaSample*> used_list;
|
|
14 std::list<CMediaSample*> free_list;
|
|
15 char* new_pointer;
|
|
16 CMediaSample* modified_sample;
|
168
|
17 static GUID interfaces[];
|
|
18 DECLARE_IUNKNOWN(MemAllocator)
|
|
19 public:
|
|
20 MemAllocator();
|
|
21 ~MemAllocator(){delete vt;}
|
|
22 static long CreateAllocator(GUID* clsid, GUID* iid, void** ppv);
|
713
|
23 void SetPointer(char* pointer) { new_pointer=pointer; }
|
|
24 void ResetPointer()
|
|
25 {
|
|
26 if(modified_sample)
|
|
27 {
|
|
28 modified_sample->ResetPointer();
|
|
29 modified_sample=0;
|
|
30 }
|
|
31 }
|
168
|
32 static HRESULT STDCALL SetProperties (
|
|
33 IMemAllocator * This,
|
|
34 /* [in] */ ALLOCATOR_PROPERTIES *pRequest,
|
|
35 /* [out] */ ALLOCATOR_PROPERTIES *pActual);
|
|
36
|
|
37 static HRESULT STDCALL GetProperties (
|
|
38 IMemAllocator * This,
|
|
39 /* [out] */ ALLOCATOR_PROPERTIES *pProps);
|
|
40
|
|
41 static HRESULT STDCALL Commit (
|
|
42 IMemAllocator * This);
|
|
43
|
|
44 static HRESULT STDCALL Decommit (
|
|
45 IMemAllocator * This);
|
|
46
|
|
47 static HRESULT STDCALL GetBuffer (
|
|
48 IMemAllocator * This,
|
|
49 /* [out] */ IMediaSample **ppBuffer,
|
|
50 /* [in] */ REFERENCE_TIME *pStartTime,
|
|
51 /* [in] */ REFERENCE_TIME *pEndTime,
|
|
52 /* [in] */ DWORD dwFlags);
|
|
53
|
|
54 static HRESULT STDCALL ReleaseBuffer (
|
|
55 IMemAllocator * This,
|
|
56 /* [in] */ IMediaSample *pBuffer);
|
|
57 };
|
|
58
|
|
59 #endif
|