diff options
Diffstat (limited to 'gst-libs/gst/mixer')
-rw-r--r-- | gst-libs/gst/mixer/mixer.c | 107 | ||||
-rw-r--r-- | gst-libs/gst/mixer/mixer.h | 81 | ||||
-rw-r--r-- | gst-libs/gst/mixer/mixertrack.c | 54 | ||||
-rw-r--r-- | gst-libs/gst/mixer/mixertrack.h | 44 |
4 files changed, 119 insertions, 167 deletions
diff --git a/gst-libs/gst/mixer/mixer.c b/gst-libs/gst/mixer/mixer.c index 0c1d6e0f..a9034f60 100644 --- a/gst-libs/gst/mixer/mixer.c +++ b/gst-libs/gst/mixer/mixer.c @@ -26,14 +26,15 @@ #include "mixer.h" #include "mixer-marshal.h" -enum { +enum +{ MUTE_TOGGLED, RECORD_TOGGLED, VOLUME_CHANGED, LAST_SIGNAL }; -static void gst_mixer_class_init (GstMixerClass *klass); +static void gst_mixer_class_init (GstMixerClass * klass); static guint gst_mixer_signals[LAST_SIGNAL] = { 0 }; @@ -56,48 +57,47 @@ gst_mixer_get_type (void) }; gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE, - "GstMixer", - &gst_mixer_info, 0); + "GstMixer", &gst_mixer_info, 0); g_type_interface_add_prerequisite (gst_mixer_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_mixer_type; } static void -gst_mixer_class_init (GstMixerClass *klass) +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, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); + 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, 2, + 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, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); + 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, 2, + 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, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_POINTER); - + 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, 2, + GST_TYPE_MIXER_TRACK, G_TYPE_POINTER); + initialized = TRUE; } klass->mixer_type = GST_MIXER_SOFTWARE; - + /* default virtual functions */ klass->list_tracks = NULL; klass->set_volume = NULL; @@ -119,7 +119,7 @@ gst_mixer_class_init (GstMixerClass *klass) */ const GList * -gst_mixer_list_tracks (GstMixer *mixer) +gst_mixer_list_tracks (GstMixer * mixer) { GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer); @@ -146,9 +146,7 @@ gst_mixer_list_tracks (GstMixer *mixer) */ void -gst_mixer_set_volume (GstMixer *mixer, - GstMixerTrack *track, - gint *volumes) +gst_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes) { GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer); @@ -169,9 +167,7 @@ gst_mixer_set_volume (GstMixer *mixer, */ void -gst_mixer_get_volume (GstMixer *mixer, - GstMixerTrack *track, - gint *volumes) +gst_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes) { GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer); @@ -198,9 +194,7 @@ gst_mixer_get_volume (GstMixer *mixer, */ void -gst_mixer_set_mute (GstMixer *mixer, - GstMixerTrack *track, - gboolean mute) +gst_mixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute) { GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer); @@ -223,9 +217,7 @@ gst_mixer_set_mute (GstMixer *mixer, */ void -gst_mixer_set_record (GstMixer *mixer, - GstMixerTrack *track, - gboolean record) +gst_mixer_set_record (GstMixer * mixer, GstMixerTrack * track, gboolean record) { GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer); @@ -235,43 +227,30 @@ gst_mixer_set_record (GstMixer *mixer, } void -gst_mixer_mute_toggled (GstMixer *mixer, - GstMixerTrack *track, - gboolean mute) +gst_mixer_mute_toggled (GstMixer * mixer, GstMixerTrack * track, gboolean mute) { g_signal_emit (G_OBJECT (mixer), - gst_mixer_signals[MUTE_TOGGLED], 0, - track, mute); + gst_mixer_signals[MUTE_TOGGLED], 0, track, mute); - g_signal_emit_by_name (G_OBJECT (track), - "mute_toggled", - mute); + g_signal_emit_by_name (G_OBJECT (track), "mute_toggled", mute); } void -gst_mixer_record_toggled (GstMixer *mixer, - GstMixerTrack *track, - gboolean record) +gst_mixer_record_toggled (GstMixer * mixer, + GstMixerTrack * track, gboolean record) { g_signal_emit (G_OBJECT (mixer), - gst_mixer_signals[RECORD_TOGGLED], 0, - track, record); + gst_mixer_signals[RECORD_TOGGLED], 0, track, record); - g_signal_emit_by_name (G_OBJECT (track), - "record_toggled", - record); + g_signal_emit_by_name (G_OBJECT (track), "record_toggled", record); } void -gst_mixer_volume_changed (GstMixer *mixer, - GstMixerTrack *track, - gint *volumes) +gst_mixer_volume_changed (GstMixer * mixer, + GstMixerTrack * track, gint * volumes) { g_signal_emit (G_OBJECT (mixer), - gst_mixer_signals[VOLUME_CHANGED], 0, - track, volumes); + gst_mixer_signals[VOLUME_CHANGED], 0, track, volumes); - g_signal_emit_by_name (G_OBJECT (track), - "volume_changed", - volumes); + g_signal_emit_by_name (G_OBJECT (track), "volume_changed", volumes); } diff --git a/gst-libs/gst/mixer/mixer.h b/gst-libs/gst/mixer/mixer.h index 50ba3fd8..2caad164 100644 --- a/gst-libs/gst/mixer/mixer.h +++ b/gst-libs/gst/mixer/mixer.h @@ -27,7 +27,6 @@ #include <gst/mixer/mixer-enumtypes.h> G_BEGIN_DECLS - #define GST_TYPE_MIXER \ (gst_mixer_get_type ()) #define GST_MIXER(obj) \ @@ -40,9 +39,7 @@ G_BEGIN_DECLS (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER)) #define GST_MIXER_GET_CLASS(inst) \ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass)) - #define GST_MIXER_TYPE(klass) (klass->mixer_type) - typedef struct _GstMixer GstMixer; typedef enum @@ -51,70 +48,52 @@ typedef enum GST_MIXER_SOFTWARE } GstMixerType; -typedef struct _GstMixerClass { +typedef struct _GstMixerClass +{ GTypeInterface klass; GstMixerType mixer_type; - + /* virtual functions */ - const GList * (* list_tracks) (GstMixer *mixer); + const GList *(*list_tracks) (GstMixer * mixer); - void (* set_volume) (GstMixer *mixer, - GstMixerTrack *track, - gint *volumes); - void (* get_volume) (GstMixer *mixer, - GstMixerTrack *track, - gint *volumes); + void (*set_volume) (GstMixer * mixer, GstMixerTrack * track, gint * volumes); + void (*get_volume) (GstMixer * mixer, GstMixerTrack * track, gint * volumes); - void (* set_mute) (GstMixer *mixer, - GstMixerTrack *track, - gboolean mute); - void (* set_record) (GstMixer *mixer, - GstMixerTrack *track, - gboolean record); + void (*set_mute) (GstMixer * mixer, GstMixerTrack * track, gboolean mute); + void (*set_record) (GstMixer * mixer, 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); + 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); gpointer _gst_reserved[GST_PADDING]; } GstMixerClass; -GType gst_mixer_get_type (void); +GType gst_mixer_get_type (void); /* virtual class function wrappers */ -const GList * gst_mixer_list_tracks (GstMixer *mixer); -void gst_mixer_set_volume (GstMixer *mixer, - GstMixerTrack *track, - gint *volumes); -void gst_mixer_get_volume (GstMixer *mixer, - GstMixerTrack *track, - gint *volumes); -void gst_mixer_set_mute (GstMixer *mixer, - GstMixerTrack *track, - gboolean mute); -void gst_mixer_set_record (GstMixer *mixer, - GstMixerTrack *track, - gboolean record); +const GList *gst_mixer_list_tracks (GstMixer * mixer); +void gst_mixer_set_volume (GstMixer * mixer, + GstMixerTrack * track, gint * volumes); +void gst_mixer_get_volume (GstMixer * mixer, + GstMixerTrack * track, gint * volumes); +void gst_mixer_set_mute (GstMixer * mixer, + GstMixerTrack * track, gboolean mute); +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); +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__ */ diff --git a/gst-libs/gst/mixer/mixertrack.c b/gst-libs/gst/mixer/mixertrack.c index 242b5915..af52aec8 100644 --- a/gst-libs/gst/mixer/mixertrack.c +++ b/gst-libs/gst/mixer/mixertrack.c @@ -25,7 +25,8 @@ #include "mixertrack.h" -enum { +enum +{ /* FILL ME */ SIGNAL_VOLUME_CHANGED, SIGNAL_RECORD_TOGGLED, @@ -33,9 +34,9 @@ enum { LAST_SIGNAL }; -static void gst_mixer_track_class_init (GstMixerTrackClass *klass); -static void gst_mixer_track_init (GstMixerTrack *mixer); -static void gst_mixer_track_dispose (GObject *object); +static void gst_mixer_track_class_init (GstMixerTrackClass * klass); +static void gst_mixer_track_init (GstMixerTrack * mixer); +static void gst_mixer_track_dispose (GObject * object); static GObjectClass *parent_class = NULL; static guint signals[LAST_SIGNAL] = { 0 }; @@ -61,47 +62,46 @@ gst_mixer_track_get_type (void) gst_mixer_track_type = g_type_register_static (G_TYPE_OBJECT, - "GstMixerTrack", - &mixer_track_info, 0); + "GstMixerTrack", &mixer_track_info, 0); } return gst_mixer_track_type; } static void -gst_mixer_track_class_init (GstMixerTrackClass *klass) +gst_mixer_track_class_init (GstMixerTrackClass * klass) { GObjectClass *object_klass = (GObjectClass *) klass; parent_class = g_type_class_ref (G_TYPE_OBJECT); signals[SIGNAL_RECORD_TOGGLED] = - g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerTrackClass, - record_toggled), - NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, - G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerTrackClass, + record_toggled), + NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); signals[SIGNAL_MUTE_TOGGLED] = - g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerTrackClass, - mute_toggled), - NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, - G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerTrackClass, + mute_toggled), + NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); signals[SIGNAL_VOLUME_CHANGED] = - g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerTrackClass, - volume_changed), - NULL, NULL, g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); + g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerTrackClass, + volume_changed), + NULL, NULL, g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); object_klass->dispose = gst_mixer_track_dispose; } static void -gst_mixer_track_init (GstMixerTrack *channel) +gst_mixer_track_init (GstMixerTrack * channel) { channel->label = NULL; channel->min_volume = channel->max_volume = 0; @@ -110,7 +110,7 @@ gst_mixer_track_init (GstMixerTrack *channel) } static void -gst_mixer_track_dispose (GObject *object) +gst_mixer_track_dispose (GObject * object) { GstMixerTrack *channel = GST_MIXER_TRACK (object); diff --git a/gst-libs/gst/mixer/mixertrack.h b/gst-libs/gst/mixer/mixertrack.h index 0e05d9cb..872b0904 100644 --- a/gst-libs/gst/mixer/mixertrack.h +++ b/gst-libs/gst/mixer/mixertrack.h @@ -25,7 +25,6 @@ #include <gst/gst.h> G_BEGIN_DECLS - #define GST_TYPE_MIXER_TRACK \ (gst_mixer_track_get_type ()) #define GST_MIXER_TRACK(obj) \ @@ -38,7 +37,6 @@ G_BEGIN_DECLS (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_TRACK)) #define GST_IS_MIXER_TRACK_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_TRACK)) - /* * Naming: * @@ -54,45 +52,41 @@ G_BEGIN_DECLS * mixer, which means that setting this track will change * the hearable volume on any output. */ - -typedef enum { - GST_MIXER_TRACK_INPUT = (1<<0), - GST_MIXER_TRACK_OUTPUT = (1<<1), - GST_MIXER_TRACK_MUTE = (1<<2), - GST_MIXER_TRACK_RECORD = (1<<3), - GST_MIXER_TRACK_MASTER = (1<<4), - GST_MIXER_TRACK_SOFTWARE = (1<<5) + typedef enum +{ + GST_MIXER_TRACK_INPUT = (1 << 0), + GST_MIXER_TRACK_OUTPUT = (1 << 1), + GST_MIXER_TRACK_MUTE = (1 << 2), + GST_MIXER_TRACK_RECORD = (1 << 3), + GST_MIXER_TRACK_MASTER = (1 << 4), + GST_MIXER_TRACK_SOFTWARE = (1 << 5) } GstMixerTrackFlags; #define GST_MIXER_TRACK_HAS_FLAG(channel, flag) \ ((channel)->flags & flag) -typedef struct _GstMixerTrack { - GObject parent; +typedef struct _GstMixerTrack +{ + GObject parent; - gchar *label; + gchar *label; GstMixerTrackFlags flags; - gint num_channels, - min_volume, - max_volume; + gint num_channels, min_volume, max_volume; } GstMixerTrack; -typedef struct _GstMixerTrackClass { +typedef struct _GstMixerTrackClass +{ GObjectClass parent; /* signals */ - void (* mute_toggled) (GstMixerTrack *channel, - gboolean mute); - void (* record_toggled) (GstMixerTrack *channel, - gboolean record); - void (* volume_changed) (GstMixerTrack *channel, - gint *volumes); + void (*mute_toggled) (GstMixerTrack * channel, gboolean mute); + void (*record_toggled) (GstMixerTrack * channel, gboolean record); + void (*volume_changed) (GstMixerTrack * channel, gint * volumes); gpointer _gst_reserved[GST_PADDING]; } GstMixerTrackClass; -GType gst_mixer_track_get_type (void); +GType gst_mixer_track_get_type (void); G_END_DECLS - #endif /* __GST_MIXER_TRACK_H__ */ |