diff options
Diffstat (limited to 'ext/gl/gstglvideomixer.c')
-rw-r--r-- | ext/gl/gstglvideomixer.c | 202 |
1 files changed, 33 insertions, 169 deletions
diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c index f372f0cfb..9bce93706 100644 --- a/ext/gl/gstglvideomixer.c +++ b/ext/gl/gstglvideomixer.c @@ -137,151 +137,6 @@ gst_gl_video_mixer_blend_function_get_type (void) 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_YPOS 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", GST_OBJECT_NAME (mixer_pad), "direction", GST_PAD_DIRECTION (mixer_pad), NULL); - GstControlBinding *cb; if (!gst_ghost_pad_construct (GST_GHOST_PAD (input))) { gst_object_unref (input); 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"); - ADD_PROXY_CONTROL_BINDING ("xpos"); - ADD_PROXY_CONTROL_BINDING ("ypos"); - ADD_PROXY_CONTROL_BINDING ("width"); - ADD_PROXY_CONTROL_BINDING ("height"); - ADD_PROXY_CONTROL_BINDING ("alpha"); - ADD_PROXY_CONTROL_BINDING ("blend-equation-rgb"); - ADD_PROXY_CONTROL_BINDING ("blend-equation-alpha"); - ADD_PROXY_CONTROL_BINDING ("blend-function-src-rgb"); - ADD_PROXY_CONTROL_BINDING ("blend-function-src-alpha"); - ADD_PROXY_CONTROL_BINDING ("blend-function-dst-rgb"); - ADD_PROXY_CONTROL_BINDING ("blend-function-dst-alpha"); - ADD_PROXY_CONTROL_BINDING ("blend-constant-color-red"); - ADD_PROXY_CONTROL_BINDING ("blend-constant-color-green"); - ADD_PROXY_CONTROL_BINDING ("blend-constant-color-blue"); - ADD_PROXY_CONTROL_BINDING ("blend-constant-color-alpha"); - -#undef ADD_PROXY_CONTROL_BINDING + + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + GST_OBJECT (input), "zorder"); + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + GST_OBJECT (input), "xpos"); + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + GST_OBJECT (input), "ypos"); + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + GST_OBJECT (input), "width"); + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + GST_OBJECT (input), "height"); + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + GST_OBJECT (input), "alpha"); + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + GST_OBJECT (input), "blend-equation-rgb"); + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + GST_OBJECT (input), "blend-equation-alpha"); + gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), + 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; |