Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
681556fa
Commit
681556fa
authored
Aug 31, 2016
by
Gus Grubba
Committed by
GitHub
Aug 31, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4003 from dogmaphobic/rtspAndroid
Adding static RTSP libraries and dependencies to Android.
parents
a64fb6b2
fffcbe7d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
6 deletions
+67
-6
QGCCommon.pri
QGCCommon.pri
+1
-0
VideoStreaming.cc
src/VideoStreaming/VideoStreaming.cc
+56
-1
VideoStreaming.pri
src/VideoStreaming/VideoStreaming.pri
+10
-5
No files found.
QGCCommon.pri
View file @
681556fa
...
...
@@ -38,6 +38,7 @@ linux {
equals(ANDROID_TARGET_ARCH, x86) {
CONFIG += Androidx86Build
DEFINES += __androidx86__
DEFINES += QGC_DISABLE_UVC
message("Android x86 build")
} else {
message("Android Arm build")
...
...
src/VideoStreaming/VideoStreaming.cc
View file @
681556fa
/****************************************************************************
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
...
...
@@ -19,6 +19,9 @@
#if defined(QGC_GST_STREAMING)
#include <gst/gst.h>
#ifdef __android__
//#define ANDDROID_GST_DEBUG
#endif
#endif
#include "VideoStreaming.h"
...
...
@@ -34,9 +37,11 @@
GST_PLUGIN_STATIC_DECLARE
(
coreelements
);
GST_PLUGIN_STATIC_DECLARE
(
libav
);
GST_PLUGIN_STATIC_DECLARE
(
rtp
);
GST_PLUGIN_STATIC_DECLARE
(
rtsp
);
GST_PLUGIN_STATIC_DECLARE
(
udp
);
GST_PLUGIN_STATIC_DECLARE
(
videoparsersbad
);
GST_PLUGIN_STATIC_DECLARE
(
x264
);
GST_PLUGIN_STATIC_DECLARE
(
rtpmanager
);
#endif
G_END_DECLS
#endif
...
...
@@ -51,6 +56,49 @@ static void qgcputenv(const QString& key, const QString& root, const QString& pa
#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
[])
{
#if defined(QGC_GST_STREAMING)
...
...
@@ -70,6 +118,11 @@ void initializeVideoStreaming(int &argc, char* argv[])
qgcputenv
(
"GST_PLUGIN_PATH"
,
currentDir
,
"/gstreamer-plugins"
);
#endif
// Initialize GStreamer
#ifdef ANDDROID_GST_DEBUG
start_logger
(
"gst_log"
);
qputenv
(
"GST_DEBUG"
,
"*:4"
);
qputenv
(
"GST_DEBUG_NO_COLOR"
,
"1"
);
#endif
GError
*
error
=
NULL
;
if
(
!
gst_init_check
(
&
argc
,
&
argv
,
&
error
))
{
qCritical
()
<<
"gst_init_check() failed: "
<<
error
->
message
;
...
...
@@ -82,9 +135,11 @@ void initializeVideoStreaming(int &argc, char* argv[])
GST_PLUGIN_STATIC_REGISTER
(
coreelements
);
GST_PLUGIN_STATIC_REGISTER
(
libav
);
GST_PLUGIN_STATIC_REGISTER
(
rtp
);
GST_PLUGIN_STATIC_REGISTER
(
rtsp
);
GST_PLUGIN_STATIC_REGISTER
(
udp
);
GST_PLUGIN_STATIC_REGISTER
(
videoparsersbad
);
GST_PLUGIN_STATIC_REGISTER
(
x264
);
GST_PLUGIN_STATIC_REGISTER
(
rtpmanager
);
#endif
#else
Q_UNUSED
(
argc
);
...
...
src/VideoStreaming/VideoStreaming.pri
View file @
681556fa
...
...
@@ -89,19 +89,24 @@ LinuxBuild {
-lgstcoreelements \
-lgstudp \
-lgstrtp \
-lgstrtsp \
-lgstx264 \
-lgstlibav \
-lgstvideoparsersbad
-lgstsdpelem \
-lgstvideoparsersbad \
-lgstrtpmanager \
-lgstrmdemux \
# Rest of GStreamer dependencies
LIBS += -L$$GST_ROOT/lib \
-lgstfft-1.0 -lm \
-lgstnet-1.0 -lgio-2.0 \
-lgstaudio-1.0 -lgstcodecparsers-1.0 -lgstbase-1.0 \
-lgstreamer-1.0 -lgsttag-1.0 -lgstrtp-1.0 -lgstpbutils-1.0 \
-lgstvideo-1.0 -lavformat -lavcodec -lavresample -lavutil -lx264 \
-lbz2 -lgobject-2.0 \
-Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lorc-0.4 -liconv -lffi -lintl
-lgstreamer-1.0 -lgstrtp-1.0 -lgstpbutils-1.0 -lgstrtsp-1.0 -lgsttag-1.0 \
-lgstvideo-1.0 -lavformat -lavcodec -lavutil -lx264 -lavresample \
-lgstriff-1.0 -lgstcontroller-1.0 -lgstapp-1.0 \
-lgstsdp-1.0 -lbz2 -lgobject-2.0 \
-Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lorc-0.4 -liconv -lffi -lintl \
INCLUDEPATH += \
$$GST_ROOT/include/gstreamer-1.0 \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment