gl: remove custom control binding proxy

Use the existing GstProxyControlBinding instead.
This commit is contained in:
Matthew Waters 2017-01-10 12:51:51 +11:00 committed by Tim-Philipp Müller
parent 068a7656f8
commit cfc16f6dae
8 changed files with 37 additions and 263 deletions

View file

@ -128,6 +128,7 @@ libgstopengl_la_OBJCFLAGS = \
$(GST_OBJCFLAGS) \ $(GST_OBJCFLAGS) \
$(GST_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CONTROLLER_CFLAGS) \
$(GL_OBJCFLAGS) $(GL_OBJCFLAGS)
# check order of CFLAGS and LIBS, shouldn't the order be the other way around # 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_CFLAGS) \
$(GST_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CONTROLLER_CFLAGS) \
$(GL_CFLAGS) \ $(GL_CFLAGS) \
$(LIBPNG_CFLAGS) \ $(LIBPNG_CFLAGS) \
$(GRAPHENE_CFLAGS) $(GRAPHENE_CFLAGS)
@ -149,6 +151,7 @@ libgstopengl_la_LIBADD = \
$(GST_BASE_LIBS) \ $(GST_BASE_LIBS) \
$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
-lgstpbutils-$(GST_API_VERSION) \ -lgstpbutils-$(GST_API_VERSION) \
$(GST_CONTROLLER_LIBS) \
$(GL_LIBS) \ $(GL_LIBS) \
$(LIBPNG_LIBS) \ $(LIBPNG_LIBS) \
$(JPEG_LIBS) \ $(JPEG_LIBS) \

View file

@ -24,6 +24,7 @@
#include <gst/video/videooverlay.h> #include <gst/video/videooverlay.h>
#include <gst/video/navigation.h> #include <gst/video/navigation.h>
#include <gst/controller/gstproxycontrolbinding.h>
#include "gstglsinkbin.h" #include "gstglsinkbin.h"
@ -248,14 +249,15 @@ gst_gl_sink_bin_init (GstGLSinkBin * self)
gst_object_unref (pad); gst_object_unref (pad);
} }
gst_gl_object_add_control_binding_proxy (GST_OBJECT (self->balance), #define ADD_BINDING(obj,ref,prop) \
GST_OBJECT (self), "contrast"); gst_object_add_control_binding (GST_OBJECT (obj), \
gst_gl_object_add_control_binding_proxy (GST_OBJECT (self->balance), gst_proxy_control_binding_new (GST_OBJECT (obj), prop, \
GST_OBJECT (self), "brightness"); GST_OBJECT (ref), prop));
gst_gl_object_add_control_binding_proxy (GST_OBJECT (self->balance), ADD_BINDING (self->balance, self, "contrast");
GST_OBJECT (self), "hue"); ADD_BINDING (self->balance, self, "brightness");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (self->balance), ADD_BINDING (self->balance, self, "hue");
GST_OBJECT (self), "saturation"); ADD_BINDING (self->balance, self, "saturation");
#undef ADD_BINDING
if (!res) { if (!res) {
GST_WARNING_OBJECT (self, "Failed to add/connect the necessary machinery"); GST_WARNING_OBJECT (self, "Failed to add/connect the necessary machinery");

View file

@ -44,6 +44,7 @@
#endif #endif
#include <gst/video/gstvideoaffinetransformationmeta.h> #include <gst/video/gstvideoaffinetransformationmeta.h>
#include <gst/controller/gstproxycontrolbinding.h>
#include "gstglvideomixer.h" #include "gstglvideomixer.h"
#include "gstglmixerbin.h" #include "gstglmixerbin.h"
@ -338,39 +339,27 @@ _create_video_mixer_input (GstGLMixerBin * self, GstPad * mixer_pad)
gst_object_unref (input); gst_object_unref (input);
return NULL; return NULL;
} }
#define ADD_BINDING(obj,ref,prop) \
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), gst_object_add_control_binding (GST_OBJECT (obj), \
GST_OBJECT (input), "zorder"); gst_proxy_control_binding_new (GST_OBJECT (obj), prop, \
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), GST_OBJECT (ref), prop));
GST_OBJECT (input), "xpos"); ADD_BINDING (mixer_pad, input, "zorder");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), ADD_BINDING (mixer_pad, input, "xpos");
GST_OBJECT (input), "ypos"); ADD_BINDING (mixer_pad, input, "ypos");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), ADD_BINDING (mixer_pad, input, "width");
GST_OBJECT (input), "width"); ADD_BINDING (mixer_pad, input, "height");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), ADD_BINDING (mixer_pad, input, "alpha");
GST_OBJECT (input), "height"); ADD_BINDING (mixer_pad, input, "blend-equation-rgb");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), ADD_BINDING (mixer_pad, input, "blend-equation-alpha");
GST_OBJECT (input), "alpha"); ADD_BINDING (mixer_pad, input, "blend-function-src-rgb");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), ADD_BINDING (mixer_pad, input, "blend-function-src-alpha");
GST_OBJECT (input), "blend-equation-rgb"); ADD_BINDING (mixer_pad, input, "blend-function-dst-rgb");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), ADD_BINDING (mixer_pad, input, "blend-function-dst-alpha");
GST_OBJECT (input), "blend-equation-alpha"); ADD_BINDING (mixer_pad, input, "blend-constant-color-red");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), ADD_BINDING (mixer_pad, input, "blend-constant-color-green");
GST_OBJECT (input), "blend-function-src-rgb"); ADD_BINDING (mixer_pad, input, "blend-constant-color-blue");
gst_gl_object_add_control_binding_proxy (GST_OBJECT (mixer_pad), ADD_BINDING (mixer_pad, input, "blend-constant-color-alpha");
GST_OBJECT (input), "blend-function-src-alpha"); #undef ADD_BINDING
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;

