Added QAbstractVideoBuffer::release virtual method

It's useful when the buffer pool stores QAbstractVideoBuffer
instances instead of underlying system buffers and
allows to avoid reallocation of QAbstractVideoBuffer instances.

The default implementation deletes the buffer,
so this change is source compatible.

Change-Id: I7dadd7dac529748b5eb33e5aa7c2d0578b8b1634
Reviewed-by: Lev Zelenskiy <lev.zelenskiy@nokia.com>
Reviewed-by: Jonas Rabbe <jonas.rabbe@gmail.com>
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Dmytro Poplavskiy
2012-06-06 14:35:42 +10:00
committed by Qt by Nokia
parent 62749d654d
commit 74383cb40c
3 changed files with 16 additions and 1 deletions

View File

@@ -148,6 +148,19 @@ QAbstractVideoBuffer::~QAbstractVideoBuffer()
delete d_ptr;
}
/*!
Releases the video buffer.
QVideoFrame calls QAbstractVideoBuffer::release when the buffer is not used
any more and can be destroyed or returned to the buffer pool.
The default implementation deletes the buffer instance.
*/
void QAbstractVideoBuffer::release()
{
delete this;
}
/*!
Returns the type of a video buffer's handle.

View File

@@ -82,6 +82,7 @@ public:
QAbstractVideoBuffer(HandleType type);
virtual ~QAbstractVideoBuffer();
virtual void release();
HandleType handleType() const;

View File

@@ -102,7 +102,8 @@ public:
~QVideoFramePrivate()
{
delete buffer;
if (buffer)
buffer->release();
}
QSize size;