-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdatabuffer.h
65 lines (43 loc) · 1.21 KB
/
databuffer.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
//
// Created by wlanjie on 2018/2/7.
//
#ifndef MP4_DATABUFFER_H
#define MP4_DATABUFFER_H
#include "types.h"
#include "results.h"
namespace mp4 {
class DataBuffer {
public:
// constructors & destructor
DataBuffer();
DataBuffer(Size size);
DataBuffer(const void *data, Size data_size);
DataBuffer(const DataBuffer &other);
virtual ~DataBuffer();
// data buffer handling methods
Result setBuffer(Byte *buffer, Size buffer_size);
Result setBufferSize(Size buffer_size);
Size getBufferSize() const { return m_BufferSize; }
// data handling methods
const Byte *getData() const { return m_Buffer; }
Byte *useData() { return m_Buffer; };
Size getDataSize() const { return m_DataSize; }
Result setDataSize(Size size);
Result setData(const Byte *data, Size data_size);
Result appendData(const Byte *data, Size data_size);
// memory management
Result reserve(Size size);
protected:
// members
bool m_BufferIsLocal;
Byte *m_Buffer;
Size m_BufferSize;
Size m_DataSize;
// methods
Result reallocateBuffer(Size size);
private:
// forbid this
DataBuffer &operator=(const DataBuffer &other);
};
}
#endif //MP4_DATABUFFER_H