View file

@ -108,7 +108,7 @@ if build_gstgl and gstgl_dep.found()
link_args : noseh_link_args, link_args : noseh_link_args,
include_directories : [configinc], include_directories : [configinc],
dependencies : [gstgl_dep, gstbadvideo_dep, gstbadbase_dep, gstvideo_dep, dependencies : [gstgl_dep, gstbadvideo_dep, gstbadbase_dep, gstvideo_dep,
gstbase_dep, libm] + optional_deps, gstbase_dep, gstcontroller_dep, libm] + optional_deps,
install : true, install : true,
install_dir : plugins_install_dir, install_dir : plugins_install_dir,
) )

View file

@ -33,8 +33,7 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \
gstglsyncmeta.c \ gstglsyncmeta.c \
gstglviewconvert.c \ gstglviewconvert.c \
gstgloverlaycompositor.c \ gstgloverlaycompositor.c \
gstglquery.c \ gstglquery.c
gstglcontrolbindingproxy.c
libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
libgstgl_@GST_API_VERSION@include_HEADERS = \ libgstgl_@GST_API_VERSION@include_HEADERS = \
@ -65,7 +64,6 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \
gstglviewconvert.h \ gstglviewconvert.h \
gstgloverlaycompositor.h \ gstgloverlaycompositor.h \
gstglquery.h \ gstglquery.h \
gstglcontrolbindingproxy.h \
gstgl_fwd.h \ gstgl_fwd.h \
gstgl_enums.h \ gstgl_enums.h \
gl.h gl.h

View file

@ -1,155 +0,0 @@
/*
* GStreamer
* Copyright (C) 2016 Matthew Waters <matthew@centricular.com>
*
* 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);
}

View file

@ -1,61 +0,0 @@
/*
* GStreamer
* Copyright (C) 2016 Matthew Waters <matthew@centricular.com>
*
* 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 <gst/gl/gl.h>
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__ */

View file

@ -3,7 +3,6 @@ gl_sources = [
'gstglbasefilter.c', 'gstglbasefilter.c',
'gstglbasememory.c', 'gstglbasememory.c',
'gstglcolorconvert.c', 'gstglcolorconvert.c',
'gstglcontrolbindingproxy.c',
'gstglbuffer.c', 'gstglbuffer.c',
'gstglbufferpool.c', 'gstglbufferpool.c',
'gstglcontext.c', 'gstglcontext.c',
@ -40,7 +39,6 @@ gl_headers = [
'gstglbufferpool.h', 'gstglbufferpool.h',
'gstglcolorconvert.h', 'gstglcolorconvert.h',
'gstglcontext.h', 'gstglcontext.h',
'gstglcontrolbindingproxy.h',
'gstgldebug.h', 'gstgldebug.h',
'gstgldisplay.h', 'gstgldisplay.h',
'gstglfeature.h', 'gstglfeature.h',