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
This commit is contained in:
Ronald S. Bultje 2003-12-07 12:11:30 +00:00
parent b170a21e71
commit 2ebfe048cc
35 changed files with 695 additions and 77 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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, \
(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__ */

View file

@ -96,7 +96,6 @@ gst_color_balance_channel_dispose (GObject *object)
{
GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (object);
if (channel->label)
g_free (channel->label);
if (parent_class->dispose)

View file

@ -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);

View file

@ -0,0 +1 @@
VOID:OBJECT,INT

View file

@ -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);
}

View file

@ -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, \
(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__ */

View file

@ -96,7 +96,6 @@ gst_color_balance_channel_dispose (GObject *object)
{
GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (object);
if (channel->label)
g_free (channel->label);
if (parent_class->dispose)

View file

@ -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);

View file

@ -24,9 +24,19 @@
#endif
#include "mixer.h"
#include "mixermarshal.h"
enum {
MUTE_TOGGLED,
RECORD_TOGGLED,
VOLUME_CHANGED,
LAST_SIGNAL
};
static void gst_mixer_class_init (GstMixerClass *klass);
static guint gst_mixer_signals[LAST_SIGNAL] = { 0 };
GType
gst_mixer_get_type (void)
{
@ -49,7 +59,7 @@ gst_mixer_get_type (void)
"GstMixer",
&gst_mixer_info, 0);
g_type_interface_add_prerequisite (gst_mixer_type,
GST_TYPE_INTERFACE);
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_mixer_type;
@ -58,6 +68,34 @@ gst_mixer_get_type (void)
static void
gst_mixer_class_init (GstMixerClass *klass)
{
static gboolean initialized = FALSE;
if (!initialized) {
gst_mixer_signals[RECORD_TOGGLED] =
g_signal_new ("record_toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, record_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 1,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[MUTE_TOGGLED] =
g_signal_new ("mute_toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, mute_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 1,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[VOLUME_CHANGED] =
g_signal_new ("volume_changed",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, volume_changed),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 1,
GST_TYPE_MIXER_TRACK, G_TYPE_POINTER);
initialized = TRUE;
}
/* default virtual functions */
klass->list_tracks = NULL;
klass->set_volume = NULL;
@ -131,3 +169,45 @@ gst_mixer_set_record (GstMixer *mixer,
klass->set_record (mixer, track, record);
}
}
void
gst_mixer_mute_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[MUTE_TOGGLED], 0,
track, mute);
g_signal_emit_by_name (G_OBJECT (track),
"mute_toggled",
mute);
}
void
gst_mixer_record_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean record)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[RECORD_TOGGLED], 0,
track, record);
g_signal_emit_by_name (G_OBJECT (track),
"record_toggled",
record);
}
void
gst_mixer_volume_changed (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[VOLUME_CHANGED], 0,
track, volumes);
g_signal_emit_by_name (G_OBJECT (track),
"volume_changed",
volumes);
}

View file

@ -30,11 +30,11 @@ G_BEGIN_DECLS
#define GST_TYPE_MIXER \
(gst_mixer_get_type ())
#define GST_MIXER(obj) \
(GST_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
#define GST_MIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass))
#define GST_IS_MIXER(obj) \
(GST_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
#define GST_IS_MIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
#define GST_MIXER_GET_CLASS(inst) \
@ -62,6 +62,17 @@ typedef struct _GstMixerClass {
GstMixerTrack *track,
gboolean record);
/* signals */
void (* mute_toggled) (GstMixer *mixer,
GstMixerTrack *channel,
gboolean mute);
void (* record_toggled) (GstMixer *mixer,
GstMixerTrack *channel,
gboolean record);
void (* volume_changed) (GstMixer *mixer,
GstMixerTrack *channel,
gint *volumes);
GST_CLASS_PADDING
} GstMixerClass;
@ -82,6 +93,17 @@ void gst_mixer_set_record (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
/* trigger signals */
void gst_mixer_mute_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void gst_mixer_record_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void gst_mixer_volume_changed (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
G_END_DECLS
#endif /* __GST_MIXER_H__ */

View file

@ -71,12 +71,15 @@ typedef struct _GstMixerTrack {
typedef struct _GstMixerTrackClass {
GObjectClass parent;
/* signals */
void (* mute_toggled) (GstMixerTrack *channel,
gboolean on);
gboolean mute);
void (* record_toggled) (GstMixerTrack *channel,
gboolean on);
gboolean record);
void (* volume_changed) (GstMixerTrack *channel,
gint *volumes);
GST_CLASS_PADDING
} GstMixerTrackClass;
GType gst_mixer_track_get_type (void);

View file

@ -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);
}

