mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
gl: move control binding proxy implementation from glvideomixer
Other elements may need to use it's functionality
This commit is contained in:
parent
afdc81fe4d
commit
adec074d7e
1 changed files with 32 additions and 168 deletions
|
@ -137,151 +137,6 @@ gst_gl_video_mixer_blend_function_get_type (void)
|
||||||
return mixer_blend_function_type;
|
return mixer_blend_function_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _GstGLMixerControlBindingProxy GstGLMixerControlBindingProxy;
|
|
||||||
typedef struct _GstGLMixerControlBindingProxyClass
|
|
||||||
GstGLMixerControlBindingProxyClass;
|
|
||||||
|
|
||||||
struct _GstGLMixerControlBindingProxy
|
|
||||||
{
|
|
||||||
GstControlBinding parent;
|
|
||||||
|
|
||||||
GstObject *ref_object;
|
|
||||||
const gchar *property_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstGLMixerControlBindingProxyClass
|
|
||||||
{
|
|
||||||
GstControlBindingClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gst_gl_mixer_control_binding_proxy_get_type (void);
|
|
||||||
#define GST_TYPE_GL_MIXER_CONTROL_BINDING \
|
|
||||||
(gst_gl_mixer_control_binding_proxy_get_type())
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstGLMixerControlBindingProxy,
|
|
||||||
gst_gl_mixer_control_binding_proxy, GST_TYPE_CONTROL_BINDING);
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_gl_mixer_control_binding_proxy_init (GstGLMixerControlBindingProxy * self)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_gl_mixer_control_binding_proxy_sync_values (GstControlBinding * binding,
|
|
||||||
GstObject * object, GstClockTime timestamp, GstClockTime last_sync)
|
|
||||||
{
|
|
||||||
GstGLMixerControlBindingProxy *self = (GstGLMixerControlBindingProxy *)
|
|
||||||
binding;
|
|
||||||
GstControlBinding *ref_binding;
|
|
||||||
gboolean ret = TRUE;
|
|
||||||
|
|
||||||
ref_binding = gst_object_get_control_binding (self->ref_object,
|
|
||||||
self->property_name);
|
|
||||||
|
|
||||||
if (ref_binding) {
|
|
||||||
ret = gst_control_binding_sync_values (ref_binding, self->ref_object,
|
|
||||||
timestamp, last_sync);
|
|
||||||
gst_object_unref (ref_binding);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GValue *
|
|
||||||
gst_gl_mixer_control_binding_proxy_get_value (GstControlBinding * binding,
|
|
||||||
GstClockTime timestamp)
|
|
||||||
{
|
|
||||||
GstGLMixerControlBindingProxy *self = (GstGLMixerControlBindingProxy *)
|
|
||||||
binding;
|
|
||||||
GstControlBinding *ref_binding;
|
|
||||||
GValue *ret = NULL;
|
|
||||||
|
|
||||||
ref_binding = gst_object_get_control_binding (self->ref_object,
|
|
||||||
self->property_name);
|
|
||||||
|
|
||||||
if (ref_binding) {
|
|
||||||
ret = gst_control_binding_get_value (ref_binding, timestamp);
|
|
||||||
gst_object_unref (ref_binding);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_gl_mixer_control_binding_proxy_get_value_array (GstControlBinding * binding,
|
|
||||||
GstClockTime timestamp, GstClockTime interval, guint n_values,
|
|
||||||
gpointer values)
|
|
||||||
{
|
|
||||||
GstGLMixerControlBindingProxy *self = (GstGLMixerControlBindingProxy *)
|
|
||||||
binding;
|
|
||||||
GstControlBinding *ref_binding;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
ref_binding = gst_object_get_control_binding (self->ref_object,
|
|
||||||
self->property_name);
|
|
||||||
|
|
||||||
if (ref_binding) {
|
|
||||||
ret = gst_control_binding_get_value_array (ref_binding, timestamp,
|
|
||||||
interval, n_values, values);
|
|
||||||
gst_object_unref (ref_binding);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_gl_mixer_control_binding_proxy_get_g_value_array (GstControlBinding *
|
|
||||||
binding, GstClockTime timestamp, GstClockTime interval, guint n_values,
|
|
||||||
GValue * values)
|
|
||||||
{
|
|
||||||
GstGLMixerControlBindingProxy *self = (GstGLMixerControlBindingProxy *)
|
|
||||||
binding;
|
|
||||||
GstControlBinding *ref_binding;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
ref_binding = gst_object_get_control_binding (self->ref_object,
|
|
||||||
self->property_name);
|
|
||||||
|
|
||||||
if (ref_binding) {
|
|
||||||
ret = gst_control_binding_get_g_value_array (ref_binding, timestamp,
|
|
||||||
interval, n_values, values);
|
|
||||||
gst_object_unref (ref_binding);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_gl_mixer_control_binding_proxy_class_init
|
|
||||||
(GstGLMixerControlBindingProxyClass * klass)
|
|
||||||
{
|
|
||||||
GstControlBindingClass *cb_class = GST_CONTROL_BINDING_CLASS (klass);
|
|
||||||
|
|
||||||
cb_class->sync_values = gst_gl_mixer_control_binding_proxy_sync_values;
|
|
||||||
cb_class->get_value = gst_gl_mixer_control_binding_proxy_get_value;
|
|
||||||
cb_class->get_value_array =
|
|
||||||
gst_gl_mixer_control_binding_proxy_get_value_array;
|
|
||||||
cb_class->get_g_value_array =
|
|
||||||
gst_gl_mixer_control_binding_proxy_get_g_value_array;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstControlBinding *
|
|
||||||
gst_gl_mixer_control_binding_proxy_new (GstObject * object,
|
|
||||||
const gchar * property_name, GstObject * ref_object,
|
|
||||||
const gchar * ref_property_name)
|
|
||||||
{
|
|
||||||
GstGLMixerControlBindingProxy *self =
|
|
||||||
g_object_new (GST_TYPE_GL_MIXER_CONTROL_BINDING, "object", object,
|
|
||||||
"name", property_name, NULL);
|
|
||||||
|
|
||||||
self->ref_object = ref_object;
|
|
||||||
self->property_name = ref_property_name;
|
|
||||||
|
|
||||||
return (GstControlBinding *) self;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_PAD_XPOS 0
|
#define DEFAULT_PAD_XPOS 0
|
||||||
#define DEFAULT_PAD_YPOS 0
|
#define DEFAULT_PAD_YPOS 0
|
||||||
#define DEFAULT_PAD_WIDTH 0
|
#define DEFAULT_PAD_WIDTH 0
|
||||||
|
@ -475,35 +330,44 @@ _create_video_mixer_input (GstGLMixerBin * self, GstPad * mixer_pad)
|
||||||
g_object_new (gst_gl_video_mixer_input_get_type (), "name",
|
g_object_new (gst_gl_video_mixer_input_get_type (), "name",
|
||||||
GST_OBJECT_NAME (mixer_pad), "direction", GST_PAD_DIRECTION (mixer_pad),
|
GST_OBJECT_NAME (mixer_pad), "direction", GST_PAD_DIRECTION (mixer_pad),
|
||||||
NULL);
|
NULL);
|
||||||
GstControlBinding *cb;
|
|
||||||
|
|
||||||
if (!gst_ghost_pad_construct (GST_GHOST_PAD (input))) {
|
if (!gst_ghost_pad_construct (GST_GHOST_PAD (input))) {
|
||||||
gst_object_unref (input);
|
gst_object_unref (input);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#define ADD_PROXY_CONTROL_BINDING(prop) \
|
|
||||||
cb = gst_gl_mixer_control_binding_proxy_new (GST_OBJECT (mixer_pad), \
|
|
||||||
prop, GST_OBJECT (input), prop); \
|
|
||||||
gst_object_add_control_binding (GST_OBJECT (mixer_pad), cb)
|
|
||||||
|
|
||||||
ADD_PROXY_CONTROL_BINDING ("zorder");
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
ADD_PROXY_CONTROL_BINDING ("xpos");
|
GST_OBJECT (input), "zorder");
|
||||||
ADD_PROXY_CONTROL_BINDING ("ypos");
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
ADD_PROXY_CONTROL_BINDING ("width");
|
GST_OBJECT (input), "xpos");
|
||||||
ADD_PROXY_CONTROL_BINDING ("height");
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
ADD_PROXY_CONTROL_BINDING ("alpha");
|
GST_OBJECT (input), "ypos");
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-equation-rgb");
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-equation-alpha");
|
GST_OBJECT (input), "width");
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-function-src-rgb");
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-function-src-alpha");
|
GST_OBJECT (input), "height");
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-function-dst-rgb");
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-function-dst-alpha");
|
GST_OBJECT (input), "alpha");
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-constant-color-red");
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-constant-color-green");
|
GST_OBJECT (input), "blend-equation-rgb");
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-constant-color-blue");
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
ADD_PROXY_CONTROL_BINDING ("blend-constant-color-alpha");
|
GST_OBJECT (input), "blend-equation-alpha");
|
||||||
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
#undef ADD_PROXY_CONTROL_BINDING
|
GST_OBJECT (input), "blend-function-src-rgb");
|
||||||
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
|
GST_OBJECT (input), "blend-function-src-alpha");
|
||||||
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
|
GST_OBJECT (input), "blend-function-dst-rgb");
|
||||||
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
|
GST_OBJECT (input), "blend-function-dst-alpha");
|
||||||
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
|
GST_OBJECT (input), "blend-constant-color-red");
|
||||||
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
|
GST_OBJECT (input), "blend-constant-color-green");
|
||||||
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
|
GST_OBJECT (input), "blend-constant-color-blue");
|
||||||
|
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad),
|
||||||
|
GST_OBJECT (input), "blend-constant-color-alpha");
|
||||||
|
|
||||||
input->mixer_pad = mixer_pad;
|
input->mixer_pad = mixer_pad;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue