[gst-devel] [patch] GstMixer renaming : channel -> track
Leif Johnson
leif at ambient.2y.net
Wed Oct 8 00:34:02 CEST 2003
Hi Ronald -
I took a look at the code in gst-libs/gst/mixer/ and noticed the name
confusion with channels. Lately I've been looking at some pro audio
software, and talking with the music types who use it. Seemed to me like
the confusion in the GstMixer could be cleared up by calling each stream
a `track', which consists of one or more `channels'. Have a look at the
patches (for gst-plugins and gst-mixer) and see what you think. Cheers !
leif
--
Leif Morgan Johnson : http://ambient.2y.net/leif/
-------------- next part --------------
Index: sys/oss/gstosselement.c
===================================================================
RCS file: /cvsroot/gstreamer/gst-plugins/sys/oss/gstosselement.c,v
retrieving revision 1.3
diff -u -r1.3 gstosselement.c
--- sys/oss/gstosselement.c 16 Sep 2003 10:00:02 -0000 1.3
+++ sys/oss/gstosselement.c 8 Oct 2003 07:28:19 -0000
@@ -145,7 +145,7 @@
oss->mixer_dev = g_strdup ("/dev/mixer");
oss->fd = -1;
oss->mixer_fd = -1;
- oss->channellist = NULL;
+ oss->tracklist = NULL;
gst_osselement_reset (oss);
}
Index: sys/oss/gstosselement.h
===================================================================
RCS file: /cvsroot/gstreamer/gst-plugins/sys/oss/gstosselement.h,v
retrieving revision 1.1
diff -u -r1.1 gstosselement.h
--- sys/oss/gstosselement.h 13 Sep 2003 01:22:59 -0000 1.1
+++ sys/oss/gstosselement.h 8 Oct 2003 07:28:19 -0000
@@ -76,7 +76,7 @@
gint rate;
/* mixer stuff */
- GList *channellist;
+ GList *tracklist;
guint32 stereomask,
recdevs,
recmask,
Index: sys/oss/gstossmixer.c
===================================================================
RCS file: /cvsroot/gstreamer/gst-plugins/sys/oss/gstossmixer.c,v
retrieving revision 1.3
diff -u -r1.3 gstossmixer.c
--- sys/oss/gstossmixer.c 13 Sep 2003 15:47:59 -0000 1.3
+++ sys/oss/gstossmixer.c 8 Oct 2003 07:28:20 -0000
@@ -37,60 +37,59 @@
#define MASK_BIT_IS_SET(mask, bit) \
(mask & (1 << bit))
-static gboolean gst_ossmixer_supported (GstInterface *iface,
- GType iface_type);
+static gboolean gst_ossmixer_supported (GstInterface *iface,
+ GType iface_type);
-static const GList * gst_ossmixer_list_channels (GstMixer *ossmixer);
+static const GList * gst_ossmixer_list_tracks (GstMixer *ossmixer);
-static void gst_ossmixer_set_volume (GstMixer *ossmixer,
- GstMixerChannel *channel,
- gint *volumes);
-static void gst_ossmixer_get_volume (GstMixer *ossmixer,
- GstMixerChannel *channel,
- gint *volumes);
-
-static void gst_ossmixer_set_record (GstMixer *ossmixer,
- GstMixerChannel *channel,
- gboolean record);
-static void gst_ossmixer_set_mute (GstMixer *ossmixer,
- GstMixerChannel *channel,
- gboolean mute);
+static void gst_ossmixer_set_volume (GstMixer *ossmixer,
+ GstMixerTrack *track,
+ gint *volumes);
+static void gst_ossmixer_get_volume (GstMixer *ossmixer,
+ GstMixerTrack *track,
+ gint *volumes);
+
+static void gst_ossmixer_set_record (GstMixer *ossmixer,
+ GstMixerTrack *track,
+ gboolean record);
+static void gst_ossmixer_set_mute (GstMixer *ossmixer,
+ GstMixerTrack *track,
+ gboolean mute);
static const gchar *labels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_LABELS;
-GstMixerChannel *
-gst_ossmixer_channel_new (GstOssElement *oss,
- gint channel_num,
- gint max_chans,
- gint flags)
+GstMixerTrack *
+gst_ossmixer_track_new (GstOssElement *oss,
+ gint track_num,
+ gint max_chans,
+ gint flags)
{
- GstMixerChannel *channel = (GstMixerChannel *) g_new (GstOssMixerChannel, 1);
+ GstMixerTrack *track = (GstMixerTrack *) g_new (GstOssMixerTrack, 1);
gint volumes[2];
- channel->label = g_strdup (labels[channel_num]);
- channel->num_channels = max_chans;
- channel->flags = flags;
- channel->min_volume = 0;
- channel->max_volume = 100;
- ((GstOssMixerChannel *) channel)->channel_num = channel_num;
+ track->label = g_strdup (labels[track_num]);
+ track->num_channels = max_chans;
+ track->flags = flags;
+ track->min_volume = 0;
+ track->max_volume = 100;
+ ((GstOssMixerTrack *) track)->track_num = track_num;
/* volume */
- gst_ossmixer_get_volume (GST_MIXER (oss),
- channel, volumes);
+ gst_ossmixer_get_volume (GST_MIXER (oss), track, volumes);
if (max_chans == 1) {
volumes[1] = 0;
}
- ((GstOssMixerChannel *) channel)->lvol = volumes[0];
- ((GstOssMixerChannel *) channel)->rvol = volumes[1];
+ ((GstOssMixerTrack *) track)->lvol = volumes[0];
+ ((GstOssMixerTrack *) track)->rvol = volumes[1];
- return channel;
+ return track;
}
void
-gst_ossmixer_channel_free (GstMixerChannel *channel)
+gst_ossmixer_track_free (GstMixerTrack *track)
{
- g_free (channel->label);
- g_free (channel);
+ g_free (track->label);
+ g_free (track);
}
void
@@ -104,7 +103,7 @@
gst_ossmixer_interface_init (GstMixerClass *klass)
{
/* default virtual functions */
- klass->list_channels = gst_ossmixer_list_channels;
+ klass->list_tracks = gst_ossmixer_list_tracks;
klass->set_volume = gst_ossmixer_set_volume;
klass->get_volume = gst_ossmixer_get_volume;
klass->set_mute = gst_ossmixer_set_mute;
@@ -121,136 +120,136 @@
}
static const GList *
-gst_ossmixer_list_channels (GstMixer *mixer)
+gst_ossmixer_list_tracks (GstMixer *mixer)
{
GstOssElement *oss = GST_OSSELEMENT (mixer);
g_return_val_if_fail (oss->mixer_fd != -1, NULL);
- return (const GList *) GST_OSSELEMENT (mixer)->channellist;
+ return (const GList *) GST_OSSELEMENT (mixer)->tracklist;
}
static void
-gst_ossmixer_get_volume (GstMixer *mixer,
- GstMixerChannel *channel,
- gint *volumes)
+gst_ossmixer_get_volume (GstMixer *mixer,
+ GstMixerTrack *track,
+ gint *volumes)
{
gint volume;
GstOssElement *oss = GST_OSSELEMENT (mixer);
- GstOssMixerChannel *osschannel = (GstOssMixerChannel *) channel;
+ GstOssMixerTrack *osstrack = (GstOssMixerTrack *) track;
g_return_if_fail (oss->mixer_fd != -1);
- if (channel->flags & GST_MIXER_CHANNEL_MUTE) {
- volumes[0] = osschannel->lvol;
- if (channel->num_channels == 2) {
- volumes[1] = osschannel->rvol;
+ if (track->flags & GST_MIXER_TRACK_MUTE) {
+ volumes[0] = osstrack->lvol;
+ if (track->num_channels == 2) {
+ volumes[1] = osstrack->rvol;
}
} else {
/* get */
- if (ioctl(oss->mixer_fd, MIXER_READ (osschannel->channel_num), &volume) < 0) {
+ if (ioctl(oss->mixer_fd, MIXER_READ (osstrack->track_num), &volume) < 0) {
g_warning("Error getting recording device (%d) volume (0x%x): %s\n",
- osschannel->channel_num, volume, strerror(errno));
+ osstrack->track_num, volume, strerror(errno));
volume = 0;
}
- osschannel->lvol = volumes[0] = (volume & 0xff);
- if (channel->num_channels == 2) {
- osschannel->rvol = volumes[1] = ((volume >> 8) & 0xff);
+ osstrack->lvol = volumes[0] = (volume & 0xff);
+ if (track->num_channels == 2) {
+ osstrack->rvol = volumes[1] = ((volume >> 8) & 0xff);
}
}
}
static void
-gst_ossmixer_set_volume (GstMixer *mixer,
- GstMixerChannel *channel,
- gint *volumes)
+gst_ossmixer_set_volume (GstMixer *mixer,
+ GstMixerTrack *track,
+ gint *volumes)
{
gint volume;
GstOssElement *oss = GST_OSSELEMENT (mixer);
- GstOssMixerChannel *osschannel = (GstOssMixerChannel *) channel;
+ GstOssMixerTrack *osstrack = (GstOssMixerTrack *) track;
g_return_if_fail (oss->mixer_fd != -1);
/* prepare the value for ioctl() */
- if (!(channel->flags & GST_MIXER_CHANNEL_MUTE)) {
+ if (!(track->flags & GST_MIXER_TRACK_MUTE)) {
volume = (volumes[0] & 0xff);
- if (channel->num_channels == 2) {
+ if (track->num_channels == 2) {
volume |= ((volumes[1] & 0xff) << 8);
}
/* set */
- if (ioctl(oss->mixer_fd, MIXER_WRITE (osschannel->channel_num), &volume) < 0) {
+ if (ioctl(oss->mixer_fd, MIXER_WRITE (osstrack->track_num), &volume) < 0) {
g_warning("Error setting recording device (%d) volume (0x%x): %s\n",
- osschannel->channel_num, volume, strerror(errno));
+ osstrack->track_num, volume, strerror(errno));
return;
}
}
- osschannel->lvol = volumes[0];
- if (channel->num_channels == 2) {
- osschannel->rvol = volumes[1];
+ osstrack->lvol = volumes[0];
+ if (track->num_channels == 2) {
+ osstrack->rvol = volumes[1];
}
}
static void
-gst_ossmixer_set_mute (GstMixer *mixer,
- GstMixerChannel *channel,
- gboolean mute)
+gst_ossmixer_set_mute (GstMixer *mixer,
+ GstMixerTrack *track,
+ gboolean mute)
{
int volume;
GstOssElement *oss = GST_OSSELEMENT (mixer);
- GstOssMixerChannel *osschannel = (GstOssMixerChannel *) channel;
+ GstOssMixerTrack *osstrack = (GstOssMixerTrack *) track;
g_return_if_fail (oss->mixer_fd != -1);
if (mute) {
volume = 0;
} else {
- volume = (osschannel->lvol & 0xff);
- if (MASK_BIT_IS_SET (oss->stereomask, osschannel->channel_num)) {
- volume |= ((osschannel->rvol & 0xff) << 8);
+ volume = (osstrack->lvol & 0xff);
+ if (MASK_BIT_IS_SET (oss->stereomask, osstrack->track_num)) {
+ volume |= ((osstrack->rvol & 0xff) << 8);
}
}
- if (ioctl(oss->mixer_fd, MIXER_WRITE(osschannel->channel_num), &volume) < 0) {
+ if (ioctl(oss->mixer_fd, MIXER_WRITE(osstrack->track_num), &volume) < 0) {
g_warning("Error setting mixer recording device volume (0x%x): %s",
volume, strerror(errno));
return;
}
if (mute) {
- channel->flags |= GST_MIXER_CHANNEL_MUTE;
+ track->flags |= GST_MIXER_TRACK_MUTE;
} else {
- channel->flags &= ~GST_MIXER_CHANNEL_MUTE;
+ track->flags &= ~GST_MIXER_TRACK_MUTE;
}
}
static void
-gst_ossmixer_set_record (GstMixer *mixer,
- GstMixerChannel *channel,
- gboolean record)
+gst_ossmixer_set_record (GstMixer *mixer,
+ GstMixerTrack *track,
+ gboolean record)
{
GstOssElement *oss = GST_OSSELEMENT (mixer);
- GstOssMixerChannel *osschannel = (GstOssMixerChannel *) channel;
+ GstOssMixerTrack *osstrack = (GstOssMixerTrack *) track;
g_return_if_fail (oss->mixer_fd != -1);
/* if we're exclusive, then we need to unset the current one(s) */
if (oss->mixcaps & SOUND_CAP_EXCL_INPUT) {
- GList *channel;
- for (channel = oss->channellist; channel != NULL; channel = channel->next) {
- GstMixerChannel *turn = (GstMixerChannel *) channel->data;
- turn->flags &= ~GST_MIXER_CHANNEL_RECORD;
+ GList *track;
+ for (track = oss->tracklist; track != NULL; track = track->next) {
+ GstMixerTrack *turn = (GstMixerTrack *) track->data;
+ turn->flags &= ~GST_MIXER_TRACK_RECORD;
}
oss->recdevs = 0;
}
/* set new record bit, if needed */
if (record) {
- oss->recdevs |= (1 << osschannel->channel_num);
+ oss->recdevs |= (1 << osstrack->track_num);
} else {
- oss->recdevs &= ~(1 << osschannel->channel_num);
+ oss->recdevs &= ~(1 << osstrack->track_num);
}
/* set it to the device */
@@ -261,9 +260,9 @@
}
if (record) {
- channel->flags |= GST_MIXER_CHANNEL_RECORD;
+ track->flags |= GST_MIXER_TRACK_RECORD;
} else {
- channel->flags &= ~GST_MIXER_CHANNEL_RECORD;
+ track->flags &= ~GST_MIXER_TRACK_RECORD;
}
}
@@ -288,13 +287,13 @@
ioctl (oss->mixer_fd, SOUND_MIXER_READ_DEVMASK, &devmask);
ioctl (oss->mixer_fd, SOUND_MIXER_READ_CAPS, &oss->mixcaps);
- /* build channel list */
+ /* build track list */
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
if (devmask & (1 << i)) {
- GstMixerChannel *channel;
+ GstMixerTrack *track;
gboolean input = FALSE, stereo = FALSE, record = FALSE;
- /* channel exists, make up capabilities */
+ /* track exists, make up capabilities */
if (MASK_BIT_IS_SET (oss->stereomask, i))
stereo = TRUE;
if (MASK_BIT_IS_SET (oss->recmask, i))
@@ -302,12 +301,12 @@
if (MASK_BIT_IS_SET (oss->recdevs, i))
record = TRUE;
- /* add channel to list */
- channel = gst_ossmixer_channel_new (oss, i, stereo ? 2 : 1,
- (record ? GST_MIXER_CHANNEL_RECORD : 0) |
- (input ? GST_MIXER_CHANNEL_INPUT :
- GST_MIXER_CHANNEL_OUTPUT));
- oss->channellist = g_list_append (oss->channellist, channel);
+ /* add track to list */
+ track = gst_ossmixer_track_new (oss, i, stereo ? 2 : 1,
+ (record ? GST_MIXER_TRACK_RECORD : 0) |
+ (input ? GST_MIXER_TRACK_INPUT :
+ GST_MIXER_TRACK_OUTPUT));
+ oss->tracklist = g_list_append (oss->tracklist, track);
}
}
}
@@ -317,9 +316,9 @@
{
g_return_if_fail (oss->mixer_fd != -1);
- g_list_foreach (oss->channellist, (GFunc) gst_ossmixer_channel_free, NULL);
- g_list_free (oss->channellist);
- oss->channellist = NULL;
+ g_list_foreach (oss->tracklist, (GFunc) gst_ossmixer_track_free, NULL);
+ g_list_free (oss->tracklist);
+ oss->tracklist = NULL;
close (oss->mixer_fd);
oss->mixer_fd = -1;
Index: sys/oss/gstossmixer.h
===================================================================
RCS file: /cvsroot/gstreamer/gst-plugins/sys/oss/gstossmixer.h,v
retrieving revision 1.2
diff -u -r1.2 gstossmixer.h
--- sys/oss/gstossmixer.h 13 Sep 2003 13:42:09 -0000 1.2
+++ sys/oss/gstossmixer.h 8 Oct 2003 07:28:20 -0000
@@ -28,11 +28,11 @@
G_BEGIN_DECLS
-typedef struct _GstOssMixerChannel {
- GstMixerChannel parent;
- gint lvol, rvol;
- gint channel_num;
-} GstOssMixerChannel;
+typedef struct _GstOssMixerTrack {
+ GstMixerTrack parent;
+ gint lvol, rvol;
+ gint track_num;
+} GstOssMixerTrack;
void gst_ossmixer_interface_init (GstMixerClass *klass);
void gst_oss_interface_init (GstInterfaceClass *klass);
Index: gst-libs/gst/mixer/mixer.c
===================================================================
RCS file: /cvsroot/gstreamer/gst-plugins/gst-libs/gst/mixer/mixer.c,v
retrieving revision 1.2
diff -u -r1.2 mixer.c
--- gst-libs/gst/mixer/mixer.c 13 Sep 2003 13:42:08 -0000 1.2
+++ gst-libs/gst/mixer/mixer.c 8 Oct 2003 07:28:20 -0000
@@ -59,7 +59,7 @@
gst_mixer_class_init (GstMixerClass *klass)
{
/* default virtual functions */
- klass->list_channels = NULL;
+ klass->list_tracks = NULL;
klass->set_volume = NULL;
klass->get_volume = NULL;
klass->set_mute = NULL;
@@ -67,67 +67,67 @@
}
const GList *
-gst_mixer_list_channels (GstMixer *mixer)
+gst_mixer_list_tracks (GstMixer *mixer)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
- if (klass->list_channels) {
- return klass->list_channels (mixer);
+ if (klass->list_tracks) {
+ return klass->list_tracks (mixer);
}
return NULL;
}
void
-gst_mixer_set_volume (GstMixer *mixer,
- GstMixerChannel *channel,
- gint *volumes)
+gst_mixer_set_volume (GstMixer *mixer,
+ GstMixerTrack *track,
+ gint *volumes)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->set_volume) {
- klass->set_volume (mixer, channel, volumes);
+ klass->set_volume (mixer, track, volumes);
}
}
void
-gst_mixer_get_volume (GstMixer *mixer,
- GstMixerChannel *channel,
- gint *volumes)
+gst_mixer_get_volume (GstMixer *mixer,
+ GstMixerTrack *track,
+ gint *volumes)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->get_volume) {
- klass->get_volume (mixer, channel, volumes);
+ klass->get_volume (mixer, track, volumes);
} else {
gint i;
- for (i = 0; i < channel->num_channels; i++) {
+ for (i = 0; i < track->num_channels; i++) {
volumes[i] = 0;
}
}
}
void
-gst_mixer_set_mute (GstMixer *mixer,
- GstMixerChannel *channel,
- gboolean mute)
+gst_mixer_set_mute (GstMixer *mixer,
+ GstMixerTrack *track,
+ gboolean mute)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->set_mute) {
- klass->set_mute (mixer, channel, mute);
+ klass->set_mute (mixer, track, mute);
}
}
void
-gst_mixer_set_record (GstMixer *mixer,
- GstMixerChannel *channel,
- gboolean record)
+gst_mixer_set_record (GstMixer *mixer,
+ GstMixerTrack *track,
+ gboolean record)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->set_record) {
- klass->set_record (mixer, channel, record);
+ klass->set_record (mixer, track, record);
}
}
Index: gst-libs/gst/mixer/mixer.h
===================================================================
RCS file: /cvsroot/gstreamer/gst-plugins/gst-libs/gst/mixer/mixer.h,v
retrieving revision 1.2
diff -u -r1.2 mixer.h
--- gst-libs/gst/mixer/mixer.h 13 Sep 2003 13:42:08 -0000 1.2
+++ gst-libs/gst/mixer/mixer.h 8 Oct 2003 07:28:20 -0000
@@ -39,27 +39,33 @@
#define GST_MIXER_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass))
-/* I fully realise that this naming being used here is confusing.
- * A channel is referred to both as the number of simultaneous
- * sound streams the input can handle as well as the in-/output
- * itself. We need to fix this some day, I just cannot come up
- * with something better.
+/* In this interface, a `track' is a unit of recording or playback, pretty much
+ * equivalent to what comes in or goes out through a GstPad. Each track can have
+ * one or more `channels', which are logical parts of the track. A `stereo
+ * track', then, would be one stream with two channels, while a `mono track'
+ * would be a stream with a single channel. More complex examples are possible
+ * as well ; for example, professional audio hardware might handle audio tracks
+ * with 8 or 16 channels each.
+ *
+ * All these are audio terms. I don't know exactly what this would translate to
+ * for video, but a track might be an entire video stream, and a channel might
+ * be the information for one of the colors in the stream.
*/
-#define GST_MIXER_CHANNEL_INPUT (1<<0)
-#define GST_MIXER_CHANNEL_OUTPUT (1<<1)
-#define GST_MIXER_CHANNEL_MUTE (1<<2)
-#define GST_MIXER_CHANNEL_RECORD (1<<3)
+#define GST_MIXER_TRACK_INPUT (1<<0)
+#define GST_MIXER_TRACK_OUTPUT (1<<1)
+#define GST_MIXER_TRACK_MUTE (1<<2)
+#define GST_MIXER_TRACK_RECORD (1<<3)
-typedef struct _GstMixerChannel {
+typedef struct _GstMixerTrack {
gchar *label;
gint num_channels,
flags,
min_volume, max_volume;
-} GstMixerChannel;
+} GstMixerTrack;
-#define GST_MIXER_CHANNEL_HAS_FLAG(channel, flag) \
- ((channel)->flags & flag)
+#define GST_MIXER_TRACK_HAS_FLAG(track, flag) \
+ ((track)->flags & flag)
typedef struct _GstMixer GstMixer;
@@ -67,39 +73,39 @@
GTypeInterface klass;
/* virtual functions */
- const GList * (* list_channels) (GstMixer *mixer);
+ const GList * (* list_tracks) (GstMixer *mixer);
- void (* set_volume) (GstMixer *mixer,
- GstMixerChannel *channel,
- gint *volumes);
- void (* get_volume) (GstMixer *mixer,
- GstMixerChannel *channel,
- gint *volumes);
-
- void (* set_mute) (GstMixer *mixer,
- GstMixerChannel *channel,
- gboolean mute);
- void (* set_record) (GstMixer *mixer,
- GstMixerChannel *channel,
- gboolean record);
+ 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);
} GstMixerClass;
GType gst_mixer_get_type (void);
/* virtual class function wrappers */
-const GList * gst_mixer_list_channels (GstMixer *mixer);
-void gst_mixer_set_volume (GstMixer *mixer,
- GstMixerChannel *channel,
- gint *volumes);
-void gst_mixer_get_volume (GstMixer *mixer,
- GstMixerChannel *channel,
- gint *volumes);
-void gst_mixer_set_mute (GstMixer *mixer,
- GstMixerChannel *channel,
- gboolean mute);
-void gst_mixer_set_record (GstMixer *mixer,
- GstMixerChannel *channel,
- 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);
G_END_DECLS
-------------- next part --------------
? ChangeLog
? aclocal.m4
? autom4te.cache
? autoregen.sh
? compile
? config.guess
? config.h
? config.h.in
? config.log
? config.status
? config.sub
? configure
? depcomp
? gst-libs
? gst-mixer.spec
? install-sh
? libtool
? ltmain.sh
? missing
? mkinstalldirs
? stamp-h.in
? stamp-h1
? tracks-renaming.patch
? src/gst-mixer
Index: src/mixer.c
===================================================================
RCS file: /cvsroot/gstreamer/gst-sandbox/gst-mixer/src/mixer.c,v
retrieving revision 1.1
diff -u -r1.1 mixer.c
--- src/mixer.c 13 Sep 2003 01:47:23 -0000 1.1
+++ src/mixer.c 8 Oct 2003 07:26:37 -0000
@@ -30,7 +30,7 @@
typedef struct _MixerControls {
GstMixer *mixer;
- GstMixerChannel *channel;
+ GstMixerTrack *track;
GList *adjustments;
GtkWidget *lock, *mute, *record;
} MixerControls;
@@ -49,7 +49,7 @@
volumes[i++] = -gtk_adjustment_get_value (adj);
}
- gst_mixer_set_volume (ctrl->mixer, ctrl->channel, volumes);
+ gst_mixer_set_volume (ctrl->mixer, ctrl->track, volumes);
g_free (volumes);
}
@@ -65,7 +65,7 @@
cb_mute_toggled (GtkWidget *button,
MixerControls *ctrl)
{
- gst_mixer_set_mute (ctrl->mixer, ctrl->channel,
+ gst_mixer_set_mute (ctrl->mixer, ctrl->track,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
}
@@ -73,15 +73,15 @@
cb_record_toggled (GtkWidget *button,
MixerControls *ctrl)
{
- gst_mixer_set_record (ctrl->mixer, ctrl->channel,
+ gst_mixer_set_record (ctrl->mixer, ctrl->track,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
}
static void
-create_channel_widget (GstMixer *mixer,
- GtkWidget *table,
- gint column_pos,
- GstMixerChannel *channel)
+create_track_widget (GstMixer *mixer,
+ GtkWidget *table,
+ gint column_pos,
+ GstMixerTrack *track)
{
GtkWidget *label, *slider, *button;
GtkObject *adj;
@@ -89,24 +89,24 @@
GList *adjlist = NULL;
MixerControls *ctrl = g_new0 (MixerControls, 1);
- volumes = g_malloc (sizeof (gint) * channel->num_channels);
+ volumes = g_malloc (sizeof (gint) * track->num_channels);
ctrl->mixer = mixer;
- ctrl->channel = channel;
+ ctrl->track = track;
/* first: a label */
- label = gtk_label_new (channel->label);
+ label = gtk_label_new (track->label);
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_table_attach_defaults (GTK_TABLE (table), label,
- column_pos, column_pos + channel->num_channels,
+ column_pos, column_pos + track->num_channels,
0, 1);
- /* now sliders for each of the channels (man, this naming sucks) */
- gst_mixer_get_volume (mixer, channel, volumes);
- for (i = 0; i < channel->num_channels; i++) {
+ /* now sliders for each of the channels in the track */
+ gst_mixer_get_volume (mixer, track, volumes);
+ for (i = 0; i < track->num_channels; i++) {
adj = gtk_adjustment_new (-volumes[i],
- -channel->max_volume, -channel->min_volume,
+ -track->max_volume, -track->min_volume,
1.0, 1.0, 0.0);
adjlist = g_list_append (adjlist, (gpointer) adj);
g_signal_connect (G_OBJECT (adj), "value_changed",
@@ -122,10 +122,10 @@
ctrl->adjustments = adjlist;
/* buttons (lock, mute, rec) */
- if (channel->num_channels > 1) {
+ if (track->num_channels > 1) {
button = gtk_check_button_new_with_label ("Lock");
gtk_table_attach_defaults (GTK_TABLE (table), button,
- column_pos, column_pos + channel->num_channels,
+ column_pos, column_pos + track->num_channels,
2, 3);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
ctrl->lock = button;
@@ -135,21 +135,21 @@
button = gtk_check_button_new_with_label ("Mute");
gtk_table_attach_defaults (GTK_TABLE (table), button,
- column_pos, column_pos + channel->num_channels,
+ column_pos, column_pos + track->num_channels,
3, 4);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
- channel->flags & GST_MIXER_CHANNEL_MUTE);
+ track->flags & GST_MIXER_TRACK_MUTE);
g_signal_connect (G_OBJECT (button), "toggled",
G_CALLBACK (cb_mute_toggled), (gpointer) ctrl);
ctrl->mute = button;
- if (channel->flags & GST_MIXER_CHANNEL_INPUT) {
+ if (track->flags & GST_MIXER_TRACK_INPUT) {
button = gtk_check_button_new_with_label ("Rec.");
gtk_table_attach_defaults (GTK_TABLE (table), button,
- column_pos, column_pos + channel->num_channels,
+ column_pos, column_pos + track->num_channels,
4, 5);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
- channel->flags & GST_MIXER_CHANNEL_RECORD);
+ track->flags & GST_MIXER_TRACK_RECORD);
g_signal_connect (G_OBJECT (button), "toggled",
G_CALLBACK (cb_record_toggled), (gpointer) ctrl);
ctrl->record = button;
@@ -173,7 +173,7 @@
gint tablepos = 0;
GstElement *element;
GstMixer *mixer;
- const GList *channels;
+ const GList *tracks;
struct poptOption options[] = {
{NULL, '\0', POPT_ARG_INCLUDE_TABLE, NULL, 0, "GStreamer", NULL},
POPT_TABLEEND
@@ -202,20 +202,20 @@
mixer = GST_MIXER (element);
/* create mixer widgets and add them to the window */
- channels = gst_mixer_list_channels (mixer);
- for ( ; channels != NULL; channels = channels->next) {
- tablepos += ((GstMixerChannel *) channels->data)->num_channels;
- if (channels->next != NULL)
+ tracks = gst_mixer_list_tracks (mixer);
+ for ( ; tracks != NULL; tracks = tracks->next) {
+ tablepos += ((GstMixerTrack *) tracks->data)->num_channels;
+ if (tracks->next != NULL)
tablepos++;
}
table = gtk_table_new (5, tablepos, FALSE);
tablepos = 0;
- channels = gst_mixer_list_channels (mixer);
- for ( ; channels != NULL; channels = channels->next) {
- create_channel_widget (mixer, table, tablepos,
- (GstMixerChannel *) channels->data);
- tablepos += ((GstMixerChannel *) channels->data)->num_channels;
- if (channels->next != NULL) {
+ tracks = gst_mixer_list_tracks (mixer);
+ for ( ; tracks != NULL; tracks = tracks->next) {
+ create_track_widget (mixer, table, tablepos,
+ (GstMixerTrack *) tracks->data);
+ tablepos += ((GstMixerTrack *) tracks->data)->num_channels;
+ if (tracks->next != NULL) {
GtkWidget *sep = gtk_vseparator_new ();
gtk_table_attach_defaults (GTK_TABLE (table), sep,
tablepos, tablepos+1, 0, 5);
More information about the gstreamer-devel
mailing list