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>
This commit is contained in:
committed by
Qt by Nokia
parent
20315eec05
commit
3998106d93
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user