-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsysmem_allocator.h
69 lines (56 loc) · 2.02 KB
/
sysmem_allocator.h
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
60
61
62
63
64
65
66
67
68
69
/* ****************************************************************************** *\
INTEL CORPORATION PROPRIETARY INFORMATION
This software is supplied under the terms of a license agreement or nondisclosure
agreement with Intel Corporation and may not be copied or disclosed except in
accordance with the terms of that agreement
Copyright(c) 2008-2013 Intel Corporation. All Rights Reserved.
\* ****************************************************************************** */
#ifndef __SYSMEM_ALLOCATOR_H__
#define __SYSMEM_ALLOCATOR_H__
#include <stdlib.h>
#include "base_allocator.h"
struct sBuffer
{
mfxU32 id;
mfxU32 nbytes;
mfxU16 type;
};
struct sFrame
{
mfxU32 id;
mfxFrameInfo info;
};
struct SysMemAllocatorParams : mfxAllocatorParams
{
SysMemAllocatorParams()
: mfxAllocatorParams() { }
MFXBufferAllocator *pBufferAllocator;
};
class SysMemFrameAllocator: public BaseFrameAllocator
{
public:
SysMemFrameAllocator();
virtual ~SysMemFrameAllocator();
virtual mfxStatus Init(mfxAllocatorParams *pParams);
virtual mfxStatus Close();
virtual mfxStatus LockFrame(mfxMemId mid, mfxFrameData *ptr);
virtual mfxStatus UnlockFrame(mfxMemId mid, mfxFrameData *ptr);
virtual mfxStatus GetFrameHDL(mfxMemId mid, mfxHDL *handle);
protected:
virtual mfxStatus CheckRequestType(mfxFrameAllocRequest *request);
virtual mfxStatus ReleaseResponse(mfxFrameAllocResponse *response);
virtual mfxStatus AllocImpl(mfxFrameAllocRequest *request, mfxFrameAllocResponse *response);
MFXBufferAllocator *m_pBufferAllocator;
bool m_bOwnBufferAllocator;
};
class SysMemBufferAllocator : public MFXBufferAllocator
{
public:
SysMemBufferAllocator();
virtual ~SysMemBufferAllocator();
virtual mfxStatus AllocBuffer(mfxU32 nbytes, mfxU16 type, mfxMemId *mid);
virtual mfxStatus LockBuffer(mfxMemId mid, mfxU8 **ptr);
virtual mfxStatus UnlockBuffer(mfxMemId mid);
virtual mfxStatus FreeBuffer(mfxMemId mid);
};
#endif // __SYSMEM_ALLOCATOR_H__