mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
transition: Better document the way alpha is computed for transitions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/204>
This commit is contained in:
parent
046e609a89
commit
6bf769c821
4 changed files with 16 additions and 16 deletions
|
@ -208,12 +208,12 @@ ges_smart_mixer_get_mixer_pad (GESSmartMixer * self, GstPad ** mixerpad)
|
||||||
return sinkpad;
|
return sinkpad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These metadata will get set by the upstream framepositioner element,
|
|
||||||
added in the video sources' bin */
|
|
||||||
static void
|
static void
|
||||||
parse_metadata (GstPad * mixer_pad, GstBuffer * buf, GESSmartMixerPad * ghost)
|
set_pad_properties_from_positioner_meta (GstPad * mixer_pad, GstSample * sample,
|
||||||
|
GESSmartMixerPad * ghost)
|
||||||
{
|
{
|
||||||
GstFramePositionerMeta *meta;
|
GstFramePositionerMeta *meta;
|
||||||
|
GstBuffer *buf = gst_sample_get_buffer (sample);
|
||||||
GESSmartMixer *self = GES_SMART_MIXER (GST_OBJECT_PARENT (ghost));
|
GESSmartMixer *self = GES_SMART_MIXER (GST_OBJECT_PARENT (ghost));
|
||||||
|
|
||||||
meta =
|
meta =
|
||||||
|
@ -225,18 +225,18 @@ parse_metadata (GstPad * mixer_pad, GstBuffer * buf, GESSmartMixerPad * ghost)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self->disable_zorder_alpha) {
|
if (!self->is_transition) {
|
||||||
g_object_set (mixer_pad, "alpha", meta->alpha,
|
g_object_set (mixer_pad, "alpha", meta->alpha,
|
||||||
"zorder", meta->zorder, NULL);
|
"zorder", meta->zorder, NULL);
|
||||||
} else {
|
} else {
|
||||||
gint64 stream_time;
|
gint64 stream_time;
|
||||||
gdouble transalpha;
|
gdouble transalpha;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (ghost);
|
stream_time = gst_segment_to_stream_time (gst_sample_get_segment (sample),
|
||||||
stream_time = gst_segment_to_stream_time (&ghost->segment, GST_FORMAT_TIME,
|
GST_FORMAT_TIME, GST_BUFFER_PTS (buf));
|
||||||
GST_BUFFER_PTS (buf));
|
|
||||||
GST_OBJECT_UNLOCK (ghost);
|
|
||||||
|
|
||||||
|
/* When used in a transition we aggregate the alpha value value if the
|
||||||
|
* transition pad and the alpha value from upstream frame positioner */
|
||||||
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
||||||
gst_object_sync_values (GST_OBJECT (ghost), stream_time);
|
gst_object_sync_values (GST_OBJECT (ghost), stream_time);
|
||||||
|
|
||||||
|
@ -377,12 +377,12 @@ compositor_sync_properties_with_meta (GstElement * compositor,
|
||||||
sample = gst_aggregator_peek_next_sample (GST_AGGREGATOR (compositor),
|
sample = gst_aggregator_peek_next_sample (GST_AGGREGATOR (compositor),
|
||||||
GST_AGGREGATOR_PAD (sinkpad));
|
GST_AGGREGATOR_PAD (sinkpad));
|
||||||
|
|
||||||
if (!sample) {
|
if (sample) {
|
||||||
GST_INFO_OBJECT (sinkpad, "No sample set!");
|
set_pad_properties_from_positioner_meta (sinkpad,
|
||||||
} else {
|
sample, GES_SMART_MIXER_PAD (info->ghostpad));
|
||||||
parse_metadata (sinkpad, gst_sample_get_buffer (sample),
|
|
||||||
GES_SMART_MIXER_PAD (info->ghostpad));
|
|
||||||
gst_sample_unref (sample);
|
gst_sample_unref (sample);
|
||||||
|
} else {
|
||||||
|
GST_INFO_OBJECT (sinkpad, "No sample set!");
|
||||||
}
|
}
|
||||||
pad_infos_unref (info);
|
pad_infos_unref (info);
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct _GESSmartMixer
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
|
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean disable_zorder_alpha;
|
gboolean is_transition;
|
||||||
|
|
||||||
gpointer _ges_reserved[GES_PADDING];
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
};
|
};
|
||||||
|
|
|
@ -132,7 +132,7 @@ ges_pspec_hash (gconstpointer key_spec)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
find_compositor (GstPluginFeatureFilter * feature, gpointer udata)
|
find_compositor (GstPluginFeature * feature, gpointer udata)
|
||||||
{
|
{
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
const gchar *klass;
|
const gchar *klass;
|
||||||
|
|
|
@ -354,7 +354,7 @@ ges_video_transition_create_element (GESTrackElement * object)
|
||||||
oconv, NULL);
|
oconv, NULL);
|
||||||
|
|
||||||
mixer = ges_smart_mixer_new (NULL);
|
mixer = ges_smart_mixer_new (NULL);
|
||||||
GES_SMART_MIXER (mixer)->disable_zorder_alpha = TRUE;
|
GES_SMART_MIXER (mixer)->is_transition = TRUE;
|
||||||
g_object_set (GES_SMART_MIXER (mixer)->mixer, "background", 3, NULL); /* transparent */
|
g_object_set (GES_SMART_MIXER (mixer)->mixer, "background", 3, NULL); /* transparent */
|
||||||
gst_bin_add (GST_BIN (topbin), mixer);
|
gst_bin_add (GST_BIN (topbin), mixer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue