mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
smart-video-mixer: Handle segment updates
We were basically ignoring any segment update which could potentially lead to setting a wrong stream time leading to wrong alpha value being used.
This commit is contained in:
parent
6caf9b0a50
commit
d58d992674
1 changed files with 25 additions and 14 deletions
|
@ -155,6 +155,29 @@ destroy_pad (PadInfos * infos)
|
||||||
g_slice_free (PadInfos, infos);
|
g_slice_free (PadInfos, infos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
ges_smart_mixer_sinkpad_event_func (GstPad * pad, GstObject * parent,
|
||||||
|
GstEvent * event)
|
||||||
|
{
|
||||||
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
case GST_EVENT_SEGMENT:
|
||||||
|
{
|
||||||
|
const GstSegment *seg;
|
||||||
|
|
||||||
|
gst_event_parse_segment (event, &seg);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (pad);
|
||||||
|
((GESSmartMixerPad *) pad)->segment = *seg;
|
||||||
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gst_pad_event_default (pad, parent, event);
|
||||||
|
}
|
||||||
|
|
||||||
GstPad *
|
GstPad *
|
||||||
ges_smart_mixer_get_mixer_pad (GESSmartMixer * self, GstPad ** mixerpad)
|
ges_smart_mixer_get_mixer_pad (GESSmartMixer * self, GstPad ** mixerpad)
|
||||||
{
|
{
|
||||||
|
@ -198,20 +221,6 @@ parse_metadata (GstPad * mixer_pad, GstPadProbeInfo * info,
|
||||||
gdouble transalpha;
|
gdouble transalpha;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (ghost);
|
GST_OBJECT_LOCK (ghost);
|
||||||
if (ghost->segment.format == GST_FORMAT_UNDEFINED) {
|
|
||||||
const GstSegment *seg;
|
|
||||||
GstEvent *segev;
|
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (ghost);
|
|
||||||
segev = gst_pad_get_sticky_event (GST_PAD (ghost), GST_EVENT_SEGMENT, 0);
|
|
||||||
gst_event_parse_segment (segev, &seg);
|
|
||||||
gst_event_unref (segev);
|
|
||||||
GST_OBJECT_LOCK (ghost);
|
|
||||||
|
|
||||||
ghost->segment = *seg;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
stream_time = gst_segment_to_stream_time (&ghost->segment, GST_FORMAT_TIME,
|
stream_time = gst_segment_to_stream_time (&ghost->segment, GST_FORMAT_TIME,
|
||||||
GST_BUFFER_PTS (info->data));
|
GST_BUFFER_PTS (info->data));
|
||||||
GST_OBJECT_UNLOCK (ghost);
|
GST_OBJECT_UNLOCK (ghost);
|
||||||
|
@ -285,6 +294,8 @@ _request_new_pad (GstElement * element, GstPadTemplate * templ,
|
||||||
infos->probe_id =
|
infos->probe_id =
|
||||||
gst_pad_add_probe (infos->mixer_pad, GST_PAD_PROBE_TYPE_BUFFER,
|
gst_pad_add_probe (infos->mixer_pad, GST_PAD_PROBE_TYPE_BUFFER,
|
||||||
(GstPadProbeCallback) parse_metadata, ghost, NULL);
|
(GstPadProbeCallback) parse_metadata, ghost, NULL);
|
||||||
|
gst_pad_set_event_function (GST_PAD (ghost),
|
||||||
|
ges_smart_mixer_sinkpad_event_func);
|
||||||
|
|
||||||
LOCK (self);
|
LOCK (self);
|
||||||
g_hash_table_insert (self->pads_infos, ghost, infos);
|
g_hash_table_insert (self->pads_infos, ghost, infos);
|
||||||
|
|
Loading…
Reference in a new issue