summaryrefslogtreecommitdiffstats
path: root/src/gsttools/qvideosurfacegstsink.cpp
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2012-04-17 11:29:09 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-20 08:46:59 +0200
commit3998106d93deb6a52b78d689ac3d7bacef8f0eb4 (patch)
tree6dface847178587028372cb5af9e637af9f13ed7 /src/gsttools/qvideosurfacegstsink.cpp
parent20315eec056c70bf2b386324ed32fdafbd3f03f8 (diff)
qvideosurfacegstsink: fixed calculation of supported formats.
If the custom buffer pool is used, it's also necessary to query the list of video surface formats with this handle type. Change-Id: I8a38f4c75f37ed05fbfdcf0933023a6abef1b3e1 Reviewed-by: Mithra Pattison <mithra.pattison@nokia.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com> Reviewed-by: Jonas Rabbe <jonas.rabbe@gmail.com>
Diffstat (limited to 'src/gsttools/qvideosurfacegstsink.cpp')
-rw-r--r--src/gsttools/qvideosurfacegstsink.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gsttools/qvideosurfacegstsink.cpp b/src/gsttools/qvideosurfacegstsink.cpp
index 1d6a10572..6347582a3 100644
--- a/src/gsttools/qvideosurfacegstsink.cpp
+++ b/src/gsttools/qvideosurfacegstsink.cpp
@@ -523,7 +523,24 @@ GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base)
GstCaps *caps = gst_caps_new_empty();
+ // Find the supported pixel formats
+ // with buffer pool specific formats listed first
+ QList<QVideoFrame::PixelFormat> supportedFormats;
+
+ QList<QVideoFrame::PixelFormat> poolHandleFormats;
+ sink->delegate->poolMutex()->lock();
+ QGstBufferPoolInterface *pool = sink->delegate->pool();
+ if (pool)
+ poolHandleFormats = sink->delegate->supportedPixelFormats(pool->handleType());
+ sink->delegate->poolMutex()->unlock();
+
+ supportedFormats = poolHandleFormats;
foreach (QVideoFrame::PixelFormat format, sink->delegate->supportedPixelFormats()) {
+ if (!poolHandleFormats.contains(format))
+ supportedFormats.append(format);
+ }
+
+ foreach (QVideoFrame::PixelFormat format, supportedFormats) {
int index = indexOfYuvColor(format);
if (index != -1) {
@@ -750,6 +767,8 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc(
return GST_FLOW_OK;
}
+ poolLock.unlock();
+
GstCaps *intersection = gst_caps_intersect(get_caps(GST_BASE_SINK(sink)), caps);
if (gst_caps_is_empty (intersection)) {
@@ -757,8 +776,6 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc(
return GST_FLOW_NOT_NEGOTIATED;
}
- poolLock.unlock();
-
if (sink->delegate->isActive()) {
//if format was changed, restart the surface
QVideoSurfaceFormat format = formatForCaps(intersection);