View file

@ -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__ */

View file

@ -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);

View file

@ -46,6 +46,8 @@ typedef struct _GstTunerNorm {
typedef struct _GstTunerNormClass {
GObjectClass parent;
GST_CLASS_PADDING
} GstTunerNormClass;
GType gst_tuner_norm_get_type (void);

View file

@ -56,7 +56,7 @@ gst_x_overlay_get_type (void)
"GstXOverlay",
&gst_x_overlay_info, 0);
g_type_interface_add_prerequisite (gst_x_overlay_type,
GST_TYPE_INTERFACE);
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_x_overlay_type;
@ -79,6 +79,8 @@ gst_x_overlay_base_init (gpointer g_class)
initialized = TRUE;
}
GST_X_OVERLAY_CLASS (g_class)->set_xwindow_id = NULL;
}
/**

View file

@ -31,11 +31,12 @@ G_BEGIN_DECLS
#define GST_TYPE_X_OVERLAY \
(gst_x_overlay_get_type ())
#define GST_X_OVERLAY(obj) \
(GST_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_X_OVERLAY, GstXOverlay))
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_X_OVERLAY, \
GstXOverlay))
#define GST_X_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_X_OVERLAY, GstXOverlayClass))
#define GST_IS_X_OVERLAY(obj) \
(GST_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_X_OVERLAY))
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_X_OVERLAY))
#define GST_IS_X_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_X_OVERLAY))
#define GST_X_OVERLAY_GET_CLASS(inst) \
@ -53,6 +54,8 @@ typedef struct _GstXOverlayClass {
/* signals */
void (*have_xwindow_id) (GstXOverlay *overlay,
XID xwindow_id);
GST_CLASS_PADDING
} GstXOverlayClass;
GType gst_x_overlay_get_type (void);

View file

@ -9,5 +9,23 @@ noinst_LTLIBRARIES = libgstmixer.la
libgstmixer_la_SOURCES = \
mixer.c \
mixertrack.c
mixertrack.c \
mixermarshal.c
libgstmixer_la_CFLAGS = $(GST_CFLAGS)
BUILT_SOURCES = \
mixermarshal.c \
mixermarshal.h
built_headers = \
mixermarshal.h
EXTRA_DIST = mixermarshal.list
mixermarshal.h: mixermarshal.list
glib-genmarshal --header --prefix=gst_mixer_marshal $^ > mixermarshal.h.tmp
mv mixermarshal.h.tmp mixermarshal.h
mixermarshal.c: mixermarshal.list
echo "#include \"mixermarshal.h\"" >> mixermarshal.c.tmp
glib-genmarshal --body --prefix=gst_mixer_marshal $^ >> mixermarshal.c.tmp
mv mixermarshal.c.tmp mixermarshal.c

View file

