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
c70a6fa4
Commit
c70a6fa4
authored
Jun 06, 2018
by
Gus Grubba
Browse files
Expose VideoReceiver allowing plugins to override it.
parent
3df9b40f
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/FlightDisplay/VideoManager.cc
View file @
c70a6fa4
...
@@ -78,7 +78,7 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
...
@@ -78,7 +78,7 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
emit
isGStreamerChanged
();
emit
isGStreamerChanged
();
qCDebug
(
VideoManagerLog
)
<<
"New Video Source:"
<<
videoSource
;
qCDebug
(
VideoManagerLog
)
<<
"New Video Source:"
<<
videoSource
;
_videoReceiver
=
new
VideoReceiver
(
this
);
_videoReceiver
=
toolbox
->
corePlugin
()
->
create
VideoReceiver
(
this
);
_updateSettings
();
_updateSettings
();
if
(
isGStreamer
())
{
if
(
isGStreamer
())
{
_videoReceiver
->
start
();
_videoReceiver
->
start
();
...
...
src/VideoStreaming/VideoReceiver.cc
View file @
c70a6fa4
...
@@ -63,6 +63,7 @@ VideoReceiver::VideoReceiver(QObject* parent)
...
@@ -63,6 +63,7 @@ VideoReceiver::VideoReceiver(QObject* parent)
,
_videoSink
(
NULL
)
,
_videoSink
(
NULL
)
,
_socket
(
NULL
)
,
_socket
(
NULL
)
,
_serverPresent
(
false
)
,
_serverPresent
(
false
)
,
_rtspTestInterval_ms
(
5000
)
#endif
#endif
,
_videoSurface
(
NULL
)
,
_videoSurface
(
NULL
)
,
_videoRunning
(
false
)
,
_videoRunning
(
false
)
...
@@ -164,9 +165,9 @@ VideoReceiver::_socketError(QAbstractSocket::SocketError socketError)
...
@@ -164,9 +165,9 @@ VideoReceiver::_socketError(QAbstractSocket::SocketError socketError)
Q_UNUSED
(
socketError
);
Q_UNUSED
(
socketError
);
_socket
->
deleteLater
();
_socket
->
deleteLater
();
_socket
=
NULL
;
_socket
=
NULL
;
//-- Try again in
5 seconds
//-- Try again in
a while
if
(
_videoSettings
->
streamEnabled
()
->
rawValue
().
toBool
())
{
if
(
_videoSettings
->
streamEnabled
()
->
rawValue
().
toBool
())
{
_timer
.
start
(
5000
);
_timer
.
start
(
_rtspTestInterval_ms
);
}
}
}
}
#endif
#endif
...
@@ -194,7 +195,7 @@ VideoReceiver::_timeout()
...
@@ -194,7 +195,7 @@ VideoReceiver::_timeout()
connect
(
_socket
,
static_cast
<
void
(
QTcpSocket
::*
)(
QAbstractSocket
::
SocketError
)
>
(
&
QTcpSocket
::
error
),
this
,
&
VideoReceiver
::
_socketError
);
connect
(
_socket
,
static_cast
<
void
(
QTcpSocket
::*
)(
QAbstractSocket
::
SocketError
)
>
(
&
QTcpSocket
::
error
),
this
,
&
VideoReceiver
::
_socketError
);
connect
(
_socket
,
&
QTcpSocket
::
connected
,
this
,
&
VideoReceiver
::
_connected
);
connect
(
_socket
,
&
QTcpSocket
::
connected
,
this
,
&
VideoReceiver
::
_connected
);
_socket
->
connectToHost
(
url
.
host
(),
url
.
port
());
_socket
->
connectToHost
(
url
.
host
(),
url
.
port
());
_timer
.
start
(
5000
);
_timer
.
start
(
_rtspTestInterval_ms
);
}
}
}
}
#endif
#endif
...
...
src/VideoStreaming/VideoReceiver.h
View file @
c70a6fa4
...
@@ -49,54 +49,54 @@ public:
...
@@ -49,54 +49,54 @@ public:
~
VideoReceiver
();
~
VideoReceiver
();
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
bool
running
()
{
return
_running
;
}
virtual
bool
running
()
{
return
_running
;
}
bool
recording
()
{
return
_recording
;
}
virtual
bool
recording
()
{
return
_recording
;
}
bool
streaming
()
{
return
_streaming
;
}
virtual
bool
streaming
()
{
return
_streaming
;
}
bool
starting
()
{
return
_starting
;
}
virtual
bool
starting
()
{
return
_starting
;
}
bool
stopping
()
{
return
_stopping
;
}
virtual
bool
stopping
()
{
return
_stopping
;
}
#endif
#endif
VideoSurface
*
videoSurface
()
{
return
_videoSurface
;
}
virtual
VideoSurface
*
videoSurface
()
{
return
_videoSurface
;
}
bool
videoRunning
()
{
return
_videoRunning
;
}
virtual
bool
videoRunning
()
{
return
_videoRunning
;
}
QString
imageFile
()
{
return
_imageFile
;
}
virtual
QString
imageFile
()
{
return
_imageFile
;
}
QString
videoFile
()
{
return
_videoFile
;
}
virtual
QString
videoFile
()
{
return
_videoFile
;
}
bool
showFullScreen
()
{
return
_showFullScreen
;
}
virtual
bool
showFullScreen
()
{
return
_showFullScreen
;
}
void
grabImage
(
QString
imageFile
);
virtual
void
grabImage
(
QString
imageFile
);
void
setShowFullScreen
(
bool
show
)
{
_showFullScreen
=
show
;
emit
showFullScreenChanged
();
}
virtual
void
setShowFullScreen
(
bool
show
)
{
_showFullScreen
=
show
;
emit
showFullScreenChanged
();
}
signals:
signals:
void
videoRunningChanged
();
void
videoRunningChanged
();
void
imageFileChanged
();
void
imageFileChanged
();
void
videoFileChanged
();
void
videoFileChanged
();
void
showFullScreenChanged
();
void
showFullScreenChanged
();
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
void
recordingChanged
();
void
recordingChanged
();
void
msgErrorReceived
();
void
msgErrorReceived
();
void
msgEOSReceived
();
void
msgEOSReceived
();
void
msgStateChangedReceived
();
void
msgStateChangedReceived
();
#endif
#endif
public
slots
:
public
slots
:
void
start
();
virtual
void
start
();
void
stop
();
virtual
void
stop
();
void
setUri
(
const
QString
&
uri
);
virtual
void
setUri
(
const
QString
&
uri
);
void
stopRecording
();
virtual
void
stopRecording
();
void
startRecording
(
const
QString
&
videoFile
=
QString
());
virtual
void
startRecording
(
const
QString
&
videoFile
=
QString
());
pr
ivate
slots
:
pr
otected
slots
:
void
_updateTimer
();
virtual
void
_updateTimer
();
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
void
_timeout
();
virtual
void
_timeout
();
void
_connected
();
virtual
void
_connected
();
void
_socketError
(
QAbstractSocket
::
SocketError
socketError
);
virtual
void
_socketError
(
QAbstractSocket
::
SocketError
socketError
);
void
_handleError
();
virtual
void
_handleError
();
void
_handleEOS
();
virtual
void
_handleEOS
();
void
_handleStateChanged
();
virtual
void
_handleStateChanged
();
#endif
#endif
pr
ivate
:
pr
otected
:
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
typedef
struct
typedef
struct
...
@@ -121,11 +121,12 @@ private:
...
@@ -121,11 +121,12 @@ private:
static
gboolean
_onBusMessage
(
GstBus
*
bus
,
GstMessage
*
message
,
gpointer
user_data
);
static
gboolean
_onBusMessage
(
GstBus
*
bus
,
GstMessage
*
message
,
gpointer
user_data
);
static
GstPadProbeReturn
_unlinkCallBack
(
GstPad
*
pad
,
GstPadProbeInfo
*
info
,
gpointer
user_data
);
static
GstPadProbeReturn
_unlinkCallBack
(
GstPad
*
pad
,
GstPadProbeInfo
*
info
,
gpointer
user_data
);
static
GstPadProbeReturn
_keyframeWatch
(
GstPad
*
pad
,
GstPadProbeInfo
*
info
,
gpointer
user_data
);
static
GstPadProbeReturn
_keyframeWatch
(
GstPad
*
pad
,
GstPadProbeInfo
*
info
,
gpointer
user_data
);
void
_detachRecordingBranch
(
GstPadProbeInfo
*
info
);
void
_shutdownRecordingBranch
();
virtual
void
_detachRecordingBranch
(
GstPadProbeInfo
*
info
);
void
_shutdownPipeline
();
virtual
void
_shutdownRecordingBranch
();
void
_cleanupOldVideos
();
virtual
void
_shutdownPipeline
();
void
_setVideoSink
(
GstElement
*
sink
);
virtual
void
_cleanupOldVideos
();
virtual
void
_setVideoSink
(
GstElement
*
sink
);
GstElement
*
_pipeline
;
GstElement
*
_pipeline
;
GstElement
*
_pipelineStopRec
;
GstElement
*
_pipelineStopRec
;
...
@@ -136,6 +137,7 @@ private:
...
@@ -136,6 +137,7 @@ private:
QTimer
_timer
;
QTimer
_timer
;
QTcpSocket
*
_socket
;
QTcpSocket
*
_socket
;
bool
_serverPresent
;
bool
_serverPresent
;
int
_rtspTestInterval_ms
;
#endif
#endif
...
...
src/api/QGCCorePlugin.cc
View file @
c70a6fa4
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include
"SettingsManager.h"
#include
"SettingsManager.h"
#include
"AppMessages.h"
#include
"AppMessages.h"
#include
"QmlObjectListModel.h"
#include
"QmlObjectListModel.h"
#include
"VideoReceiver.h"
#include
<QtQml>
#include
<QtQml>
#include
<QQmlEngine>
#include
<QQmlEngine>
...
@@ -286,3 +287,8 @@ QmlObjectListModel* QGCCorePlugin::customMapItems(void)
...
@@ -286,3 +287,8 @@ QmlObjectListModel* QGCCorePlugin::customMapItems(void)
{
{
return
&
_p
->
_emptyCustomMapItems
;
return
&
_p
->
_emptyCustomMapItems
;
}
}
VideoReceiver
*
QGCCorePlugin
::
createVideoReceiver
(
QObject
*
parent
)
{
return
new
VideoReceiver
(
parent
);
}
src/api/QGCCorePlugin.h
View file @
c70a6fa4
...
@@ -31,6 +31,7 @@ class QQmlApplicationEngine;
...
@@ -31,6 +31,7 @@ class QQmlApplicationEngine;
class
Vehicle
;
class
Vehicle
;
class
LinkInterface
;
class
LinkInterface
;
class
QmlObjectListModel
;
class
QmlObjectListModel
;
class
VideoReceiver
;
class
QGCCorePlugin
:
public
QGCTool
class
QGCCorePlugin
:
public
QGCTool
{
{
...
@@ -98,6 +99,9 @@ public:
...
@@ -98,6 +99,9 @@ public:
/// Allows the plugin to override the creation of the root (native) window.
/// Allows the plugin to override the creation of the root (native) window.
virtual
QQmlApplicationEngine
*
createRootWindow
(
QObject
*
parent
);
virtual
QQmlApplicationEngine
*
createRootWindow
(
QObject
*
parent
);
/// Allows the plugin to override the creation of VideoReceiver.
virtual
VideoReceiver
*
createVideoReceiver
(
QObject
*
parent
);
/// Allows the plugin to see all mavlink traffic to a vehicle
/// Allows the plugin to see all mavlink traffic to a vehicle
/// @return true: Allow vehicle to continue processing, false: Vehicle should not process message
/// @return true: Allow vehicle to continue processing, false: Vehicle should not process message
virtual
bool
mavlinkMessage
(
Vehicle
*
vehicle
,
LinkInterface
*
link
,
mavlink_message_t
message
);
virtual
bool
mavlinkMessage
(
Vehicle
*
vehicle
,
LinkInterface
*
link
,
mavlink_message_t
message
);
...
...
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