2 ******************************************************************************
5 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
7 * @see The GNU Public License (GPL) Version 3
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "plugins/cameracalibration/gstcameracalibration.h"
33 #include "plugins/cameracalibration/gstcameraundistort.h"
36 #include "utils/pathutils.h"
40 static bool initialized
= false;
42 gboolean
gst_plugin_librepilot_register(GstPlugin
*plugin
)
45 if (!gst_camera_calibration_plugin_init(plugin
)) {
48 if (!gst_camera_undistort_plugin_init(plugin
)) {
57 void gst_plugin_librepilot_register()
59 gst_plugin_register_static(GST_VERSION_MAJOR
, GST_VERSION_MINOR
, "librepilot",
60 "LibrePilot plugin", gst_plugin_librepilot_register
, "1.10.0", "GPL",
61 "librepilot", "LibrePilot", "http://librepilot.org/");
64 // see http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gst-running.html
65 void gst::init(int *argc
, char * *argv
[])
67 // TODO Not thread safe. Does it need to be?
73 // qputenv("GST_DEBUG", "3");
74 // qputenv("GST_DEBUG", "3,rtspsrc:6,udpsrc:6");
75 // qputenv("GST_DEBUG", "3,bin:6");
76 // qputenv("GST_DEBUG", "3,rtpjitterbuffer:6");
77 // qputenv("GST_DEBUG_FILE", "gst.log");
78 // qputenv("GST_DEBUG_DUMP_DOT_DIR", ".");
81 qputenv("GST_PLUGIN_PATH_1_0", (Utils::GetLibraryPath() + "gstreamer-1.0").toLatin1());
84 qDebug() << "gstreamer - initializing";
86 if (!gst_init_check(argc
, argv
, &error
)) {
87 qCritical() << "failed to initialize gstreamer";
91 qDebug() << "gstreamer - version:" << gst_version_string();
92 qDebug() << "gstreamer - plugin system path:" << qgetenv("GST_PLUGIN_SYSTEM_PATH_1_0");
93 qDebug() << "gstreamer - plugin path:" << qgetenv("GST_PLUGIN_PATH_1_0");
95 qDebug() << "gstreamer - registering plugins";
96 // GST_PLUGIN_STATIC_REGISTER(librepilot);
97 gst_plugin_librepilot_register();
100 GstRegistry
*reg
= gst_registry_get();
102 GstPluginFeature
*feature
= gst_registry_lookup_feature(reg
, "osxvideosink");
104 // raise rank of osxvideosink so it gets selected by autovideosink
105 // if not doing that then autovideosink selects the glimagesink which fails in Qt
106 gst_plugin_feature_set_rank(feature
, GST_RANK_PRIMARY
);
107 gst_object_unref(feature
);
112 // see http://stackoverflow.com/questions/32477403/how-to-know-if-sse2-is-activated-in-opencv
113 // see http://answers.opencv.org/question/696/how-to-enable-vectorization-in-opencv/
114 if (!cv::checkHardwareSupport(CV_CPU_SSE
)) {
115 qWarning() << "SSE not supported";
117 if (!cv::checkHardwareSupport(CV_CPU_SSE2
)) {
118 qWarning() << "SSE2 not supported";
120 if (!cv::checkHardwareSupport(CV_CPU_SSE3
)) {
121 qWarning() << "SSE3 not supported";
123 qDebug() << "MMX :" << cv::checkHardwareSupport(CV_CPU_MMX
);
124 qDebug() << "SSE :" << cv::checkHardwareSupport(CV_CPU_SSE
);
125 qDebug() << "SSE2 :" << cv::checkHardwareSupport(CV_CPU_SSE2
);
126 qDebug() << "SSE3 :" << cv::checkHardwareSupport(CV_CPU_SSE3
);
127 qDebug() << "SSE4_1 :" << cv::checkHardwareSupport(CV_CPU_SSE4_1
);
128 qDebug() << "SSE4_2 :" << cv::checkHardwareSupport(CV_CPU_SSE4_2
);
132 QString
gst::version(void)
135 return QString(gst_version_string());