From a4024b61cf78182ea4ff7413fed39474bd1b23bd Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 10 Jan 2017 12:51:51 +1100 Subject: gl: remove custom control binding proxy Use the existing GstProxyControlBinding instead. --- ext/gl/Makefile.am | 3 + ext/gl/gstglsinkbin.c | 18 ++-- ext/gl/gstglvideomixer.c | 55 ++++------ ext/gl/meson.build | 2 +- gst-libs/gst/gl/Makefile.am | 4 +- gst-libs/gst/gl/gstglcontrolbindingproxy.c | 155 ----------------------------- gst-libs/gst/gl/gstglcontrolbindingproxy.h | 61 ------------ gst-libs/gst/gl/meson.build | 2 - 8 files changed, 37 insertions(+), 263 deletions(-) delete mode 100644 gst-libs/gst/gl/gstglcontrolbindingproxy.c delete mode 100644 gst-libs/gst/gl/gstglcontrolbindingproxy.h diff --git a/ext/gl/Makefile.am b/ext/gl/Makefile.am index 80036b5e8..11734bfb2 100644 --- a/ext/gl/Makefile.am +++ b/ext/gl/Makefile.am @@ -128,6 +128,7 @@ libgstopengl_la_OBJCFLAGS = \ $(GST_OBJCFLAGS) \ $(GST_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_CONTROLLER_CFLAGS) \ $(GL_OBJCFLAGS) # check order of CFLAGS and LIBS, shouldn't the order be the other way around @@ -138,6 +139,7 @@ libgstopengl_la_CFLAGS = \ $(GST_CFLAGS) \ $(GST_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_CONTROLLER_CFLAGS) \ $(GL_CFLAGS) \ $(LIBPNG_CFLAGS) \ $(GRAPHENE_CFLAGS) @@ -149,6 +151,7 @@ libgstopengl_la_LIBADD = \ $(GST_BASE_LIBS) \ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \ -lgstpbutils-$(GST_API_VERSION) \ + $(GST_CONTROLLER_LIBS) \ $(GL_LIBS) \ $(LIBPNG_LIBS) \ $(JPEG_LIBS) \ diff --git a/ext/gl/gstglsinkbin.c b/ext/gl/gstglsinkbin.c index c9c5a7239..8477d73f1 100644 --- a/ext/gl/gstglsinkbin.c +++ b/ext/gl/gstglsinkbin.c @@ -24,6 +24,7 @@ #include #include +#include #include "gstglsinkbin.h" @@ -248,14 +249,15 @@ gst_gl_sink_bin_init (GstGLSinkBin * self) gst_object_unref (pad); } - gst_gl_object_add_control_binding_proxy (GST_OBJECT (self->balance), - GST_OBJECT (self), "contrast"); - gst_gl_object_add_control_binding_proxy (GST_OBJECT (self->balance), - GST_OBJECT (self), "brightness"); - gst_gl_object_add_control_binding_proxy (GST_OBJECT (self->balance), - GST_OBJECT (self), "hue"); - gst_gl_object_add_control_binding_proxy (GST_OBJECT (self->balance), - GST_OBJECT (self), "saturation"); +#define ADD_BINDING(obj,ref,prop) \ + gst_object_add_control_binding (GST_OBJECT (obj), \ + gst_proxy_control_binding_new (GST_OBJECT (obj), prop, \ + GST_OBJECT (ref), prop)); + ADD_BINDING (self->balance, self, "contrast"); + ADD_BINDING (self->balance, self, "brightness"); + ADD_BINDING (self->balance, self, "hue"); + ADD_BINDING (self->balance, self, "saturation"); +#undef ADD_BINDING if (!res) { GST_WARNING_OBJECT (self, "Failed to add/connect the necessary machinery"); diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c index ffb43d4e8..1c8655792 100644 --- a/ext/gl/gstglvideomixer.c +++ b/ext/gl/gstglvideomixer.c @@ -44,6 +44,7 @@ #endif #include +#include #include "gstglvideomixer.h" #include "gstglmixerbin.h" @@ -338,39 +339,27 @@ _create_video_mixer_input (GstGLMixerBin * self, GstPad * mixer_pad) gst_object_unref (input); return NULL; } - - 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"); +#define ADD_BINDING(obj,ref,prop) \ + gst_object_add_control_binding (GST_OBJECT (obj), \ + gst_proxy_control_binding_new (GST_OBJECT (obj), prop, \ + GST_OBJECT (ref), prop)); + ADD_BINDING (mixer_pad, input, "zorder"); + ADD_BINDING (mixer_pad, input, "xpos"); + ADD_BINDING (mixer_pad, input, "ypos"); + ADD_BINDING (mixer_pad, input, "width"); + ADD_BINDING (mixer_pad, input, "height"); + ADD_BINDING (mixer_pad, input, "alpha"); + ADD_BINDING (mixer_pad, input, "blend-equation-rgb"); + ADD_BINDING (mixer_pad, input, "blend-equation-alpha"); + ADD_BINDING (mixer_pad, input, "blend-function-src-rgb"); + ADD_BINDING (mixer_pad, input, "blend-function-src-alpha"); + ADD_BINDING (mixer_pad, input, "blend-function-dst-rgb"); + ADD_BINDING (mixer_pad, input, "blend-function-dst-alpha"); + ADD_BINDING (mixer_pad, input, "blend-constant-color-red"); + ADD_BINDING (mixer_pad, input, "blend-constant-color-green"); + ADD_BINDING (mixer_pad, input, "blend-constant-color-blue"); + ADD_BINDING (mixer_pad, input, "blend-constant-color-alpha"); +#undef ADD_BINDING input->mixer_pad = mixer_pad; diff --git a/ext/gl/meson.build b/ext/gl/meson.build index 60d9ccc90..9dfd78117 100644 --- a/ext/gl/meson.build +++ b/ext/gl/meson.build @@ -108,7 +108,7 @@ if build_gstgl and gstgl_dep.found() link_args : noseh_link_args, include_directories : [configinc], dependencies : [gstgl_dep, gstbadvideo_dep, gstbadbase_dep, gstvideo_dep, - gstbase_dep, libm] + optional_deps, + gstbase_dep, gstcontroller_dep, libm] + optional_deps, install : true, install_dir : plugins_install_dir, ) diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am index 0e589f7cc..6e4b62bb8 100644 --- a/gst-libs/gst/gl/Makefile.am +++ b/gst-libs/gst/gl/Makefile.am @@ -33,8 +33,7 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \ gstglsyncmeta.c \ gstglviewconvert.c \ gstgloverlaycompositor.c \ - gstglquery.c \ - gstglcontrolbindingproxy.c + gstglquery.c libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl libgstgl_@GST_API_VERSION@include_HEADERS = \ @@ -65,7 +64,6 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \ gstglviewconvert.h \ gstgloverlaycompositor.h \ gstglquery.h \ - gstglcontrolbindingproxy.h \ gstgl_fwd.h \ gstgl_enums.h \ gl.h diff --git a/gst-libs/gst/gl/gstglcontrolbindingproxy.c b/gst-libs/gst/gl/gstglcontrolbindingproxy.c deleted file mode 100644 index f34ddd813..000000000 --- a/gst-libs/gst/gl/gstglcontrolbindingproxy.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2016 Matthew Waters - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstglcontrolbindingproxy.h" - -G_DEFINE_TYPE (GstGLControlBindingProxy, - gst_gl_control_binding_proxy, GST_TYPE_CONTROL_BINDING); - -static void -gst_gl_control_binding_proxy_init (GstGLControlBindingProxy * self) -{ -} - -static gboolean -gst_gl_control_binding_proxy_sync_values (GstControlBinding * binding, - GstObject * object, GstClockTime timestamp, GstClockTime last_sync) -{ - GstGLControlBindingProxy *self = (GstGLControlBindingProxy *) - 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_control_binding_proxy_get_value (GstControlBinding * binding, - GstClockTime timestamp) -{ - GstGLControlBindingProxy *self = (GstGLControlBindingProxy *) - 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_control_binding_proxy_get_value_array (GstControlBinding * binding, - GstClockTime timestamp, GstClockTime interval, guint n_values, - gpointer values) -{ - GstGLControlBindingProxy *self = (GstGLControlBindingProxy *) - 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_control_binding_proxy_get_g_value_array (GstControlBinding * - binding, GstClockTime timestamp, GstClockTime interval, guint n_values, - GValue * values) -{ - GstGLControlBindingProxy *self = (GstGLControlBindingProxy *) - 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_control_binding_proxy_class_init - (GstGLControlBindingProxyClass * klass) -{ - GstControlBindingClass *cb_class = GST_CONTROL_BINDING_CLASS (klass); - - cb_class->sync_values = gst_gl_control_binding_proxy_sync_values; - cb_class->get_value = gst_gl_control_binding_proxy_get_value; - cb_class->get_value_array = gst_gl_control_binding_proxy_get_value_array; - cb_class->get_g_value_array = gst_gl_control_binding_proxy_get_g_value_array; -} - -GstControlBinding * -gst_gl_control_binding_proxy_new (GstObject * object, - const gchar * property_name, GstObject * ref_object, - const gchar * ref_property_name) -{ - GstGLControlBindingProxy *self = - g_object_new (GST_TYPE_GL_CONTROL_BINDING_PROXY, "object", object, - "name", property_name, NULL); - - self->ref_object = ref_object; - self->property_name = ref_property_name; - - return (GstControlBinding *) self; -} - -void -gst_gl_object_add_control_binding_proxy (GstObject * object, - GstObject * ref_object, const gchar * prop) -{ - GstControlBinding *cb; - - cb = gst_gl_control_binding_proxy_new (object, prop, ref_object, prop); - gst_object_add_control_binding (object, cb); -} diff --git a/gst-libs/gst/gl/gstglcontrolbindingproxy.h b/gst-libs/gst/gl/gstglcontrolbindingproxy.h deleted file mode 100644 index 8a205a8f1..000000000 --- a/gst-libs/gst/gl/gstglcontrolbindingproxy.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2016 Matthew Waters - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __GST_GL_PROXY_CONTROL_BINDING_H__ -#define __GST_GL_PROXY_CONTROL_BINDING_H__ - -#include - -G_BEGIN_DECLS - -GST_EXPORT -GType gst_gl_control_binding_proxy_get_type (void); -#define GST_TYPE_GL_CONTROL_BINDING_PROXY (gst_gl_control_binding_proxy_get_type()) - -typedef struct _GstGLControlBindingProxy GstGLControlBindingProxy; -typedef struct _GstGLControlBindingProxyClass GstGLControlBindingProxyClass; - -struct _GstGLControlBindingProxy -{ - GstControlBinding parent; - - GstObject *ref_object; - const gchar *property_name; -}; - -struct _GstGLControlBindingProxyClass -{ - GstControlBindingClass parent_class; -}; - -GST_EXPORT -GstControlBinding * gst_gl_control_binding_proxy_new (GstObject * object, - const gchar * property_name, - GstObject * ref_object, - const gchar * ref_property_name); - -GST_EXPORT -void gst_gl_object_add_control_binding_proxy (GstObject * object, - GstObject * ref_object, - const gchar * prop); - -G_END_DECLS - -#endif /* __GST_GL_PROXY_CONTROL_BINDING_H__ */ diff --git a/gst-libs/gst/gl/meson.build b/gst-libs/gst/gl/meson.build index 441b04859..b228c7e57 100644 --- a/gst-libs/gst/gl/meson.build +++ b/gst-libs/gst/gl/meson.build @@ -3,7 +3,6 @@ gl_sources = [ 'gstglbasefilter.c', 'gstglbasememory.c', 'gstglcolorconvert.c', - 'gstglcontrolbindingproxy.c', 'gstglbuffer.c', 'gstglbufferpool.c', 'gstglcontext.c', @@ -40,7 +39,6 @@ gl_headers = [ 'gstglbufferpool.h', 'gstglcolorconvert.h', 'gstglcontext.h', - 'gstglcontrolbindingproxy.h', 'gstgldebug.h', 'gstgldisplay.h', 'gstglfeature.h', -- cgit v1.2.1