summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst/tuner
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-12-07 12:11:30 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-12-07 12:11:30 +0000
commit9bda5831b8818d0fe4286fdb1217085913277c0d (patch)
tree404583dd41a644b2e2dd72aa587357b252c135d8 /gst-libs/gst/tuner
parentef074394e68785508b4def25078ffaba572cb0c8 (diff)
downloadgst-plugins-bad-9bda5831b8818d0fe4286fdb1217085913277c0d.tar.gz
gst-plugins-bad-9bda5831b8818d0fe4286fdb1217085913277c0d.tar.bz2
gst-plugins-bad-9bda5831b8818d0fe4286fdb1217085913277c0d.zip
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
Diffstat (limited to 'gst-libs/gst/tuner')
-rw-r--r--gst-libs/gst/tuner/Makefile.am19
-rw-r--r--gst-libs/gst/tuner/tuner.c94
-rw-r--r--gst-libs/gst/tuner/tuner.h30
-rw-r--r--gst-libs/gst/tuner/tunerchannel.h6
-rw-r--r--gst-libs/gst/tuner/tunermarshal.list2
-rw-r--r--gst-libs/gst/tuner/tunernorm.h2
6 files changed, 147 insertions, 6 deletions
diff --git a/gst-libs/gst/tuner/Makefile.am b/gst-libs/gst/tuner/Makefile.am
index 6d14130d..717c49db 100644
--- a/gst-libs/gst/tuner/Makefile.am
+++ b/gst-libs/gst/tuner/Makefile.am
@@ -11,6 +11,23 @@ noinst_LTLIBRARIES = libgsttuner.la
libgsttuner_la_SOURCES = \
tuner.c \
tunernorm.c \
- tunerchannel.c
+ tunerchannel.c \
+ tunermarshal.c
libgsttuner_la_CFLAGS = $(GST_CFLAGS)
+BUILT_SOURCES = \
+ tunermarshal.c \
+ tunermarshal.h
+built_headers = \
+ tunermarshal.h
+
+EXTRA_DIST = tunermarshal.list
+
+tunermarshal.h: tunermarshal.list
+ glib-genmarshal --header --prefix=gst_tuner_marshal $^ > tunermarshal.h.tmp
+ mv tunermarshal.h.tmp tunermarshal.h
+
+tunermarshal.c: tunermarshal.list
+ echo "#include \"tunermarshal.h\"" >> tunermarshal.c.tmp
+ glib-genmarshal --body --prefix=gst_tuner_marshal $^ >> tunermarshal.c.tmp
+ mv tunermarshal.c.tmp tunermarshal.c
diff --git a/gst-libs/gst/tuner/tuner.c b/gst-libs/gst/tuner/tuner.c
index 43dda8d0..115cdbba 100644
--- a/gst-libs/gst/tuner/tuner.c
+++ b/gst-libs/gst/tuner/tuner.c
@@ -24,9 +24,20 @@
#endif
#include "tuner.h"
+#include "tunermarshal.h"
+
+enum {
+ NORM_CHANGED,
+ CHANNEL_CHANGED,
+ FREQUENCY_CHANGED,
+ SIGNAL_CHANGED,
+ LAST_SIGNAL
+};
static void gst_tuner_class_init (GstTunerClass *klass);
+static guint gst_tuner_signals[LAST_SIGNAL] = { 0 };
+
GType
gst_tuner_get_type (void)
{
@@ -49,7 +60,7 @@ gst_tuner_get_type (void)
"GstTuner",
&gst_tuner_info, 0);
g_type_interface_add_prerequisite (gst_tuner_type,
- GST_TYPE_INTERFACE);
+ GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_tuner_type;
@@ -58,6 +69,41 @@ gst_tuner_get_type (void)
static void
gst_tuner_class_init (GstTunerClass *klass)
{
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ gst_tuner_signals[NORM_CHANGED] =
+ g_signal_new ("norm_changed",
+ GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerClass, norm_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
+ GST_TYPE_TUNER_NORM);
+ gst_tuner_signals[CHANNEL_CHANGED] =
+ g_signal_new ("channel_changed",
+ GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerClass, channel_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
+ GST_TYPE_TUNER_CHANNEL);
+ gst_tuner_signals[NORM_CHANGED] =
+ g_signal_new ("norm_changed",
+ GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerClass, frequency_changed),
+ NULL, NULL,
+ gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
+ GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
+ gst_tuner_signals[NORM_CHANGED] =
+ g_signal_new ("norm_changed",
+ GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerClass, signal_changed),
+ NULL, NULL,
+ gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2,
+ GST_TYPE_TUNER_CHANNEL, G_TYPE_INT);
+
+ initialized = TRUE;
+ }
+
/* default virtual functions */
klass->list_channels = NULL;
klass->set_channel = NULL;
@@ -188,3 +234,49 @@ gst_tuner_signal_strength (GstTuner *tuner,
return 0;
}
+
+void
+gst_tuner_channel_changed (GstTuner *tuner,
+ GstTunerChannel *channel)
+{
+ g_signal_emit (G_OBJECT (tuner),
+ gst_tuner_signals[CHANNEL_CHANGED], 0,
+ channel);
+}
+
+void
+gst_tuner_norm_changed (GstTuner *tuner,
+ GstTunerNorm *norm)
+{
+ g_signal_emit (G_OBJECT (tuner),
+ gst_tuner_signals[NORM_CHANGED], 0,
+ norm);
+}
+
+void
+gst_tuner_frequency_changed (GstTuner *tuner,
+ GstTunerChannel *channel,
+ gulong frequency)
+{
+ g_signal_emit (G_OBJECT (tuner),
+ gst_tuner_signals[FREQUENCY_CHANGED], 0,
+ channel, frequency);
+
+ g_signal_emit_by_name (G_OBJECT (channel),
+ "frequency_changed",
+ frequency);
+}
+
+void
+gst_tuner_signal_changed (GstTuner *tuner,
+ GstTunerChannel *channel,
+ gint signal)
+{
+ g_signal_emit (G_OBJECT (tuner),
+ gst_tuner_signals[SIGNAL_CHANGED], 0,
+ channel, signal);
+
+ g_signal_emit_by_name (G_OBJECT (channel),
+ "signal_changed",
+ signal);
+}
diff --git a/gst-libs/gst/tuner/tuner.h b/gst-libs/gst/tuner/tuner.h
index 1cd51e11..6c391073 100644
--- a/gst-libs/gst/tuner/tuner.h
+++ b/gst-libs/gst/tuner/tuner.h
@@ -31,11 +31,11 @@ G_BEGIN_DECLS
#define GST_TYPE_TUNER \
(gst_tuner_get_type ())
#define GST_TUNER(obj) \
- (GST_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner))
+ (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner))
#define GST_TUNER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER, GstTunerClass))
#define GST_IS_TUNER(obj) \
- (GST_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER))
+ (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER))
#define GST_IS_TUNER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER))
#define GST_TUNER_GET_CLASS(inst) \
@@ -66,6 +66,20 @@ typedef struct _GstTunerClass {
GstTunerChannel *channel);
gint (* signal_strength) (GstTuner *tuner,
GstTunerChannel *channel);
+
+ /* signals */
+ void (*channel_changed) (GstTuner *tuner,
+ GstTunerChannel *channel);
+ void (*norm_changed) (GstTuner *tuner,
+ GstTunerNorm *norm);
+ void (*frequency_changed) (GstTuner *tuner,
+ GstTunerChannel *channel,
+ gulong frequency);
+ void (*signal_changed) (GstTuner *tuner,
+ GstTunerChannel *channel,
+ gint signal);
+
+ GST_CLASS_PADDING
} GstTunerClass;
GType gst_tuner_get_type (void);
@@ -91,6 +105,18 @@ gulong gst_tuner_get_frequency (GstTuner *tuner,
gint gst_tuner_signal_strength (GstTuner *tuner,
GstTunerChannel *channel);
+/* trigger signals */
+void gst_tuner_channel_changed (GstTuner *tuner,
+ GstTunerChannel *channel);
+void gst_tuner_norm_changed (GstTuner *tuner,
+ GstTunerNorm *norm);
+void gst_tuner_frequency_changed (GstTuner *tuner,
+ GstTunerChannel *channel,
+ gulong frequency);
+void gst_tuner_signal_changed (GstTuner *tuner,
+ GstTunerChannel *channel,
+ gint signal);
+
G_END_DECLS
#endif /* __GST_TUNER_H__ */
diff --git a/gst-libs/gst/tuner/tunerchannel.h b/gst-libs/gst/tuner/tunerchannel.h
index b8031455..9545ea55 100644
--- a/gst-libs/gst/tuner/tunerchannel.h
+++ b/gst-libs/gst/tuner/tunerchannel.h
@@ -64,10 +64,12 @@ typedef struct _GstTunerChannelClass {
GObjectClass parent;
/* signals */
- void (*frequency_changed) (GstTunerChannel *tuner,
+ void (*frequency_changed) (GstTunerChannel *channel,
gulong frequency);
- void (*signal_changed) (GstTunerChannel *tuner,
+ void (*signal_changed) (GstTunerChannel *channel,
gint signal);
+
+ GST_CLASS_PADDING
} GstTunerChannelClass;
GType gst_tuner_channel_get_type (void);
diff --git a/gst-libs/gst/tuner/tunermarshal.list b/gst-libs/gst/tuner/tunermarshal.list
new file mode 100644
index 00000000..c99ddc7d
--- /dev/null
+++ b/gst-libs/gst/tuner/tunermarshal.list
@@ -0,0 +1,2 @@
+VOID:OBJECT,ULONG
+VOID:OBJECT,INT
diff --git a/gst-libs/gst/tuner/tunernorm.h b/gst-libs/gst/tuner/tunernorm.h
index 3e6e801d..9852228d 100644
--- a/gst-libs/gst/tuner/tunernorm.h
+++ b/gst-libs/gst/tuner/tunernorm.h
@@ -46,6 +46,8 @@ typedef struct _GstTunerNorm {
typedef struct _GstTunerNormClass {
GObjectClass parent;
+
+ GST_CLASS_PADDING
} GstTunerNormClass;
GType gst_tuner_norm_get_type (void);