diff --git a/QGCApplication.pro b/QGCApplication.pro index c62f3e279a7e8ee4ae340b310b8957f7f61771fa..ea05c690ceb0fef37dc96cdbbc752173558f5366 100644 --- a/QGCApplication.pro +++ b/QGCApplication.pro @@ -668,12 +668,14 @@ INCLUDEPATH += \ HEADERS += \ src/VideoStreaming/VideoItem.h \ src/VideoStreaming/VideoReceiver.h \ + src/VideoStreaming/VideoStreaming.h \ src/VideoStreaming/VideoSurface.h \ src/VideoStreaming/VideoSurface_p.h \ SOURCES += \ src/VideoStreaming/VideoItem.cc \ src/VideoStreaming/VideoReceiver.cc \ + src/VideoStreaming/VideoStreaming.cc \ src/VideoStreaming/VideoSurface.cc \ contains (DEFINES, DISABLE_VIDEOSTREAMING) { diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 346bdb7394ebe745d8ae6bf73ca853943c09ebaa..31f3fe601c38686474e39f1c4bd10cb6c00aabd6 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -40,13 +40,7 @@ #include -#include -#include -#if defined(QGC_GST_STREAMING) -G_BEGIN_DECLS -GST_PLUGIN_STATIC_DECLARE(QTVIDEOSINK_NAME); -G_END_DECLS -#endif +#include "VideoStreaming.h" #include "configuration.h" #include "QGC.h" @@ -277,49 +271,15 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION); } - //---------------------------------------------------------------- - //-- Video Streaming -#if defined(QGC_GST_STREAMING) -#ifdef Q_OS_MAC -#ifndef __ios__ -#ifdef QGC_INSTALL_RELEASE - QString currentDir = QCoreApplication::applicationDirPath(); - qgcputenv("GST_PLUGIN_SCANNER", currentDir, "/gst-plugin-scanner"); - qgcputenv("GTK_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current"); - qgcputenv("GIO_EXTRA_MODULES", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gio/modules"); - qgcputenv("GST_PLUGIN_SYSTEM_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); - qgcputenv("GST_PLUGIN_SYSTEM_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); - qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); - qgcputenv("GST_PLUGIN_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); -// QStringList env = QProcessEnvironment::systemEnvironment().keys(); -// foreach(QString key, env) { -// qDebug() << key << QProcessEnvironment::systemEnvironment().value(key); -// } -#endif -#endif -#endif -#endif - - qmlRegisterType("QGroundControl.QgcQtGStreamer", 1, 0, "VideoItem"); - qmlRegisterUncreatableType("QGroundControl.QgcQtGStreamer", 1, 0, "VideoSurface", QLatin1String("VideoSurface from QML is not supported")); - -#if defined(QGC_GST_STREAMING) - GError* error = NULL; - if (!gst_init_check(&argc, &argv, &error)) { - qCritical() << "gst_init_check() failed: " << error->message; - g_error_free(error); - } - GST_PLUGIN_STATIC_REGISTER(QTVIDEOSINK_NAME); -#endif + // Initialize Video Streaming + initializeVideoStreaming(argc, argv); } QGCApplication::~QGCApplication() { _destroySingletons(); -#if defined(QGC_GST_STREAMING) - gst_deinit(); -#endif + shutdownVideoStreaming(); } void QGCApplication::_initCommon(void) @@ -349,7 +309,7 @@ void QGCApplication::_initCommon(void) qmlRegisterType ("QGroundControl.Controllers", 1, 0, "ScreenToolsController"); #ifndef __mobile__ - qmlRegisterType("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); + qmlRegisterType ("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); qmlRegisterType ("QGroundControl.Controllers", 1, 0, "JoystickConfigController"); #endif