summaryrefslogtreecommitdiffstats
path: root/loader/dshow/allocator.h
blob: 4b26c67b79471d16660e19b881fe7e474c88f511 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef ALLOCATOR_H
#define ALLOCATOR_H

#include "interfaces.h"
#include "cmediasample.h"
#include <list>
#include "iunk.h"
#include "default.h"

class MemAllocator: public IMemAllocator
{
    ALLOCATOR_PROPERTIES props;
    std::list<CMediaSample*> used_list;
    std::list<CMediaSample*> free_list;
    char* new_pointer;
    CMediaSample* modified_sample;
    static GUID interfaces[];
    DECLARE_IUNKNOWN(MemAllocator)
public:
    MemAllocator();
    ~MemAllocator(){delete vt;}
    static long CreateAllocator(GUID* clsid, GUID* iid, void** ppv);
    void SetPointer(char* pointer) { new_pointer=pointer; }
    void ResetPointer() 
    { 
	if(modified_sample) 
	{
	    modified_sample->ResetPointer(); 
	    modified_sample=0;
	}
    }
    static HRESULT STDCALL SetProperties ( 
        IMemAllocator * This,
        /* [in] */ ALLOCATOR_PROPERTIES *pRequest,
        /* [out] */ ALLOCATOR_PROPERTIES *pActual);
    
    static HRESULT STDCALL GetProperties ( 
        IMemAllocator * This,
        /* [out] */ ALLOCATOR_PROPERTIES *pProps);
    
    static HRESULT STDCALL Commit ( 
        IMemAllocator * This);
    
    static HRESULT STDCALL Decommit ( 
        IMemAllocator * This);
    
    static HRESULT STDCALL GetBuffer ( 
        IMemAllocator * This,
        /* [out] */ IMediaSample **ppBuffer,
        /* [in] */ REFERENCE_TIME *pStartTime,
        /* [in] */ REFERENCE_TIME *pEndTime,
        /* [in] */ DWORD dwFlags);
    
    static HRESULT STDCALL ReleaseBuffer ( 
        IMemAllocator * This,
        /* [in] */ IMediaSample *pBuffer);
};

#endif