From 9bda5831b8818d0fe4286fdb1217085913277c0d Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 7 Dec 2003 12:11:30 +0000 Subject: Move over from GstInterface to GstImplementsInterface. Also adds some signals to several interfaces Original commit message from CVS: Move over from GstInterface to GstImplementsInterface. Also adds some signals to several interfaces --- gst-libs/gst/colorbalance/Makefile.am | 20 +++++++++++- gst-libs/gst/colorbalance/colorbalance.c | 37 +++++++++++++++++++++- gst-libs/gst/colorbalance/colorbalance.h | 18 +++++++++-- gst-libs/gst/colorbalance/colorbalancechannel.c | 3 +- gst-libs/gst/colorbalance/colorbalancechannel.h | 2 ++ gst-libs/gst/colorbalance/colorbalancemarshal.list | 1 + 6 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 gst-libs/gst/colorbalance/colorbalancemarshal.list (limited to 'gst-libs/gst/colorbalance') diff --git a/gst-libs/gst/colorbalance/Makefile.am b/gst-libs/gst/colorbalance/Makefile.am index dc8bd0ea..b1f6bec4 100644 --- a/gst-libs/gst/colorbalance/Makefile.am +++ b/gst-libs/gst/colorbalance/Makefile.am @@ -9,5 +9,23 @@ noinst_LTLIBRARIES = libgstcolorbalance.la libgstcolorbalance_la_SOURCES = \ colorbalance.c \ - colorbalancechannel.c + colorbalancechannel.c \ + colorbalancemarshal.c libgstcolorbalance_la_CFLAGS = $(GST_CFLAGS) $(GST_OPT_CFLAGS) + +BUILT_SOURCES = \ + colorbalancemarshal.c \ + colorbalancemarshal.h +built_headers = \ + colorbalancemarshal.h + +EXTRA_DIST = colorbalancemarshal.list + +colorbalancemarshal.h: colorbalancemarshal.list + glib-genmarshal --header --prefix=gst_color_balance_marshal $^ > colorbalancemarshal.h.tmp + mv colorbalancemarshal.h.tmp colorbalancemarshal.h + +colorbalancemarshal.c: colorbalancemarshal.list + echo "#include \"colorbalancemarshal.h\"" >> colorbalancemarshal.c.tmp + glib-genmarshal --body --prefix=gst_color_balance_marshal $^ >> colorbalancemarshal.c.tmp + mv colorbalancemarshal.c.tmp colorbalancemarshal.c diff --git a/gst-libs/gst/colorbalance/colorbalance.c b/gst-libs/gst/colorbalance/colorbalance.c index 829cf5f6..163111cd 100644 --- a/gst-libs/gst/colorbalance/colorbalance.c +++ b/gst-libs/gst/colorbalance/colorbalance.c @@ -25,9 +25,17 @@ #endif #include "colorbalance.h" +#include "colorbalancemarshal.h" + +enum { + VALUE_CHANGED, + LAST_SIGNAL +}; static void gst_color_balance_class_init (GstColorBalanceClass *klass); +static guint gst_color_balance_signals[LAST_SIGNAL] = { 0 }; + GType gst_color_balance_get_type (void) { @@ -50,7 +58,7 @@ gst_color_balance_get_type (void) "GstColorBalance", &gst_color_balance_info, 0); g_type_interface_add_prerequisite (gst_color_balance_type, - GST_TYPE_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_color_balance_type; @@ -59,6 +67,21 @@ gst_color_balance_get_type (void) static void gst_color_balance_class_init (GstColorBalanceClass *klass) { + static gboolean initialized = FALSE; + + if (!initialized) { + gst_color_balance_signals[VALUE_CHANGED] = + g_signal_new ("value_changed", + GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstColorBalanceClass, value_changed), + NULL, NULL, + gst_color_balance_marshal_VOID__OBJECT_INT, + G_TYPE_NONE, 2, + GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT); + + initialized = TRUE; + } + /* default virtual functions */ klass->list_channels = NULL; klass->set_value = NULL; @@ -101,3 +124,15 @@ gst_color_balance_get_value (GstColorBalance *balance, return channel->min_value; } + +void +gst_color_balance_value_changed (GstColorBalance *balance, + GstColorBalanceChannel *channel, + gint value) +{ + g_signal_emit (G_OBJECT (balance), + gst_color_balance_signals[VALUE_CHANGED], + 0, channel, value); + + g_signal_emit_by_name (G_OBJECT (channel), "value_changed", value); +} diff --git a/gst-libs/gst/colorbalance/colorbalance.h b/gst-libs/gst/colorbalance/colorbalance.h index 2b9d27d3..041c4e8f 100644 --- a/gst-libs/gst/colorbalance/colorbalance.h +++ b/gst-libs/gst/colorbalance/colorbalance.h @@ -30,13 +30,13 @@ G_BEGIN_DECLS #define GST_TYPE_COLOR_BALANCE \ (gst_color_balance_get_type ()) #define GST_COLOR_BALANCE(obj) \ - (GST_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE, \ - GstColorBalance)) + (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE, \ + GstColorBalance)) #define GST_COLOR_BALANCE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_COLOR_BALANCE, \ GstColorBalanceClass)) #define GST_IS_COLOR_BALANCE(obj) \ - (GST_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE)) + (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE)) #define GST_IS_COLOR_BALANCE_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE)) #define GST_COLOR_BALANCE_GET_CLASS(inst) \ @@ -55,6 +55,13 @@ typedef struct _GstColorBalanceClass { gint value); gint (* get_value) (GstColorBalance *balance, GstColorBalanceChannel *channel); + + /* signals */ + void (* value_changed) (GstColorBalance *balance, + GstColorBalanceChannel *channel, + gint value); + + GST_CLASS_PADDING } GstColorBalanceClass; GType gst_color_balance_get_type (void); @@ -68,6 +75,11 @@ void gst_color_balance_set_value (GstColorBalance *balance, gint gst_color_balance_get_value (GstColorBalance *balance, GstColorBalanceChannel *channel); +/* trigger signal */ +void gst_color_balance_value_changed (GstColorBalance *balance, + GstColorBalanceChannel *channel, + gint value); + G_END_DECLS #endif /* __GST_COLOR_BALANCE_H__ */ diff --git a/gst-libs/gst/colorbalance/colorbalancechannel.c b/gst-libs/gst/colorbalance/colorbalancechannel.c index 8241bfe7..f8710120 100644 --- a/gst-libs/gst/colorbalance/colorbalancechannel.c +++ b/gst-libs/gst/colorbalance/colorbalancechannel.c @@ -96,8 +96,7 @@ gst_color_balance_channel_dispose (GObject *object) { GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (object); - if (channel->label) - g_free (channel->label); + g_free (channel->label); if (parent_class->dispose) parent_class->dispose (object); diff --git a/gst-libs/gst/colorbalance/colorbalancechannel.h b/gst-libs/gst/colorbalance/colorbalancechannel.h index 5f738ecb..81d0bd34 100644 --- a/gst-libs/gst/colorbalance/colorbalancechannel.h +++ b/gst-libs/gst/colorbalance/colorbalancechannel.h @@ -53,6 +53,8 @@ typedef struct _GstColorBalanceChannelClass { /* signals */ void (* value_changed) (GstColorBalanceChannel *channel, gint value); + + GST_CLASS_PADDING } GstColorBalanceChannelClass; GType gst_color_balance_channel_get_type (void); diff --git a/gst-libs/gst/colorbalance/colorbalancemarshal.list b/gst-libs/gst/colorbalance/colorbalancemarshal.list new file mode 100644 index 00000000..b9d0c499 --- /dev/null +++ b/gst-libs/gst/colorbalance/colorbalancemarshal.list @@ -0,0 +1 @@ +VOID:OBJECT,INT -- cgit v1.2.1