summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gsttools/qgstxvimagebuffer.cpp3
-rw-r--r--src/gsttools/qvideosurfacegstsink.cpp5
-rw-r--r--src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h12
3 files changed, 10 insertions, 10 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(
diff --git a/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
index 42c4fb55c..929e7c68f 100644
--- a/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
+++ b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
@@ -73,16 +73,14 @@ public:
virtual ~QGstBufferPoolInterface() {}
virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const = 0;
-
- virtual GType bufferType() const = 0;
virtual GstBuffer *takeBuffer(const QVideoSurfaceFormat &format, GstCaps *caps) = 0;
virtual void clear() = 0;
virtual QAbstractVideoBuffer::HandleType handleType() const = 0;
/*!
- Build an QAbstractVideoBuffer instance from compatible (mathcing gst buffer type)
- GstBuffer.
+ Build an QAbstractVideoBuffer instance from GstBuffer.
+ Returns NULL if GstBuffer is not compatible with this buffer pool.
This method is called from gstreamer video sink thread.
*/
@@ -101,16 +99,14 @@ public:
virtual ~QGstBufferPoolPlugin() {}
virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const = 0;
-
- virtual GType bufferType() const = 0;
virtual GstBuffer *takeBuffer(const QVideoSurfaceFormat &format, GstCaps *caps) = 0;
virtual void clear() = 0;
virtual QAbstractVideoBuffer::HandleType handleType() const = 0;
/*!
- Build an QAbstractVideoBuffer instance from compatible (mathcing gst buffer type)
- GstBuffer.
+ Build an QAbstractVideoBuffer instance from compatible GstBuffer.
+ Returns NULL if GstBuffer is not compatible with this buffer pool.
This method is called from gstreamer video sink thread.
*/