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
22465514
Commit
22465514
authored
Feb 17, 2020
by
Andrew Voznytsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Repackage video sink into GstQgcVideoSinkBin
parent
a6d15868
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
420 additions
and
113 deletions
+420
-113
VideoManager.cc
src/FlightDisplay/VideoManager.cc
+5
-113
VideoStreaming.cc
src/VideoStreaming/VideoStreaming.cc
+3
-0
VideoStreaming.pri
src/VideoStreaming/VideoStreaming.pri
+4
-0
gstqgc.c
src/VideoStreaming/gstqgc.c
+40
-0
gstqgcvideosinkbin.c
src/VideoStreaming/gstqgcvideosinkbin.c
+368
-0
No files found.
src/FlightDisplay/VideoManager.cc
View file @
22465514
...
...
@@ -282,123 +282,15 @@ 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
(
gpointer
widget
)
{
GstElement
*
glupload
=
nullptr
;
GstElement
*
glcolorconvert
=
nullptr
;
GstElement
*
qmlglsink
=
nullptr
;
GstElement
*
bin
=
nullptr
;
GstElement
*
sink
=
nullptr
;
do
{
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"
,
"glcolorconvert"
))
==
nullptr
)
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_element_factory_make('glcolorconvert')"
;
break
;
}
if
((
qmlglsink
=
gst_element_factory_make
(
"qmlglsink"
,
"qmlglsink"
))
==
nullptr
)
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_element_factory_make('qmlglsink')"
;
break
;
}
g_object_set
(
qmlglsink
,
"widget"
,
widget
,
NULL
);
if
((
bin
=
gst_bin_new
(
"videosink"
))
==
nullptr
)
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_bin_new('videosink')"
;
break
;
}
GstPad
*
pad
;
if
((
pad
=
gst_element_get_static_pad
(
glupload
,
"sink"
))
==
nullptr
)
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_element_get_static_pad(glupload, 'sink')"
;
break
;
}
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
;
if
(
!
ret
)
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_element_link_many()"
;
break
;
}
GstPad
*
ghostpad
=
gst_ghost_pad_new
(
"sink"
,
pad
);
GstElement
*
sink
;
gst_pad_set_query_function
(
ghostpad
,
_videoSinkQuery
);
gst_element_add_pad
(
bin
,
ghostpad
);
gst_object_unref
(
pad
);
pad
=
nullptr
;
sink
=
bin
;
bin
=
nullptr
;
}
while
(
0
);
if
(
bin
!=
nullptr
)
{
gst_object_unref
(
bin
);
bin
=
nullptr
;
}
if
(
qmlglsink
!=
nullptr
)
{
gst_object_unref
(
qmlglsink
);
qmlglsink
=
nullptr
;
}
if
(
glcolorconvert
!=
nullptr
)
{
gst_object_unref
(
glcolorconvert
);
glcolorconvert
=
nullptr
;
}
if
(
glupload
!=
nullptr
)
{
gst_object_unref
(
glupload
);
glupload
=
nullptr
;
if
((
sink
=
gst_element_factory_make
(
"qgcvideosinkbin"
,
nullptr
))
!=
nullptr
)
{
g_object_set
(
sink
,
"widget"
,
widget
,
NULL
);
}
else
{
qCritical
()
<<
"VideoManager::_makeVideoSink() failed. Error with gst_element_factory_make('qgcvideosinkbin')"
;
}
return
sink
;
...
...
src/VideoStreaming/VideoStreaming.cc
View file @
22465514
...
...
@@ -67,6 +67,7 @@ static void gst_android_log(GstDebugCategory * category,
#endif
#endif
GST_PLUGIN_STATIC_DECLARE
(
qmlgl
);
GST_PLUGIN_STATIC_DECLARE
(
qgc
);
G_END_DECLS
#endif
...
...
@@ -168,6 +169,8 @@ void initializeVideoStreaming(int &argc, char* argv[], char* logpath, char* debu
}
else
{
qCritical
()
<<
"unable to find qmlglsink - you need to build it yourself and add to GST_PLUGIN_PATH"
;
}
GST_PLUGIN_STATIC_REGISTER
(
qgc
);
#else
qmlRegisterType
<
GLVideoItemStub
>
(
"org.freedesktop.gstreamer.GLVideoItem"
,
1
,
0
,
"GstGLVideoItem"
);
Q_UNUSED
(
argc
)
...
...
src/VideoStreaming/VideoStreaming.pri
View file @
22465514
...
...
@@ -127,6 +127,10 @@ VideoEnabled {
$$PWD/iOS
}
SOURCES += \
$$PWD/gstqgcvideosinkbin.c \
$$PWD/gstqgc.c
include($$PWD/../../qmlglsink.pri)
} else {
LinuxBuild|MacBuild|iOSBuild|WindowsBuild|AndroidBuild {
...
...
src/VideoStreaming/gstqgc.c
0 → 100644
View file @
22465514
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
/**
* @file
* @brief GStreamer plugin for QGC's Video Receiver
* @author Andrew Voznyts <andrew.voznytsa@gmail.com>
* @author Tomaz Canabrava <tcanabrava@kde.org>
*/
#include <gst/gst.h>
gboolean
gst_qgc_video_sink_bin_plugin_init
(
GstPlugin
*
plugin
);
static
gboolean
plugin_init
(
GstPlugin
*
plugin
)
{
if
(
!
gst_qgc_video_sink_bin_plugin_init
(
plugin
))
{
return
FALSE
;
}
return
TRUE
;
}
#define PACKAGE "QGC Video Receiver"
#define PACKAGE_VERSION "current"
#define GST_LICENSE "LGPL"
#define GST_PACKAGE_NAME "GStreamer plugin for QGC's Video Receiver"
#define GST_PACKAGE_ORIGIN "http://qgroundcontrol.com/"
GST_PLUGIN_DEFINE
(
GST_VERSION_MAJOR
,
GST_VERSION_MINOR
,
qgc
,
"QGC Video Receiver plugin"
,
plugin_init
,
PACKAGE_VERSION
,
GST_LICENSE
,
GST_PACKAGE_NAME
,
GST_PACKAGE_ORIGIN
)
src/VideoStreaming/gstqgcvideosinkbin.c
0 → 100644
View file @
22465514
This diff is collapsed.
Click to expand it.
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