Skip to content

Commit aade71f

Browse files
author
Clement Champetier
committed
Frame: add isRefCounted method
Will be used when calling refFrame.
1 parent 8d0ac3f commit aade71f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/AvTranscoder/data/decoded/Frame.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ void Frame::copyProperties(const Frame& otherFrame)
6868
av_frame_copy_props(_frame, &otherFrame.getAVFrame());
6969
}
7070

71+
bool Frame::isRefCounted() const
72+
{
73+
return _frame->buf[0];
74+
}
75+
7176
void Frame::refFrame(const Frame& otherFrame)
7277
{
7378
const int ret = av_frame_ref(_frame, &otherFrame.getAVFrame());

src/AvTranscoder/data/decoded/Frame.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ class AvExport Frame
5252

5353
/**
5454
* @brief Copy the data of the given Frame.
55-
* @note This function does not allocate anything: the current frame must be already initialized and
55+
* This function does not allocate anything: the current frame must be already initialized and
5656
* allocated with the same parameters as the given frame, to be ready for memcpy instructions.
57+
* @note It copies the frame data (i.e. the contents of the data / extended data arrays), not any other properties.
58+
* @see copyProperties
5759
*/
5860
void copyData(const Frame& frameToRef);
5961

@@ -62,6 +64,11 @@ class AvExport Frame
6264
*/
6365
void copyProperties(const Frame& otherFrame);
6466

67+
/**
68+
* @brief If the data buffer of the frame refers to data allocated by an other frame.
69+
*/
70+
bool isRefCounted() const;
71+
6572
/**
6673
* @brief Copy frame properties and create a new reference to data of the given frame.
6774
* @warning This method allocates new data that will be freed by calling clear method or the destructor of the referenced frame.

0 commit comments

Comments
 (0)