Gst backend: allow rendering other video buffers than allocated

Moved checking the buffer type to the buffer pool
instead of comparing the buffer type in QVideoSurfaceGstSink.

Some gstreamer elements may push other buffer instance than
provided by sink but with the same data pointer.

Change-Id: Iab3bf4da2d5eeb5d2a9375aa609a89515b067ce3
Reviewed-by: Lev Zelenskiy <lev.zelenskiy@nokia.com>
Reviewed-by: Ling Hu <ling.hu@nokia.com>
This commit is contained in:
Dmytro Poplavskiy
2012-05-14 13:10:09 +10:00
committed by Qt by Nokia
parent 08d45baac2
commit fdb5c419c4
3 changed files with 10 additions and 10 deletions

View File

@@ -177,6 +177,9 @@ QAbstractVideoBuffer::HandleType QGstXvImageBufferPool::handleType() const
QAbstractVideoBuffer *QGstXvImageBufferPool::prepareVideoBuffer(GstBuffer *buffer, int bytesPerLine)
{
if (!G_TYPE_CHECK_INSTANCE_TYPE(buffer, bufferType()))
return 0;
QGstXvImageBuffer *xvBuffer = reinterpret_cast<QGstXvImageBuffer *>(buffer);
QVariant handle = QVariant::fromValue(xvBuffer->xvImage);
return new QGstVideoBuffer(buffer, bytesPerLine, QAbstractVideoBuffer::XvShmImageHandle, handle);

View File

@@ -195,9 +195,10 @@ GstFlowReturn QVideoSurfaceGstDelegate::render(GstBuffer *buffer)
QAbstractVideoBuffer *videoBuffer = 0;
if (m_pool && G_TYPE_CHECK_INSTANCE_TYPE(buffer, m_pool->bufferType()))
if (m_pool)
videoBuffer = m_pool->prepareVideoBuffer(buffer, m_bytesPerLine);
else
if (!videoBuffer)
videoBuffer = new QGstVideoBuffer(buffer, m_bytesPerLine);
m_frame = QVideoFrame(