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