File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
src/AvTranscoder/data/decoded Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ VideoFrame::VideoFrame(const Frame& otherFrame)
56
56
{
57
57
}
58
58
59
+ VideoFrame::~VideoFrame ()
60
+ {
61
+ freeAVPicture ();
62
+ }
63
+
59
64
size_t VideoFrame::getSize () const
60
65
{
61
66
if (getPixelFormat () == AV_PIX_FMT_NONE)
@@ -87,6 +92,11 @@ void VideoFrame::allocateAVPicture(const VideoFrameDesc& desc)
87
92
_frame->format = desc._pixelFormat ;
88
93
}
89
94
95
+ void VideoFrame::freeAVPicture ()
96
+ {
97
+ avpicture_free (reinterpret_cast <AVPicture*>(_frame));
98
+ }
99
+
90
100
void VideoFrame::assign (const unsigned char value)
91
101
{
92
102
// Create the image buffer
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ class AvExport VideoFrame : public Frame
45
45
public:
46
46
VideoFrame (const VideoFrameDesc& ref);
47
47
VideoFrame (const Frame& otherFrame);
48
+ ~VideoFrame ();
48
49
49
50
size_t getWidth () const { return _frame->width ; }
50
51
size_t getHeight () const { return _frame->height ; }
@@ -68,9 +69,16 @@ class AvExport VideoFrame : public Frame
68
69
private:
69
70
/* *
70
71
* @brief Allocate the image buffer of the frame.
72
+ * @warning The allocated data should be freed by the caller.
73
+ * @see freeAVPicture
71
74
*/
72
75
void allocateAVPicture (const VideoFrameDesc& desc);
73
76
77
+ /* *
78
+ * @brief Free the image buffer of the frame.
79
+ */
80
+ void freeAVPicture ();
81
+
74
82
/* *
75
83
* @note To allocate new image buffer if needed.
76
84
* @see allocateAVPicture
You can’t perform that action at this time.
0 commit comments