ges: Fix issues avoiding to use operator when unavailable on mixer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3738>
This commit is contained in:
Thibault Saunier 2023-01-12 11:07:45 -03:00 committed by GStreamer Marge Bot
parent 086c8da446
commit 3065608730
5 changed files with 20 additions and 7 deletions

View file

@ -500,7 +500,7 @@ G_GNUC_INTERNAL GstElement * ges_track_get_composition (GESTrack *track);
/********************************************* /*********************************************
* GESTrackElement subclasses contructores * * GESTrackElement subclasses constructors *
********************************************/ ********************************************/
G_GNUC_INTERNAL GESAudioTestSource * ges_audio_test_source_new (void); G_GNUC_INTERNAL GESAudioTestSource * ges_audio_test_source_new (void);
G_GNUC_INTERNAL GESAudioUriSource * ges_audio_uri_source_new (gchar *uri); G_GNUC_INTERNAL GESAudioUriSource * ges_audio_uri_source_new (gchar *uri);

View file

@ -240,8 +240,10 @@ set_pad_properties_from_positioner_meta (GstPad * mixer_pad, GstSample * sample,
} }
g_object_set (mixer_pad, "xpos", meta->posx, "ypos", g_object_set (mixer_pad, "xpos", meta->posx, "ypos",
meta->posy, "width", meta->width, "height", meta->height, meta->posy, "width", meta->width, "height", meta->height, NULL);
"operator", meta->operator, NULL);
if (self->ABI.abi.has_operator)
g_object_set (mixer_pad, "operator", meta->operator, NULL);
} }
/**************************************************** /****************************************************
@ -426,6 +428,8 @@ ges_smart_mixer_constructed (GObject * obj)
self->mixer = self->mixer =
gst_element_factory_create (ges_get_compositor_factory (), cname); gst_element_factory_create (ges_get_compositor_factory (), cname);
self->ABI.abi.has_operator =
gst_compositor_operator_get_type_and_default_value (NULL) != G_TYPE_NONE;
g_free (cname); g_free (cname);
if (GST_IS_BIN (self->mixer)) { if (GST_IS_BIN (self->mixer)) {

View file

@ -56,7 +56,14 @@ struct _GESSmartMixer
GstCaps *caps; GstCaps *caps;
gboolean is_transition; gboolean is_transition;
gpointer _ges_reserved[GES_PADDING]; union {
gpointer _ges_reserved[GES_PADDING];
struct {
gboolean has_operator;
} abi;
} ABI;
}; };
G_GNUC_INTERNAL G_GNUC_INTERNAL

View file

@ -81,7 +81,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
G_DEFINE_TYPE (GstFramePositioner, gst_frame_positioner, G_DEFINE_TYPE (GstFramePositioner, gst_frame_positioner,
GST_TYPE_BASE_TRANSFORM); GST_TYPE_BASE_TRANSFORM);
static GType GType
gst_compositor_operator_get_type_and_default_value (int *default_operator_value) gst_compositor_operator_get_type_and_default_value (int *default_operator_value)
{ {
static gsize _init = 0; static gsize _init = 0;
@ -112,7 +112,8 @@ gst_compositor_operator_get_type_and_default_value (int *default_operator_value)
g_once_init_leave (&_init, 1); g_once_init_leave (&_init, 1);
} }
*default_operator_value = operator_value; if (default_operator_value)
*default_operator_value = operator_value;
return operator_gtype; return operator_gtype;
} }
@ -549,7 +550,7 @@ gst_frame_positioner_class_init (GstFramePositionerClass * klass)
* *
* The blending operator for the source. * The blending operator for the source.
*/ */
if (operator_gtype) { if (operator_gtype != G_TYPE_NONE) {
properties[PROP_OPERATOR] = properties[PROP_OPERATOR] =
g_param_spec_enum ("operator", "Operator", g_param_spec_enum ("operator", "Operator",
"Blending operator to use for blending this pad over the previous ones", "Blending operator to use for blending this pad over the previous ones",

View file

@ -85,6 +85,7 @@ struct _GstFramePositionerMeta {
gint operator; gint operator;
}; };
G_GNUC_INTERNAL GType gst_compositor_operator_get_type_and_default_value (int *default_operator_value);
G_GNUC_INTERNAL void ges_frame_positioner_set_source_and_filter (GstFramePositioner *pos, G_GNUC_INTERNAL void ges_frame_positioner_set_source_and_filter (GstFramePositioner *pos,
GESTrackElement *trksrc, GESTrackElement *trksrc,
GstElement *capsfilter); GstElement *capsfilter);