diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2012-03-14 11:52:43 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-14 04:47:51 +0100 |
commit | 8d637854254255860ac40dbe5a96328de99f6f7a (patch) | |
tree | bd3bbf1410f2c7569c073d8cd3064668846df4d9 /src/gsttools | |
parent | 942ff7a3c6d25dc3a79d28a79676b0995d95874b (diff) |
gst video surface sink: start surface with correct handle type
The handle type should match one from the currently used buffer pool.
Change-Id: I33f7856a742299ce0640f331898c3cbe5cfbdf97
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'src/gsttools')
-rw-r--r-- | src/gsttools/qvideosurfacegstsink.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gsttools/qvideosurfacegstsink.cpp b/src/gsttools/qvideosurfacegstsink.cpp index 65aca1fb1..c1f2792cc 100644 --- a/src/gsttools/qvideosurfacegstsink.cpp +++ b/src/gsttools/qvideosurfacegstsink.cpp @@ -581,7 +581,11 @@ gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps) return TRUE; } else { int bytesPerLine = 0; - QVideoSurfaceFormat format = formatForCaps(caps, &bytesPerLine); + QGstBufferPoolInterface *pool = sink->delegate->pool(); + QAbstractVideoBuffer::HandleType handleType = + pool ? pool->handleType() : QAbstractVideoBuffer::NoHandle; + + QVideoSurfaceFormat format = formatForCaps(caps, &bytesPerLine, handleType); if (sink->delegate->isActive()) { QVideoSurfaceFormat surfaceFormst = sink->delegate->surfaceFormat(); @@ -612,7 +616,7 @@ gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps) return FALSE; } -QVideoSurfaceFormat QVideoSurfaceGstSink::formatForCaps(GstCaps *caps, int *bytesPerLine) +QVideoSurfaceFormat QVideoSurfaceGstSink::formatForCaps(GstCaps *caps, int *bytesPerLine, QAbstractVideoBuffer::HandleType handleType) { const GstStructure *structure = gst_caps_get_structure(caps, 0); @@ -655,7 +659,7 @@ QVideoSurfaceFormat QVideoSurfaceGstSink::formatForCaps(GstCaps *caps, int *byte } if (pixelFormat != QVideoFrame::Format_Invalid) { - QVideoSurfaceFormat format(size, pixelFormat); + QVideoSurfaceFormat format(size, pixelFormat, handleType); QPair<int, int> rate; gst_structure_get_fraction(structure, "framerate", &rate.first, &rate.second); @@ -771,7 +775,11 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc( if (!sink->delegate->isActive()) { int bytesPerLine = 0; - QVideoSurfaceFormat format = formatForCaps(intersection, &bytesPerLine); + QGstBufferPoolInterface *pool = sink->delegate->pool(); + QAbstractVideoBuffer::HandleType handleType = + pool ? pool->handleType() : QAbstractVideoBuffer::NoHandle; + + QVideoSurfaceFormat format = formatForCaps(intersection, &bytesPerLine, handleType); if (!sink->delegate->start(format, bytesPerLine)) { qWarning() << "failed to start video surface"; |