Commit 32a13b19 authored by Gus Grubba's avatar Gus Grubba

Properly initialize GStreamer on iOS

parent fa8172e7
......@@ -22,6 +22,9 @@
#ifdef __android__
//#define ANDDROID_GST_DEBUG
#endif
#if defined(__ios__)
#include "gst_ios_init.h"
#endif
#endif
#include "VideoStreaming.h"
......@@ -120,8 +123,12 @@ void initializeVideoStreaming(int &argc, char* argv[], char* logpath, char* debu
qgcputenv("GST_PLUGIN_PATH", currentDir, "/gstreamer-plugins");
#endif
// Initialize GStreamer
#if !defined(__ios__)
// Initialize GStreamer
#if defined(__ios__)
//-- iOS specific initialization
gst_ios_init();
#else
//-- Generic initialization
if (logpath) {
if (debuglevel) {
qputenv("GST_DEBUG", debuglevel);
......@@ -130,16 +137,16 @@ void initializeVideoStreaming(int &argc, char* argv[], char* logpath, char* debu
qputenv("GST_DEBUG_FILE", QString("%1/%2").arg(logpath).arg("gstreamer-log.txt").toUtf8());
qputenv("GST_DEBUG_DUMP_DOT_DIR", logpath);
}
#endif
GError* error = nullptr;
if (!gst_init_check(&argc, &argv, &error)) {
qCritical() << "gst_init_check() failed: " << error->message;
g_error_free(error);
}
#endif
// Our own plugin
GST_PLUGIN_STATIC_REGISTER(QGC_VIDEOSINK_PLUGIN);
// The static plugins we use
#if defined(__mobile__) && !defined(Q_OS_MAC)
#if defined(__android__)
GST_PLUGIN_STATIC_REGISTER(coreelements);
GST_PLUGIN_STATIC_REGISTER(libav);
GST_PLUGIN_STATIC_REGISTER(rtp);
......
......@@ -178,6 +178,13 @@ VideoEnabled {
$$PWD/gstqtvideosink/utils/bufferformat.cpp \
$$PWD/gstqtvideosink/utils/utils.cpp \
iOSBuild {
OBJECTIVE_SOURCES += \
$$PWD/ios/gst_ios_init.m
INCLUDEPATH += \
$$PWD/ios
}
} else {
LinuxBuild|MacBuild|iOSBuild|WindowsBuild|AndroidBuild {
message("Skipping support for video streaming (GStreamer libraries not installed)")
......
......@@ -16,7 +16,7 @@
#pragma once
#if defined(__mobile__) && !defined(Q_OS_MAC)
#if defined(__andoid__) || defined(__ios__)
#include <QOpenGLFunctions>
#define getQOpenGLFunctions() QOpenGLContext::currentContext()->functions()
#define QOpenGLFunctionsDef QOpenGLFunctions
......
#ifndef __GST_IOS_INIT_H__
#define __GST_IOS_INIT_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_G_IO_MODULE_DECLARE(name) \
extern void G_PASTE(g_io_module_, G_PASTE(name, _load_static)) (void)
#define GST_G_IO_MODULE_LOAD(name) \
G_PASTE(g_io_module_, G_PASTE(name, _load_static)) ()
/* Uncomment each line to enable the plugin categories that your application needs.
* You can also enable individual plugins. See gst_ios_init.c to see their names
*/
//#define GST_IOS_PLUGINS_GES
#define GST_IOS_PLUGINS_CORE
//#define GST_IOS_PLUGINS_CAPTURE
//#define GST_IOS_PLUGINS_CODECS_RESTRICTED
//#define GST_IOS_PLUGINS_ENCODING
//#define GST_IOS_PLUGINS_CODECS_GPL
//#define GST_IOS_PLUGINS_NET_RESTRICTED
//#define GST_IOS_PLUGINS_SYS
//#define GST_IOS_PLUGINS_VIS
//#define GST_IOS_PLUGINS_PLAYBACK
//#define GST_IOS_PLUGINS_EFFECTS
//#define GST_IOS_PLUGINS_CODECS
#define GST_IOS_PLUGINS_NET
//-- Specific to QGC
#define GST_IOS_PLUGIN_X264
#define GST_IOS_PLUGIN_LIBAV
#define GST_IOS_PLUGIN_ISOMP4
#define GST_IOS_PLUGIN_VIDEOPARSERSBAD
#define GST_IOS_PLUGIN_MATROSKA
//#define GST_IOS_GIO_MODULE_GNUTLS
void gst_ios_init (void);
G_END_DECLS
#endif
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment