Commit fffcbe7d authored by dogmaphobic's avatar dogmaphobic

Adding static RTSP libraries and dependencies to Android.

parent a64fb6b2
...@@ -38,6 +38,7 @@ linux { ...@@ -38,6 +38,7 @@ linux {
equals(ANDROID_TARGET_ARCH, x86) { equals(ANDROID_TARGET_ARCH, x86) {
CONFIG += Androidx86Build CONFIG += Androidx86Build
DEFINES += __androidx86__ DEFINES += __androidx86__
DEFINES += QGC_DISABLE_UVC
message("Android x86 build") message("Android x86 build")
} else { } else {
message("Android Arm build") message("Android Arm build")
......
/**************************************************************************** /****************************************************************************
* *
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> * (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
* *
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#if defined(QGC_GST_STREAMING) #if defined(QGC_GST_STREAMING)
#include <gst/gst.h> #include <gst/gst.h>
#ifdef __android__
//#define ANDDROID_GST_DEBUG
#endif
#endif #endif
#include "VideoStreaming.h" #include "VideoStreaming.h"
...@@ -34,9 +37,11 @@ ...@@ -34,9 +37,11 @@
GST_PLUGIN_STATIC_DECLARE(coreelements); GST_PLUGIN_STATIC_DECLARE(coreelements);
GST_PLUGIN_STATIC_DECLARE(libav); GST_PLUGIN_STATIC_DECLARE(libav);
GST_PLUGIN_STATIC_DECLARE(rtp); GST_PLUGIN_STATIC_DECLARE(rtp);
GST_PLUGIN_STATIC_DECLARE(rtsp);
GST_PLUGIN_STATIC_DECLARE(udp); GST_PLUGIN_STATIC_DECLARE(udp);
GST_PLUGIN_STATIC_DECLARE(videoparsersbad); GST_PLUGIN_STATIC_DECLARE(videoparsersbad);
GST_PLUGIN_STATIC_DECLARE(x264); GST_PLUGIN_STATIC_DECLARE(x264);
GST_PLUGIN_STATIC_DECLARE(rtpmanager);
#endif #endif
G_END_DECLS G_END_DECLS
#endif #endif
...@@ -51,6 +56,49 @@ static void qgcputenv(const QString& key, const QString& root, const QString& pa ...@@ -51,6 +56,49 @@ static void qgcputenv(const QString& key, const QString& root, const QString& pa
#endif #endif
#endif #endif
#ifdef ANDDROID_GST_DEBUG
// Redirects stdio and stderr to logcat
#include <unistd.h>
#include <pthread.h>
#include <android/log.h>
static int pfd[2];
static pthread_t thr;
static const char *tag = "myapp";
static void *thread_func(void*)
{
ssize_t rdsz;
char buf[128];
while((rdsz = read(pfd[0], buf, sizeof buf - 1)) > 0) {
if(buf[rdsz - 1] == '\n') --rdsz;
buf[rdsz] = 0; /* add null-terminator */
__android_log_write(ANDROID_LOG_DEBUG, tag, buf);
}
return 0;
}
int start_logger(const char *app_name)
{
tag = app_name;
/* make stdout line-buffered and stderr unbuffered */
setvbuf(stdout, 0, _IOLBF, 0);
setvbuf(stderr, 0, _IONBF, 0);
/* create the pipe and redirect stdout and stderr */
pipe(pfd);
dup2(pfd[1], 1);
dup2(pfd[1], 2);
/* spawn the logging thread */
if(pthread_create(&thr, 0, thread_func, 0) == -1)
return -1;
pthread_detach(thr);
return 0;
}
#endif
void initializeVideoStreaming(int &argc, char* argv[]) void initializeVideoStreaming(int &argc, char* argv[])
{ {
#if defined(QGC_GST_STREAMING) #if defined(QGC_GST_STREAMING)
...@@ -70,6 +118,11 @@ void initializeVideoStreaming(int &argc, char* argv[]) ...@@ -70,6 +118,11 @@ void initializeVideoStreaming(int &argc, char* argv[])
qgcputenv("GST_PLUGIN_PATH", currentDir, "/gstreamer-plugins"); qgcputenv("GST_PLUGIN_PATH", currentDir, "/gstreamer-plugins");
#endif #endif
// Initialize GStreamer // Initialize GStreamer
#ifdef ANDDROID_GST_DEBUG
start_logger("gst_log");
qputenv("GST_DEBUG", "*:4");
qputenv("GST_DEBUG_NO_COLOR", "1");
#endif
GError* error = NULL; GError* error = NULL;
if (!gst_init_check(&argc, &argv, &error)) { if (!gst_init_check(&argc, &argv, &error)) {
qCritical() << "gst_init_check() failed: " << error->message; qCritical() << "gst_init_check() failed: " << error->message;
...@@ -82,9 +135,11 @@ void initializeVideoStreaming(int &argc, char* argv[]) ...@@ -82,9 +135,11 @@ void initializeVideoStreaming(int &argc, char* argv[])
GST_PLUGIN_STATIC_REGISTER(coreelements); GST_PLUGIN_STATIC_REGISTER(coreelements);
GST_PLUGIN_STATIC_REGISTER(libav); GST_PLUGIN_STATIC_REGISTER(libav);
GST_PLUGIN_STATIC_REGISTER(rtp); GST_PLUGIN_STATIC_REGISTER(rtp);
GST_PLUGIN_STATIC_REGISTER(rtsp);
GST_PLUGIN_STATIC_REGISTER(udp); GST_PLUGIN_STATIC_REGISTER(udp);
GST_PLUGIN_STATIC_REGISTER(videoparsersbad); GST_PLUGIN_STATIC_REGISTER(videoparsersbad);
GST_PLUGIN_STATIC_REGISTER(x264); GST_PLUGIN_STATIC_REGISTER(x264);
GST_PLUGIN_STATIC_REGISTER(rtpmanager);
#endif #endif
#else #else
Q_UNUSED(argc); Q_UNUSED(argc);
......
...@@ -89,19 +89,24 @@ LinuxBuild { ...@@ -89,19 +89,24 @@ LinuxBuild {
-lgstcoreelements \ -lgstcoreelements \
-lgstudp \ -lgstudp \
-lgstrtp \ -lgstrtp \
-lgstrtsp \
-lgstx264 \ -lgstx264 \
-lgstlibav \ -lgstlibav \
-lgstvideoparsersbad -lgstsdpelem \
-lgstvideoparsersbad \
-lgstrtpmanager \
-lgstrmdemux \
# Rest of GStreamer dependencies # Rest of GStreamer dependencies
LIBS += -L$$GST_ROOT/lib \ LIBS += -L$$GST_ROOT/lib \
-lgstfft-1.0 -lm \ -lgstfft-1.0 -lm \
-lgstnet-1.0 -lgio-2.0 \ -lgstnet-1.0 -lgio-2.0 \
-lgstaudio-1.0 -lgstcodecparsers-1.0 -lgstbase-1.0 \ -lgstaudio-1.0 -lgstcodecparsers-1.0 -lgstbase-1.0 \
-lgstreamer-1.0 -lgsttag-1.0 -lgstrtp-1.0 -lgstpbutils-1.0 \ -lgstreamer-1.0 -lgstrtp-1.0 -lgstpbutils-1.0 -lgstrtsp-1.0 -lgsttag-1.0 \
-lgstvideo-1.0 -lavformat -lavcodec -lavresample -lavutil -lx264 \ -lgstvideo-1.0 -lavformat -lavcodec -lavutil -lx264 -lavresample \
-lbz2 -lgobject-2.0 \ -lgstriff-1.0 -lgstcontroller-1.0 -lgstapp-1.0 \
-Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lorc-0.4 -liconv -lffi -lintl -lgstsdp-1.0 -lbz2 -lgobject-2.0 \
-Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lorc-0.4 -liconv -lffi -lintl \
INCLUDEPATH += \ INCLUDEPATH += \
$$GST_ROOT/include/gstreamer-1.0 \ $$GST_ROOT/include/gstreamer-1.0 \
......
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