summaryrefslogtreecommitdiffstats
path: root/src/gsttools
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2012-05-14 13:10:09 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-14 08:37:45 +0200
commitfdb5c419c4fb7b1ae0268e496ccdd0ffa03b74ce (patch)
tree1e8c85fd7d6abf30e831a3f65649d932a40f071d /src/gsttools
parent08d45baac2b56b625194e7b62ce8bff0529218fc (diff)
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>
Diffstat (limited to 'src/gsttools')
-rw-r--r--src/gsttools/qgstxvimagebuffer.cpp3
-rw-r--r--src/gsttools/qvideosurfacegstsink.cpp5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gsttools/qgstxvimagebuffer.cpp b/src/gsttools/qgstxvimagebuffer.cpp
index 423a0d39e..40df2b44c 100644
--- a/src/gsttools/qgstxvimagebuffer.cpp
+++ b/src/gsttools/qgstxvimagebuffer.cpp
@@ -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);
diff --git a/src/gsttools/qvideosurfacegstsink.cpp b/src/gsttools/qvideosurfacegstsink.cpp
index 7f61a68e8..afbc69c92 100644
--- a/src/gsttools/qvideosurfacegstsink.cpp
+++ b/src/gsttools/qvideosurfacegstsink.cpp
@@ -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(