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
6b1f65a6
Commit
6b1f65a6
authored
Apr 03, 2020
by
Andrew Voznytsa
Browse files
Better video receiver customization support
parent
98510ab0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/VideoReceiver/GstVideoReceiver.cc
View file @
6b1f65a6
...
...
@@ -161,12 +161,35 @@ GstVideoReceiver::start(const QString& uri, unsigned timeout)
break
;
}
g_signal_connect
(
_source
,
"pad-added"
,
G_CALLBACK
(
_onNewPad
),
this
);
gst_bin_add_many
(
GST_BIN
(
_pipeline
),
_source
,
_tee
,
decoderQueue
,
_decoderValve
,
recorderQueue
,
_recorderValve
,
nullptr
);
pipelineUp
=
true
;
GstPad
*
srcPad
=
nullptr
;
GstIterator
*
it
;
if
((
it
=
gst_element_iterate_src_pads
(
_source
))
!=
nullptr
)
{
GValue
vpad
=
G_VALUE_INIT
;
if
(
gst_iterator_next
(
it
,
&
vpad
)
==
GST_ITERATOR_OK
)
{
srcPad
=
GST_PAD
(
g_value_get_object
(
&
vpad
));
gst_object_ref
(
srcPad
);
g_value_reset
(
&
vpad
);
}
gst_iterator_free
(
it
);
it
=
nullptr
;
}
if
(
srcPad
!=
nullptr
)
{
_onNewSourcePad
(
srcPad
);
gst_object_unref
(
srcPad
);
srcPad
=
nullptr
;
}
else
{
g_signal_connect
(
_source
,
"pad-added"
,
G_CALLBACK
(
_onNewPad
),
this
);
}
if
(
!
gst_element_link_many
(
_tee
,
decoderQueue
,
_decoderValve
,
nullptr
))
{
qCCritical
(
VideoReceiverLog
)
<<
"Unable to link decoder queue"
;
break
;
...
...
@@ -1003,11 +1026,6 @@ GstVideoReceiver::_addDecoder(GstElement* src)
gst_caps_unref
(
caps
);
caps
=
nullptr
;
// FIXME: AV: check if srcpad exists - if it does then no need to wait for new pad
// int probeRes = 0;
// gst_element_foreach_src_pad(source, _padProbe, &probeRes);
g_signal_connect
(
_decoder
,
"pad-added"
,
G_CALLBACK
(
_onNewPad
),
this
);
gst_bin_add
(
GST_BIN
(
_pipeline
),
_decoder
);
gst_element_sync_state_with_parent
(
_decoder
);
...
...
@@ -1019,6 +1037,31 @@ GstVideoReceiver::_addDecoder(GstElement* src)
return
false
;
}
GstPad
*
srcPad
=
nullptr
;
GstIterator
*
it
;
if
((
it
=
gst_element_iterate_src_pads
(
_decoder
))
!=
nullptr
)
{
GValue
vpad
=
G_VALUE_INIT
;
if
(
gst_iterator_next
(
it
,
&
vpad
)
==
GST_ITERATOR_OK
)
{
srcPad
=
GST_PAD
(
g_value_get_object
(
&
vpad
));
gst_object_ref
(
srcPad
);
g_value_reset
(
&
vpad
);
}
gst_iterator_free
(
it
);
it
=
nullptr
;
}
if
(
srcPad
!=
nullptr
)
{
_onNewDecoderPad
(
srcPad
);
gst_object_unref
(
srcPad
);
srcPad
=
nullptr
;
}
else
{
g_signal_connect
(
_decoder
,
"pad-added"
,
G_CALLBACK
(
_onNewPad
),
this
);
}
return
true
;
}
...
...
src/VideoReceiver/GstVideoReceiver.h
View file @
6b1f65a6
...
...
@@ -120,7 +120,6 @@ protected:
bool
_needDispatch
(
void
);
void
_dispatchSignal
(
std
::
function
<
void
()
>
emitter
);
private:
static
gboolean
_onBusMessage
(
GstBus
*
bus
,
GstMessage
*
message
,
gpointer
user_data
);
static
void
_onNewPad
(
GstElement
*
element
,
GstPad
*
pad
,
gpointer
data
);
static
void
_wrapWithGhostPad
(
GstElement
*
element
,
GstPad
*
pad
,
gpointer
data
);
...
...
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