52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
From 60a5f650497fa6c58e89d3c13b0ac25c030146f0 Mon Sep 17 00:00:00 2001
|
|
From: Jeffy Chen <jeffy.chen@rock-chips.com>
|
|
Date: Tue, 30 Mar 2021 07:52:42 +0800
|
|
Subject: [PATCH 13/17] HACK: gstreamer: Support fill mode
|
|
|
|
Depends on gstreamer-sink property.
|
|
|
|
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
|
---
|
|
src/gsttools/qgstreamervideooverlay.cpp | 12 ++++++++++++
|
|
1 file changed, 12 insertions(+)
|
|
|
|
diff --git a/src/gsttools/qgstreamervideooverlay.cpp b/src/gsttools/qgstreamervideooverlay.cpp
|
|
index 1ca82da..431d8cc 100644
|
|
--- a/src/gsttools/qgstreamervideooverlay.cpp
|
|
+++ b/src/gsttools/qgstreamervideooverlay.cpp
|
|
@@ -111,6 +111,7 @@ public:
|
|
m_hasHue = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue");
|
|
m_hasSaturation = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation");
|
|
m_hasShowPrerollFrame = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "show-preroll-frame");
|
|
+ m_hasFillMode = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "fill-mode");
|
|
}
|
|
|
|
bool hasShowPrerollFrame() const override
|
|
@@ -221,12 +222,23 @@ public:
|
|
(mode == Qt::KeepAspectRatio),
|
|
nullptr);
|
|
}
|
|
+ if (m_hasFillMode) {
|
|
+ // HACK: Match the gst-sink properties
|
|
+ int modes[] = {
|
|
+ [Qt::IgnoreAspectRatio] = 0,
|
|
+ [Qt::KeepAspectRatio] = 1,
|
|
+ [Qt::KeepAspectRatioByExpanding] = 2,
|
|
+ };
|
|
+ g_object_set(G_OBJECT(m_videoSink),
|
|
+ "fill-mode", modes[mode], nullptr);
|
|
+ }
|
|
}
|
|
|
|
protected:
|
|
|
|
GstElement *m_videoSink = nullptr;
|
|
bool m_hasForceAspectRatio = false;
|
|
+ bool m_hasFillMode = false;
|
|
bool m_hasBrightness = false;
|
|
bool m_hasContrast = false;
|
|
bool m_hasHue = false;
|
|
--
|
|
2.20.1
|
|
|