-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathCodedData.hpp
More file actions
94 lines (72 loc) · 2.23 KB
/
Copy pathCodedData.hpp
File metadata and controls
94 lines (72 loc) · 2.23 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef _AV_TRANSCODER_FRAME_CODEDDATA_HPP_
#define _AV_TRANSCODER_FRAME_CODEDDATA_HPP_
#include <AvTranscoder/common.hpp>
extern "C" {
#include <libavcodec/avcodec.h>
}
struct AVStream;
namespace avtranscoder
{
/**
* @brief This class describes coded data.
*/
class AvExport CodedData
{
public:
/// Create an empty data buffer
CodedData();
/// Create a data buffer with a the given size
CodedData(const size_t dataSize);
#ifndef SWIG
/// Create a data buffer from the given AVPAcket (copy data of given packet)
CodedData(const AVPacket& avPacket);
#endif
/// Override copy constructor in order to copy AVPacket data
CodedData(const CodedData& other);
/// Override operator = in order to copy AVPacket data
CodedData& operator=(const CodedData& other);
/// Free buffer of data
~CodedData();
#ifndef SWIG
void refAVStream(const AVStream& avStream) { _avStream = &avStream; }
#endif
/// Resize data buffer
void resize(const size_t newSize);
///@{
/// Ref to external data buffer
void refData(CodedData& frame);
void refData(unsigned char* buffer, const size_t size);
///@}
/// Copy external data buffer
void copyData(unsigned char* buffer, const size_t size);
/**
* @brief Resize the buffer with the given size, and copy the given value
* @note Use this function to check if we can modify the buffer
*/
void assign(const size_t size, const int value);
/// Clear existing data and set size to 0
void clear();
unsigned char* getData() { return _packet.data; }
#ifndef SWIG
const unsigned char* getData() const { return _packet.data; }
#endif
size_t getSize() const { return _packet.size; }
#ifndef SWIG
/**
* @return the AVStream which contains the packet
* @note may be NULL in case of generated packets
*/
const AVStream* getAVStream() const { return _avStream; }
AVPacket& getAVPacket() { return _packet; }
const AVPacket& getAVPacket() const { return _packet; }
#endif
private:
void initAVPacket();
void copyAVPacket(const AVPacket& avPacket);
private:
AVPacket _packet;
// Stream which contains the packet
const AVStream* _avStream; //< Has link (no ownership)
};
}
#endif