Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
b45b8530
Unverified
Commit
b45b8530
authored
Feb 10, 2020
by
Gus Grubba
Committed by
GitHub
Feb 10, 2020
Browse files
Merge pull request #8287 from andrewvoznytsa/PR-automatic-pipelines
Automatic pipelines support
parents
a7774f1b
0a8f58e8
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
android.pri
View file @
b45b8530
...
...
@@ -16,7 +16,11 @@ OTHER_FILES += \
$$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java \
$$PWD/android/src/org/mavlink/qgroundcontrol/QGCActivity.java \
$$PWD/android/src/org/mavlink/qgroundcontrol/UsbIoManager.java \
$$PWD/android/src/org/mavlink/qgroundcontrol/TaiSync.java
$$PWD/android/src/org/mavlink/qgroundcontrol/TaiSync.java \
$$PWD/android/src/org/freedesktop/gstreamer/androidmedia/GstAhcCallback.java \
$$PWD/android/src/org/freedesktop/gstreamer/androidmedia/GstAhsCallback.java \
$$PWD/android/src/org/freedesktop/gstreamer/androidmedia/GstAmcOnFrameAvailableListener.java
DISTFILES += \
$$PWD/android/gradle/wrapper/gradle-wrapper.jar \
...
...
android/src/org/freedesktop/gstreamer/androidmedia/GstAhcCallback.java
0 → 100644
View file @
b45b8530
/*
* Copyright (C) 2012, Collabora Ltd.
* Author: Youness Alaoui
*
* Copyright (C) 2015, Collabora Ltd.
* Author: Justin Kim <justin.kim@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
package
org.freedesktop.gstreamer.androidmedia
;
import
android.hardware.Camera
;
public
class
GstAhcCallback
implements
Camera
.
PreviewCallback
,
Camera
.
ErrorCallback
,
Camera
.
AutoFocusCallback
{
public
long
mUserData
;
public
long
mCallback
;
public
static
native
void
gst_ah_camera_on_preview_frame
(
byte
[]
data
,
Camera
camera
,
long
callback
,
long
user_data
);
public
static
native
void
gst_ah_camera_on_error
(
int
error
,
Camera
camera
,
long
callback
,
long
user_data
);
public
static
native
void
gst_ah_camera_on_auto_focus
(
boolean
success
,
Camera
camera
,
long
callback
,
long
user_data
);
public
GstAhcCallback
(
long
callback
,
long
user_data
)
{
mCallback
=
callback
;
mUserData
=
user_data
;
}
@Override
public
void
onPreviewFrame
(
byte
[]
data
,
Camera
camera
)
{
gst_ah_camera_on_preview_frame
(
data
,
camera
,
mCallback
,
mUserData
);
}
@Override
public
void
onError
(
int
error
,
Camera
camera
)
{
gst_ah_camera_on_error
(
error
,
camera
,
mCallback
,
mUserData
);
}
@Override
public
void
onAutoFocus
(
boolean
success
,
Camera
camera
)
{
gst_ah_camera_on_auto_focus
(
success
,
camera
,
mCallback
,
mUserData
);
}
}
android/src/org/freedesktop/gstreamer/androidmedia/GstAhsCallback.java
0 → 100644
View file @
b45b8530
/*
* Copyright (C) 2016 SurroundIO
* Author: Martin Kelly <martin@surround.io>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
package
org.freedesktop.gstreamer.androidmedia
;
import
android.hardware.Sensor
;
import
android.hardware.SensorEvent
;
import
android.hardware.SensorEventListener
;
public
class
GstAhsCallback
implements
SensorEventListener
{
public
long
mUserData
;
public
long
mSensorCallback
;
public
long
mAccuracyCallback
;
public
static
native
void
gst_ah_sensor_on_sensor_changed
(
SensorEvent
event
,
long
callback
,
long
user_data
);
public
static
native
void
gst_ah_sensor_on_accuracy_changed
(
Sensor
sensor
,
int
accuracy
,
long
callback
,
long
user_data
);
public
GstAhsCallback
(
long
sensor_callback
,
long
accuracy_callback
,
long
user_data
)
{
mSensorCallback
=
sensor_callback
;
mAccuracyCallback
=
accuracy_callback
;
mUserData
=
user_data
;
}
@Override
public
void
onSensorChanged
(
SensorEvent
event
)
{
gst_ah_sensor_on_sensor_changed
(
event
,
mSensorCallback
,
mUserData
);
}
@Override
public
void
onAccuracyChanged
(
Sensor
sensor
,
int
accuracy
)
{
gst_ah_sensor_on_accuracy_changed
(
sensor
,
accuracy
,
mAccuracyCallback
,
mUserData
);
}
}
android/src/org/freedesktop/gstreamer/androidmedia/GstAmcOnFrameAvailableListener.java
0 → 100644
View file @
b45b8530
/*
* Copyright (C) 2015, Collabora Ltd.
* Author: Matthieu Bouron <matthieu.bouron@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
package
org.freedesktop.gstreamer.androidmedia
;
import
android.graphics.SurfaceTexture
;
import
android.graphics.SurfaceTexture.OnFrameAvailableListener
;
public
class
GstAmcOnFrameAvailableListener
implements
OnFrameAvailableListener
{
private
long
context
=
0
;
public
synchronized
void
onFrameAvailable
(
SurfaceTexture
surfaceTexture
)
{
native_onFrameAvailable
(
context
,
surfaceTexture
);
}
public
synchronized
long
getContext
()
{
return
context
;
}
public
synchronized
void
setContext
(
long
c
)
{
context
=
c
;
}
private
native
void
native_onFrameAvailable
(
long
context
,
SurfaceTexture
surfaceTexture
);
}
android/src/org/mavlink/qgroundcontrol/QGCActivity.java
View file @
b45b8530
...
...
@@ -183,7 +183,7 @@ public class QGCActivity extends QtActivity
public
static
native
void
qgcLogDebug
(
String
message
);
public
static
native
void
qgcLogWarning
(
String
message
);
p
rivate
stat
ic
native
void
nativeInit
();
p
ubl
ic
native
void
nativeInit
();
// QGCActivity singleton
public
QGCActivity
()
...
...
@@ -198,6 +198,7 @@ public class QGCActivity extends QtActivity
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
nativeInit
();
PowerManager
pm
=
(
PowerManager
)
_instance
.
getSystemService
(
Context
.
POWER_SERVICE
);
_wakeLock
=
pm
.
newWakeLock
(
PowerManager
.
SCREEN_BRIGHT_WAKE_LOCK
,
"QGroundControl"
);
if
(
_wakeLock
!=
null
)
{
...
...
@@ -743,10 +744,5 @@ public class QGCActivity extends QtActivity
}
}).
start
();
}
public
void
jniOnLoad
()
{
nativeInit
();
}
}
custom-example/src/CustomVideoManager.cc
View file @
b45b8530
...
...
@@ -24,16 +24,6 @@ CustomVideoManager::_updateSettings()
{
if
(
!
_videoSettings
||
!
_videoReceiver
)
return
;
//-- Check encoding
if
(
_activeVehicle
&&
_activeVehicle
->
dynamicCameras
())
{
auto
*
pCamera
=
qobject_cast
<
CustomCameraControl
*>
(
_activeVehicle
->
dynamicCameras
()
->
currentCameraInstance
());
if
(
pCamera
)
{
Fact
*
fact
=
pCamera
->
videoEncoding
();
if
(
fact
)
{
_videoReceiver
->
setVideoDecoder
(
static_cast
<
VideoReceiver
::
VideoEncoding
>
(
fact
->
rawValue
().
toInt
()));
}
}
}
VideoManager
::
_updateSettings
();
}
custom-example/src/FirmwarePlugin/CustomCameraControl.cc
View file @
b45b8530
...
...
@@ -19,7 +19,6 @@ QGC_LOGGING_CATEGORY(CustomCameraVerboseLog, "CustomCameraVerboseLog")
static
const
char
*
kCAM_IRPALETTE
=
"CAM_IRPALETTE"
;
static
const
char
*
kCAM_NEXTVISION_IRPALETTE
=
"IR_SENS_POL"
;
static
const
char
*
kCAM_ENC
=
"CAM_ENC"
;
//-----------------------------------------------------------------------------
CustomCameraControl
::
CustomCameraControl
(
const
mavlink_camera_information_t
*
info
,
Vehicle
*
vehicle
,
int
compID
,
QObject
*
parent
)
...
...
@@ -117,13 +116,6 @@ CustomCameraControl::irPalette()
return
nullptr
;
}
//-----------------------------------------------------------------------------
Fact
*
CustomCameraControl
::
videoEncoding
()
{
return
_paramComplete
?
getFact
(
kCAM_ENC
)
:
nullptr
;
}
//-----------------------------------------------------------------------------
void
CustomCameraControl
::
setThermalMode
(
ThermalViewMode
mode
)
...
...
custom-example/src/FirmwarePlugin/CustomCameraControl.h
View file @
b45b8530
...
...
@@ -29,10 +29,8 @@ public:
CustomCameraControl
(
const
mavlink_camera_information_t
*
info
,
Vehicle
*
vehicle
,
int
compID
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
Fact
*
irPalette
READ
irPalette
NOTIFY
parametersReady
)
Q_PROPERTY
(
Fact
*
videoEncoding
READ
videoEncoding
NOTIFY
parametersReady
)
Fact
*
irPalette
();
Fact
*
videoEncoding
();
bool
takePhoto
()
override
;
bool
stopTakePhoto
()
override
;
...
...
src/FlightDisplay/VideoManager.cc
View file @
b45b8530
...
...
@@ -282,8 +282,44 @@ VideoManager::setfullScreen(bool f)
//-----------------------------------------------------------------------------
#if defined(QGC_GST_STREAMING)
gboolean
VideoManager
::
_videoSinkQuery
(
GstPad
*
pad
,
GstObject
*
parent
,
GstQuery
*
query
)
{
GstElement
*
element
;
switch
(
GST_QUERY_TYPE
(
query
))
{
case
GST_QUERY_CAPS
:
element
=
gst_bin_get_by_name
(
GST_BIN
(
parent
),
"glupload"
);
break
;
case
GST_QUERY_CONTEXT
:
element
=
gst_bin_get_by_name
(
GST_BIN
(
parent
),
"qmlglsink"
);
break
;
default:
return
gst_pad_query_default
(
pad
,
parent
,
query
);
}
if
(
element
==
nullptr
)
{
qWarning
()
<<
"VideoManager::_videoSinkQuery(): No element found"
;
return
FALSE
;
}
GstPad
*
sinkpad
=
gst_element_get_static_pad
(
element
,
"sink"
);
if
(
sinkpad
==
nullptr
)
{
qWarning
()
<<
"VideoManager::_videoSinkQuery(): No sink pad found"
;
return
FALSE
;
}
const
gboolean
ret
=
gst_pad_query
(
sinkpad
,
query
);
gst_object_unref
(
sinkpad
);
sinkpad
=
nullptr
;
return
ret
;
}
GstElement
*
VideoManager
::
_makeVideoSink
(
const
QString
&
widget
Name
)
VideoManager
::
_makeVideoSink
(
gpointer
widget
)
{
GstElement
*
glupload
=
nullptr
;
GstElement
*
glcolorconvert
=
nullptr
;
...
...
@@ -292,31 +328,17 @@ VideoManager::_makeVideoSink(const QString& widgetName)
GstElement
*
sink
=
nullptr
;
do
{
QQuickItem
*
root
=
qgcApp
()
->
mainRootWindow
();
if
(
root
==
nullptr
)
{
qCDebug
(
VideoManagerLog
)
<<
"VideoManager::_makeVideoSink() failed. No root window"
;
break
;
}
QQuickItem
*
widget
=
root
->
findChild
<
QQuickItem
*>
(
widgetName
);
if
(
widget
==
nullptr
)
{
qCDebug
(
VideoManagerLog
)
<<
"VideoManager::_makeVideoSink() failed. Widget
\'
"
<<
widgetName
<<
"
\'
not found"
;
break
;
}
if
((
glupload
=
gst_element_factory_make
(
"glupload"
,
nullptr
))
==
nullptr
)
{
if
((
glupload
=
gst_element_factory_make
(
"glupload"
,
"glupload"
))
==
nullptr
)
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_element_factory_make('glupload')"
;
break
;
}
if
((
glcolorconvert
=
gst_element_factory_make
(
"glcolorconvert"
,
nullptr
))
==
nullptr
)
{
if
((
glcolorconvert
=
gst_element_factory_make
(
"glcolorconvert"
,
"glcolorconvert"
))
==
nullptr
)
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_element_factory_make('glcolorconvert')"
;
break
;
}
if
((
qmlglsink
=
gst_element_factory_make
(
"qmlglsink"
,
nullptr
))
==
nullptr
)
{
if
((
qmlglsink
=
gst_element_factory_make
(
"qmlglsink"
,
"qmlglsink"
))
==
nullptr
)
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_element_factory_make('qmlglsink')"
;
break
;
}
...
...
@@ -336,6 +358,7 @@ VideoManager::_makeVideoSink(const QString& widgetName)
}
gst_bin_add_many
(
GST_BIN
(
bin
),
glupload
,
glcolorconvert
,
qmlglsink
,
nullptr
);
gboolean
ret
=
gst_element_link_many
(
glupload
,
glcolorconvert
,
qmlglsink
,
nullptr
);
qmlglsink
=
glcolorconvert
=
glupload
=
nullptr
;
...
...
@@ -345,7 +368,12 @@ VideoManager::_makeVideoSink(const QString& widgetName)
break
;
}
gst_element_add_pad
(
bin
,
gst_ghost_pad_new
(
"sink"
,
pad
));
GstPad
*
ghostpad
=
gst_ghost_pad_new
(
"sink"
,
pad
);
gst_pad_set_query_function
(
ghostpad
,
_videoSinkQuery
);
gst_element_add_pad
(
bin
,
ghostpad
);
gst_object_unref
(
pad
);
pad
=
nullptr
;
...
...
@@ -382,8 +410,28 @@ void
VideoManager
::
_initVideo
()
{
#if defined(QGC_GST_STREAMING)
_videoReceiver
->
setVideoSink
(
_makeVideoSink
(
"videoContent"
));
_thermalVideoReceiver
->
setVideoSink
(
_makeVideoSink
(
"thermalVideo"
));
QQuickItem
*
root
=
qgcApp
()
->
mainRootWindow
();
if
(
root
==
nullptr
)
{
qCDebug
(
VideoManagerLog
)
<<
"VideoManager::_makeVideoSink() failed. No root window"
;
return
;
}
QQuickItem
*
widget
=
root
->
findChild
<
QQuickItem
*>
(
"videoContent"
);
if
(
widget
!=
nullptr
)
{
_videoReceiver
->
setVideoSink
(
_makeVideoSink
(
widget
));
}
else
{
qCDebug
(
VideoManagerLog
)
<<
"VideoManager::_makeVideoSink() failed. 'videoContent' widget not found"
;
}
widget
=
root
->
findChild
<
QQuickItem
*>
(
"thermalVideo"
);
if
(
widget
!=
nullptr
)
{
_thermalVideoReceiver
->
setVideoSink
(
_makeVideoSink
(
widget
));
}
else
{
qCDebug
(
VideoManagerLog
)
<<
"VideoManager::_makeVideoSink() failed. 'thermalVideo' widget not found"
;
}
#endif
}
...
...
src/FlightDisplay/VideoManager.h
View file @
b45b8530
...
...
@@ -105,7 +105,8 @@ protected slots:
protected:
friend
class
FinishVideoInitialization
;
#if defined(QGC_GST_STREAMING)
GstElement
*
_makeVideoSink
(
const
QString
&
widgetName
);
static
gboolean
_videoSinkQuery
(
GstPad
*
pad
,
GstObject
*
parent
,
GstQuery
*
query
);
GstElement
*
_makeVideoSink
(
gpointer
widget
);
#endif
void
_initVideo
();
void
_updateSettings
();
...
...
src/VideoStreaming/VideoReceiver.cc
View file @
b45b8530
This diff is collapsed.
Click to expand it.
src/VideoStreaming/VideoReceiver.h
View file @
b45b8530
...
...
@@ -32,12 +32,6 @@ class VideoReceiver : public QObject
{
Q_OBJECT
public:
enum
VideoEncoding
{
H264_SW
=
1
,
H264_HW
=
2
,
H265_SW
=
3
,
H265_HW
=
4
};
#if defined(QGC_GST_STREAMING)
Q_PROPERTY
(
bool
recording
READ
recording
NOTIFY
recordingChanged
)
...
...
@@ -63,7 +57,6 @@ public:
virtual
void
setShowFullScreen
(
bool
show
)
{
_showFullScreen
=
show
;
emit
showFullScreenChanged
();
}
void
setVideoDecoder
(
VideoEncoding
encoding
);
#if defined(QGC_GST_STREAMING)
void
setVideoSink
(
GstElement
*
videoSink
);
#endif
...
...
@@ -91,6 +84,7 @@ public slots:
protected
slots
:
virtual
void
_updateTimer
();
#if defined(QGC_GST_STREAMING)
GstElement
*
_makeSource
(
const
QString
&
uri
);
virtual
void
_restart_timeout
();
virtual
void
_tcp_timeout
();
virtual
void
_connected
();
...
...
@@ -109,7 +103,6 @@ protected:
GstElement
*
queue
;
GstElement
*
mux
;
GstElement
*
filesink
;
GstElement
*
parse
;
gboolean
removing
;
}
Sink
;
...
...
@@ -159,10 +152,5 @@ protected:
bool
_videoRunning
;
bool
_showFullScreen
;
VideoSettings
*
_videoSettings
;
const
char
*
_depayName
;
const
char
*
_parserName
;
bool
_tryWithHardwareDecoding
=
true
;
const
char
*
_hwDecoderName
;
const
char
*
_swDecoderName
;
};
src/VideoStreaming/VideoStreaming.cc
View file @
b45b8530
...
...
@@ -19,10 +19,23 @@
#if defined(QGC_GST_STREAMING)
#include
<gst/gst.h>
#ifdef __android__
//#define ANDDROID_GST_DEBUG
#endif
#if defined(__ios__)
#if defined(__android__)
#include
<android/log.h>
static
void
gst_android_log
(
GstDebugCategory
*
category
,
GstDebugLevel
level
,
const
gchar
*
file
,
const
gchar
*
function
,
gint
line
,
GObject
*
object
,
GstDebugMessage
*
message
,
gpointer
data
)
{
if
(
level
<=
gst_debug_category_get_threshold
(
category
))
{
__android_log_print
(
ANDROID_LOG_ERROR
,
"GST"
,
"%s, %s: %s"
,
file
,
function
,
gst_debug_message_get
(
message
));
}
}
#elif defined(__ios__)
#include
"gst_ios_init.h"
#endif
#else
...
...
@@ -34,8 +47,9 @@
#if defined(QGC_GST_STREAMING)
G_BEGIN_DECLS
// The static plugins we use
#if defined(__
mobile
__)
#if defined(__
android__) || defined(__ios
__)
GST_PLUGIN_STATIC_DECLARE
(
coreelements
);
GST_PLUGIN_STATIC_DECLARE
(
playback
);
GST_PLUGIN_STATIC_DECLARE
(
libav
);
GST_PLUGIN_STATIC_DECLARE
(
rtp
);
GST_PLUGIN_STATIC_DECLARE
(
rtsp
);
...
...
@@ -46,9 +60,11 @@
GST_PLUGIN_STATIC_DECLARE
(
isomp4
);
GST_PLUGIN_STATIC_DECLARE
(
matroska
);
GST_PLUGIN_STATIC_DECLARE
(
opengl
);
#endif
#if defined(__android__)
GST_PLUGIN_STATIC_DECLARE
(
androidmedia
);
#elif defined(__ios__)
GST_PLUGIN_STATIC_DECLARE
(
applemedia
);
#endif
#endif
GST_PLUGIN_STATIC_DECLARE
(
qmlgl
);
G_END_DECLS
...
...
@@ -64,49 +80,6 @@ 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
[],
char
*
logpath
,
char
*
debuglevel
)
{
#if defined(QGC_GST_STREAMING)
...
...
@@ -126,45 +99,56 @@ void initializeVideoStreaming(int &argc, char* argv[], char* logpath, char* debu
qgcputenv
(
"GST_PLUGIN_PATH"
,
currentDir
,
"/gstreamer-plugins"
);
#endif
// Initialize GStreamer
#if defined(__ios__)
//-- iOS specific initialization
gst_ios_init
();
#else
//-- Generic initialization
if
(
qgetenv
(
"GST_DEBUG"
).
isEmpty
()
&&
logpath
)
{
QString
gstDebugFile
=
QString
(
"%1/%2"
).
arg
(
logpath
).
arg
(
"gstreamer-log.txt"
);
qDebug
()
<<
"GStreamer debug output:"
<<
gstDebugFile
;
if
(
debuglevel
)
{
qputenv
(
"GST_DEBUG"
,
debuglevel
);
}
qputenv
(
"GST_DEBUG_NO_COLOR"
,
"1"
);
qputenv
(
"GST_DEBUG_FILE"
,
gstDebugFile
.
toUtf8
());
qputenv
(
"GST_DEBUG_DUMP_DOT_DIR"
,
logpath
);
}
GError
*
error
=
nullptr
;
if
(
!
gst_init_check
(
&
argc
,
&
argv
,
&
error
))
{
qCritical
()
<<
"gst_init_check() failed: "
<<
error
->
message
;
g_error_free
(
error
);
//-- Generic initialization
if
(
qgetenv
(
"GST_DEBUG"
).
isEmpty
()
&&
logpath
)
{
QString
gstDebugFile
=
QString
(
"%1/%2"
).
arg
(
logpath
).
arg
(
"gstreamer-log.txt"
);
qDebug
()
<<
"GStreamer debug output:"
<<
gstDebugFile
;
if
(
debuglevel
)
{
qputenv
(
"GST_DEBUG"
,
debuglevel
);
}
#endif
// The static plugins we use
#if defined(__android__)
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
);
GST_PLUGIN_STATIC_REGISTER
(
isomp4
);
GST_PLUGIN_STATIC_REGISTER
(
matroska
);
GST_PLUGIN_STATIC_REGISTER
(
androidmedia
);
#endif
qputenv
(
"GST_DEBUG_NO_COLOR"
,
"1"
);
qputenv
(
"GST_DEBUG_FILE"
,
gstDebugFile
.
toUtf8
());
qputenv
(
"GST_DEBUG_DUMP_DOT_DIR"
,
logpath
);
}
// Initialize GStreamer
#if defined(__android__)
gst_debug_add_log_function
(
gst_android_log
,
nullptr
,
nullptr
);
#elif defined(__ios__)
//-- iOS specific initialization
gst_ios_pre_init
();
#endif
#if defined(__mobile__)
GST_PLUGIN_STATIC_REGISTER
(
opengl
);
GError
*
error
=
nullptr
;
if
(
!
gst_init_check
(
&
argc
,
&
argv
,
&
error
))
{
qCritical
()
<<
"gst_init_check() failed: "
<<
error
->
message
;
g_error_free
(
error
);
}
// The static plugins we use
#if defined(__android__) || defined(__ios__)
GST_PLUGIN_STATIC_REGISTER
(
coreelements
);
GST_PLUGIN_STATIC_REGISTER
(
playback
);
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
);
GST_PLUGIN_STATIC_REGISTER
(
isomp4
);
GST_PLUGIN_STATIC_REGISTER
(
matroska
);
GST_PLUGIN_STATIC_REGISTER
(
opengl
);
#if defined(__android__)
GST_PLUGIN_STATIC_REGISTER
(
androidmedia
);
#elif defined(__ios__)
GST_PLUGIN_STATIC_REGISTER
(
applemedia
);
#endif
#endif
#if defined(__ios__)
gst_ios_post_init
();
#endif
/* the plugin must be loaded before loading the qml file to register the
...
...
@@ -185,7 +169,7 @@ void initializeVideoStreaming(int &argc, char* argv[], char* logpath, char* debu
qCritical
()
<<
"unable to find qmlglsink - you need to build it yourself and add to GST_PLUGIN_PATH"
;
}
#else
qmlRegisterType
<
GLVideoItemStub
>
(
"org.freedesktop.gstreamer.GLVideoItem"
,
1
,
0
,
"GstGLVideoItem"
);
qmlRegisterType
<
GLVideoItemStub
>
(
"org.freedesktop.gstreamer.GLVideoItem"
,
1
,
0
,
"GstGLVideoItem"
);
Q_UNUSED
(
argc
)
Q_UNUSED
(
argv
)
Q_UNUSED
(
logpath
)
...
...
src/VideoStreaming/VideoStreaming.pri
View file @
b45b8530
...
...
@@ -32,7 +32,7 @@ LinuxBuild {
exists($$GST_ROOT) {
CONFIG += VideoEnabled
INCLUDEPATH += $$GST_ROOT/Headers
LIBS += -F$$(HOME)/Library/Developer/GStreamer/iPhone.sdk -framework GStreamer -liconv -lresolv
LIBS += -F$$(HOME)/Library/Developer/GStreamer/iPhone.sdk -framework GStreamer
-framework AVFoundation -framework CoreMedia -framework CoreVideo -framework VideoToolbox
-liconv -lresolv
}
} else:WindowsBuild {
#- gstreamer installed by default under c:/gstreamer
...
...
@@ -78,6 +78,7 @@ LinuxBuild {
LIBS += -L$$GST_ROOT/lib/gstreamer-1.0 \
-lgstvideo-1.0 \
-lgstcoreelements \
-lgstplayback \
-lgstudp \
-lgstrtp \
-lgstrtsp \
...
...
src/VideoStreaming/iOS/gst_ios_init.h
View file @
b45b8530
#ifndef __GST_IOS_INIT_H__
#define __GST_IOS_INIT_H__
#pragma once
#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
);
void
gst_ios_pre_init
(
void
);
void
gst_ios_post_init
(
void
);
G_END_DECLS
#endif
src/VideoStreaming/iOS/gst_ios_init.m
View file @
b45b8530
This diff is collapsed.
Click to expand it.
src/main.cc
View file @
b45b8530
...
...
@@ -138,7 +138,7 @@ static const char kJniClassName[] {"org/mavlink/qgroundcontrol/QGCActivity"};
void
setNativeMethods
(
void
)
{
JNINativeMethod
javaMethods
[]
{
{
"nativeInit"
,
"(
Landroid/content/Context;
)V"
,
reinterpret_cast
<
void
*>
(
gst_android_init
)}
{
"nativeInit"
,
"()V"
,
reinterpret_cast
<
void
*>
(
gst_android_init
)}
};
QAndroidJniEnvironment
jniEnv
;
...
...
@@ -176,12 +176,8 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
if
(
vm
->
GetEnv
(
reinterpret_cast
<
void
**>
(
&
env
),
JNI_VERSION_1_6
)
!=
JNI_OK
)
{
return
-
1
;
}
setNativeMethods
();
QAndroidJniObject
resultL
=
QAndroidJniObject
::
callStaticObjectMethod
(
kJniClassName
,
"jniOnLoad"
,
"();"
);
setNativeMethods
();
#if defined(QGC_GST_STREAMING)
// Tell the androidmedia plugin about the Java VM
...
...
@@ -191,7 +187,9 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
#if !defined(NO_SERIAL_LINK)
QSerialPort
::
setNativeMethods
();
#endif
JoystickAndroid
::
setNativeMethods
();
#if defined(QGC_ENABLE_PAIRING)
PairingManager
::
setNativeMethods
();
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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