@ -24,9 +24,19 @@
#endif
#include "mixer.h"
#include "mixermarshal.h"
enum {
MUTE_TOGGLED,
RECORD_TOGGLED,
VOLUME_CHANGED,
LAST_SIGNAL
};
static void gst_mixer_class_init (GstMixerClass *klass);
static guint gst_mixer_signals[LAST_SIGNAL] = { 0 };
GType
gst_mixer_get_type (void)
{
@ -49,7 +59,7 @@ gst_mixer_get_type (void)
"GstMixer",
&gst_mixer_info, 0);
g_type_interface_add_prerequisite (gst_mixer_type,
GST_TYPE_INTERFACE);
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_mixer_type;
@ -58,6 +68,34 @@ gst_mixer_get_type (void)
static void
gst_mixer_class_init (GstMixerClass *klass)
{
static gboolean initialized = FALSE;
if (!initialized) {
gst_mixer_signals[RECORD_TOGGLED] =
g_signal_new ("record_toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, record_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 1,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[MUTE_TOGGLED] =
g_signal_new ("mute_toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, mute_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 1,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[VOLUME_CHANGED] =
g_signal_new ("volume_changed",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, volume_changed),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 1,
GST_TYPE_MIXER_TRACK, G_TYPE_POINTER);
initialized = TRUE;
}
/* default virtual functions */
klass->list_tracks = NULL;
klass->set_volume = NULL;
@ -131,3 +169,45 @@ gst_mixer_set_record (GstMixer *mixer,
klass->set_record (mixer, track, record);
}
}
void
gst_mixer_mute_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[MUTE_TOGGLED], 0,
track, mute);
g_signal_emit_by_name (G_OBJECT (track),
"mute_toggled",
mute);
}
void
gst_mixer_record_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean record)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[RECORD_TOGGLED], 0,
track, record);
g_signal_emit_by_name (G_OBJECT (track),
"record_toggled",
record);
}
void
gst_mixer_volume_changed (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[VOLUME_CHANGED], 0,
track, volumes);
g_signal_emit_by_name (G_OBJECT (track),
"volume_changed",
volumes);
}

View file

@ -30,11 +30,11 @@ G_BEGIN_DECLS
#define GST_TYPE_MIXER \
(gst_mixer_get_type ())
#define GST_MIXER(obj) \
(GST_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
#define GST_MIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass))
#define GST_IS_MIXER(obj) \
(GST_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
#define GST_IS_MIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
#define GST_MIXER_GET_CLASS(inst) \
@ -62,6 +62,17 @@ typedef struct _GstMixerClass {
GstMixerTrack *track,
gboolean record);
/* signals */
void (* mute_toggled) (GstMixer *mixer,
GstMixerTrack *channel,
gboolean mute);
void (* record_toggled) (GstMixer *mixer,
GstMixerTrack *channel,
gboolean record);
void (* volume_changed) (GstMixer *mixer,
GstMixerTrack *channel,
gint *volumes);
GST_CLASS_PADDING
} GstMixerClass;
@ -82,6 +93,17 @@ void gst_mixer_set_record (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
/* trigger signals */
void gst_mixer_mute_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void gst_mixer_record_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void gst_mixer_volume_changed (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
G_END_DECLS
#endif /* __GST_MIXER_H__ */

View file

@ -0,0 +1,2 @@
VOID:OBJECT,BOOLEAN
VOID:OBJECT,POINTER

View file

@ -71,12 +71,15 @@ typedef struct _GstMixerTrack {
typedef struct _GstMixerTrackClass {
GObjectClass parent;
/* signals */
void (* mute_toggled) (GstMixerTrack *channel,
gboolean on);
gboolean mute);
void (* record_toggled) (GstMixerTrack *channel,
gboolean on);
gboolean record);
void (* volume_changed) (GstMixerTrack *channel,
gint *volumes);
GST_CLASS_PADDING
} GstMixerTrackClass;
GType gst_mixer_track_get_type (void);

View file

@ -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

View file

@ -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);
}

View file

@ -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__ */

View file

@ -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);

View file

@ -0,0 +1,2 @@
VOID:OBJECT,ULONG
VOID:OBJECT,INT

View file

