From 7cdc38eb58776e0a98e91a237f2e9a6fcf0206ea Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Fri, 14 Jul 2017 18:40:43 +0200 Subject: [PATCH] LP-109 video : increase osxvideosink rank so autovideosink selects it --- ground/gcs/src/libs/gstreamer/gst_util.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ground/gcs/src/libs/gstreamer/gst_util.cpp b/ground/gcs/src/libs/gstreamer/gst_util.cpp index 0a24a485d..1560a4512 100644 --- a/ground/gcs/src/libs/gstreamer/gst_util.cpp +++ b/ground/gcs/src/libs/gstreamer/gst_util.cpp @@ -77,7 +77,6 @@ void gst::init(int *argc, char * *argv[]) // qputenv("GST_DEBUG_FILE", "gst.log"); // qputenv("GST_DEBUG_DUMP_DOT_DIR", "."); - #ifdef Q_OS_WIN qputenv("GST_PLUGIN_PATH_1_0", (Utils::GetLibraryPath() + "gstreamer-1.0").toLatin1()); #endif @@ -97,6 +96,18 @@ void gst::init(int *argc, char * *argv[]) // GST_PLUGIN_STATIC_REGISTER(librepilot); gst_plugin_librepilot_register(); +#ifdef Q_OS_MAC + GstRegistry *reg = gst_registry_get(); + + GstPluginFeature *feature = gst_registry_lookup_feature(reg, "osxvideosink"); + if (feature) { + // raise rank of osxvideosink so it gets selected by autovideosink + // if not doing that then autovideosink selects the glimagesink which fails in Qt + gst_plugin_feature_set_rank(feature, GST_RANK_PRIMARY); + gst_object_unref(feature); + } +#endif + #ifdef USE_OPENCV // see http://stackoverflow.com/questions/32477403/how-to-know-if-sse2-is-activated-in-opencv // see http://answers.opencv.org/question/696/how-to-enable-vectorization-in-opencv/