From 77e47a0a695a4efa552c6b595b92e7c508cd7446 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 1 Jul 2021 11:35:42 +0200 Subject: Add support for imx8 video conversions The iMX8 pipeline is somewhat broken as they send the data over in a format that can't be handled directly by the sinks (although it's marked as a supported format). To handle this a special imxvideoconvert_g2d conversion element is required in the pipeline before the sink. To make this work, we simply check whether the element is available and in that case assume that it's required and use it. Change-Id: I68ee38b56ca21ed7d3d8d8134b4c9b443bf6037d Reviewed-by: Laszlo Agocs --- .../platform/gstreamer/common/qgstreamervideosink.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/multimedia/platform/gstreamer/common/qgstreamervideosink.cpp b/src/multimedia/platform/gstreamer/common/qgstreamervideosink.cpp index e505060be..443d6b40d 100644 --- a/src/multimedia/platform/gstreamer/common/qgstreamervideosink.cpp +++ b/src/multimedia/platform/gstreamer/common/qgstreamervideosink.cpp @@ -52,7 +52,18 @@ QGstreamerVideoSink::QGstreamerVideoSink(QVideoSink *parent) : QPlatformVideoSink(parent) { sinkBin = QGstBin("videoSinkBin"); - gstPreprocess = QGstElement("identity"); + // This is a hack for some iMX platforms. Thos require the use of a special video + // conversion element in the pipeline before the video sink, as they unfortunately + // output some proprietary format from the decoder even though it's marked as + // a regular supported video/x-raw format. + // + // To fix this, simply insert the element into the pipeline if it's available. Otherwise + // we simply use an identity element. + auto imxVideoConvert = QGstElement("imxvideoconvert_g2d"); + if (!imxVideoConvert.isNull()) + gstPreprocess = imxVideoConvert; + else + gstPreprocess = QGstElement("identity"); sinkBin.add(gstPreprocess); sinkBin.addGhostPad(gstPreprocess, "sink"); createOverlay(); -- cgit v1.2.3