@ -46,6 +46,8 @@ typedef struct _GstTunerNorm {
typedef struct _GstTunerNormClass {
GObjectClass parent;
GST_CLASS_PADDING
} GstTunerNormClass;
GType gst_tuner_norm_get_type (void);

View file

@ -56,7 +56,7 @@ gst_x_overlay_get_type (void)
"GstXOverlay",
&gst_x_overlay_info, 0);
g_type_interface_add_prerequisite (gst_x_overlay_type,
GST_TYPE_INTERFACE);
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_x_overlay_type;
@ -79,6 +79,8 @@ gst_x_overlay_base_init (gpointer g_class)
initialized = TRUE;
}
GST_X_OVERLAY_CLASS (g_class)->set_xwindow_id = NULL;
}
/**

View file

@ -31,11 +31,12 @@ G_BEGIN_DECLS
#define GST_TYPE_X_OVERLAY \
(gst_x_overlay_get_type ())
#define GST_X_OVERLAY(obj) \
(GST_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_X_OVERLAY, GstXOverlay))
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_X_OVERLAY, \
GstXOverlay))
#define GST_X_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_X_OVERLAY, GstXOverlayClass))
#define GST_IS_X_OVERLAY(obj) \
(GST_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_X_OVERLAY))
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_X_OVERLAY))
#define GST_IS_X_OVERLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_X_OVERLAY))
#define GST_X_OVERLAY_GET_CLASS(inst) \
@ -53,6 +54,8 @@ typedef struct _GstXOverlayClass {
/* signals */
void (*have_xwindow_id) (GstXOverlay *overlay,
XID xwindow_id);
GST_CLASS_PADDING
} GstXOverlayClass;
GType gst_x_overlay_get_type (void);

View file

@ -78,7 +78,7 @@ static GstElementClass *parent_class = NULL;
static guint gst_v4lelement_signals[LAST_SIGNAL] = { 0 };
static gboolean
gst_v4l_iface_supported (GstInterface *iface,
gst_v4l_iface_supported (GstImplementsInterface *iface,
GType iface_type)
{
GstV4lElement *v4lelement = GST_V4LELEMENT (iface);
@ -98,7 +98,7 @@ gst_v4l_iface_supported (GstInterface *iface,
}
static void
gst_v4l_interface_init (GstInterfaceClass *klass)
gst_v4l_interface_init (GstImplementsInterfaceClass *klass)
{
/* default virtual functions */
klass->supported = gst_v4l_iface_supported;
@ -333,7 +333,7 @@ gst_v4lelement_get_type (void)
&v4lelement_info, 0);
g_type_add_interface_static (v4lelement_type,
GST_TYPE_INTERFACE,
GST_TYPE_IMPLEMENTS_INTERFACE,
&v4liface_info);
g_type_add_interface_static (v4lelement_type,
GST_TYPE_TUNER,

View file

@ -802,14 +802,14 @@ gst_ximagesink_get_bufferpool (GstPad *pad)
/* Interfaces stuff */
static gboolean
gst_ximagesink_interface_supported (GstInterface *iface, GType type)
gst_ximagesink_interface_supported (GstImplementsInterface *iface, GType type)
{
g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY);
return TRUE;
}
static void
gst_ximagesink_interface_init (GstInterfaceClass *klass)
gst_ximagesink_interface_init (GstImplementsInterfaceClass *klass)
{
klass->supported = gst_ximagesink_interface_supported;
}
@ -1059,7 +1059,7 @@ gst_ximagesink_get_type (void)
"GstXImageSink",
&ximagesink_info, 0);
g_type_add_interface_static (ximagesink_type, GST_TYPE_INTERFACE,
g_type_add_interface_static (ximagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE,
&iface_info);
g_type_add_interface_static (ximagesink_type, GST_TYPE_NAVIGATION,
&navigation_info);

View file

@ -953,14 +953,14 @@ gst_xvimagesink_get_bufferpool (GstPad *pad)
/* Interfaces stuff */
static gboolean
gst_xvimagesink_interface_supported (GstInterface *iface, GType type)
gst_xvimagesink_interface_supported (GstImplementsInterface *iface, GType type)
{
g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY);
return TRUE;
}
static void
gst_xvimagesink_interface_init (GstInterfaceClass *klass)
gst_xvimagesink_interface_init (GstImplementsInterfaceClass *klass)
{
klass->supported = gst_xvimagesink_interface_supported;
}
@ -1203,7 +1203,7 @@ gst_xvimagesink_get_type (void)
"GstXvImageSink",
&xvimagesink_info, 0);
g_type_add_interface_static (xvimagesink_type, GST_TYPE_INTERFACE,
g_type_add_interface_static (xvimagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE,
&iface_info);
g_type_add_interface_static (xvimagesink_type, GST_TYPE_NAVIGATION,
&navigation_info);