mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
ges/gstframepositioner: don't create one compositor per frame meta
Instead, cache the looked up operator property Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2639>
This commit is contained in:
parent
d010e1c3f4
commit
0a742a2eca
1 changed files with 24 additions and 17 deletions
|
@ -84,6 +84,11 @@ G_DEFINE_TYPE (GstFramePositioner, gst_frame_positioner,
|
|||
static GType
|
||||
gst_compositor_operator_get_type_and_default_value (int *default_operator_value)
|
||||
{
|
||||
static gsize _init = 0;
|
||||
static int operator_value = 0;
|
||||
static GType operator_gtype = G_TYPE_NONE;
|
||||
|
||||
if (g_once_init_enter (&_init)) {
|
||||
GstElement *compositor =
|
||||
gst_element_factory_create (ges_get_compositor_factory (), NULL);
|
||||
|
||||
|
@ -93,21 +98,23 @@ gst_compositor_operator_get_type_and_default_value (int *default_operator_value)
|
|||
GParamSpec *pspec =
|
||||
g_object_class_find_property (G_OBJECT_GET_CLASS (compositorPad),
|
||||
"operator");
|
||||
GType ret = 0;
|
||||
|
||||
if (pspec) {
|
||||
*default_operator_value =
|
||||
operator_value =
|
||||
g_value_get_enum (g_param_spec_get_default_value (pspec));
|
||||
g_return_val_if_fail (pspec, G_TYPE_NONE);
|
||||
|
||||
ret = pspec->value_type;
|
||||
operator_gtype = pspec->value_type;
|
||||
}
|
||||
|
||||
gst_element_release_request_pad (compositor, compositorPad);
|
||||
gst_object_unref (compositorPad);
|
||||
gst_object_unref (compositor);
|
||||
|
||||
return ret;
|
||||
g_once_init_leave (&_init, 1);
|
||||
}
|
||||
|
||||
*default_operator_value = operator_value;
|
||||
|
||||
return operator_gtype;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue