2003-09-13 13:42:08 +00:00
|
|
|
/* GStreamer Mixer
|
|
|
|
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2003-09-13 01:20:04 +00:00
|
|
|
*
|
|
|
|
* mixer.c: mixer design virtual class function wrappers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2003-10-10 12:24:20 +00:00
|
|
|
#include "mixer.h"
|
2004-02-03 16:49:54 +00:00
|
|
|
#include "mixer-marshal.h"
|
2003-12-07 12:11:30 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
SIGNAL_MUTE_TOGGLED,
|
|
|
|
SIGNAL_RECORD_TOGGLED,
|
|
|
|
SIGNAL_VOLUME_CHANGED,
|
|
|
|
SIGNAL_OPTION_CHANGED,
|
2003-12-07 12:11:30 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
2003-09-13 01:20:04 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void gst_mixer_class_init (GstMixerClass * klass);
|
2003-09-13 01:20:04 +00:00
|
|
|
|
2003-12-07 12:11:30 +00:00
|
|
|
static guint gst_mixer_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2003-09-13 01:20:04 +00:00
|
|
|
GType
|
|
|
|
gst_mixer_get_type (void)
|
|
|
|
{
|
|
|
|
static GType gst_mixer_type = 0;
|
|
|
|
|
|
|
|
if (!gst_mixer_type) {
|
|
|
|
static const GTypeInfo gst_mixer_info = {
|
|
|
|
sizeof (GstMixerClass),
|
|
|
|
(GBaseInitFunc) gst_mixer_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE,
|
2004-03-15 19:32:28 +00:00
|
|
|
"GstMixer", &gst_mixer_info, 0);
|
2003-09-13 01:20:04 +00:00
|
|
|
g_type_interface_add_prerequisite (gst_mixer_type,
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_TYPE_IMPLEMENTS_INTERFACE);
|
2003-09-13 01:20:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return gst_mixer_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_class_init (GstMixerClass * klass)
|
2003-09-13 01:20:04 +00:00
|
|
|
{
|
2003-12-07 12:11:30 +00:00
|
|
|
static gboolean initialized = FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-12-07 12:11:30 +00:00
|
|
|
if (!initialized) {
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
gst_mixer_signals[SIGNAL_RECORD_TOGGLED] =
|
2004-03-15 19:32:28 +00:00
|
|
|
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);
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
gst_mixer_signals[SIGNAL_MUTE_TOGGLED] =
|
2004-03-15 19:32:28 +00:00
|
|
|
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);
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
gst_mixer_signals[SIGNAL_VOLUME_CHANGED] =
|
2004-03-15 19:32:28 +00:00
|
|
|
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);
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
gst_mixer_signals[SIGNAL_OPTION_CHANGED] =
|
|
|
|
g_signal_new ("option-changed",
|
|
|
|
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstMixerClass, option_changed),
|
|
|
|
NULL, NULL,
|
|
|
|
gst_mixer_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2,
|
|
|
|
GST_TYPE_MIXER_OPTIONS, G_TYPE_STRING);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-12-07 12:11:30 +00:00
|
|
|
initialized = TRUE;
|
|
|
|
}
|
|
|
|
|
ext/alsa/gstalsamixer.c: Setting mixer interface type to HARDWARE.
Original commit message from CVS:
2004-01-15 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init): Setting
mixer interface type to HARDWARE.
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init): Adding a default
type to SOFTWARE.
* gst-libs/gst/mixer/mixer.h: Adding mixer interface type and macro.
* gst-libs/gst/mixer/mixertrack.h: Adding mixertrack flag SOFTWARE.
* gst/volume/gstvolume.c: (gst_volume_interface_supported),
(gst_volume_interface_init), (gst_volume_list_tracks),
(gst_volume_set_volume), (gst_volume_get_volume),
(gst_volume_set_mute), (gst_volume_mixer_init),
(gst_volume_dispose), (gst_volume_get_type), (volume_class_init),
(volume_init): Implementing mixer interface.
* gst/volume/gstvolume.h: Adding tracklist for mixer interface.
* sys/oss/gstosselement.c: (gst_osselement_get_type),
(gst_osselement_change_state): Removing some trailing commas in
structures.
* sys/oss/gstossmixer.c: (gst_ossmixer_interface_init): Setting mixer
interface type to HARDWARE.
* sys/v4l/gstv4lcolorbalance.c:
(gst_v4l_color_balance_interface_init): Setting colorbalance interface
type to HARDWARE.
* sys/v4l2/gstv4l2colorbalance.c:
(gst_v4l2_color_balance_interface_init): Setting colorbalance
interface type to HARDWARE.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain): use exactly the
same code than ximagesink for event handling.
2004-01-15 15:50:10 +00:00
|
|
|
klass->mixer_type = GST_MIXER_SOFTWARE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-09-13 01:20:04 +00:00
|
|
|
/* default virtual functions */
|
2003-10-09 22:02:35 +00:00
|
|
|
klass->list_tracks = NULL;
|
2003-09-13 01:20:04 +00:00
|
|
|
klass->set_volume = NULL;
|
|
|
|
klass->get_volume = NULL;
|
|
|
|
klass->set_mute = NULL;
|
|
|
|
klass->set_record = NULL;
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
klass->set_option = NULL;
|
|
|
|
klass->get_option = NULL;
|
2003-09-13 01:20:04 +00:00
|
|
|
}
|
|
|
|
|
2004-01-25 22:07:16 +00:00
|
|
|
/**
|
|
|
|
*agst_mixer_list_tracks:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) to get the tracks from.
|
|
|
|
*
|
|
|
|
* Returns a list of avialable tracks for this mixer/element. Note
|
|
|
|
* that it is allowed for sink (output) elements to only provide
|
|
|
|
* the output tracks in this list. Likewise, for sources (inputs),
|
|
|
|
* it is allowed to only provide input elements in this list.
|
|
|
|
*
|
|
|
|
* Returns: A #GList consisting of zero or more #GstMixerTracks.
|
|
|
|
*/
|
|
|
|
|
2003-09-13 01:20:04 +00:00
|
|
|
const GList *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_list_tracks (GstMixer * mixer)
|
2003-09-13 01:20:04 +00:00
|
|
|
{
|
|
|
|
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
2003-10-09 22:02:35 +00:00
|
|
|
if (klass->list_tracks) {
|
|
|
|
return klass->list_tracks (mixer);
|
2003-09-13 01:20:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-01-25 22:07:16 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_set_volume:
|
|
|
|
* @mixer: The #GstMixer (a #GstElement) that owns the track.
|
|
|
|
* @track: The #GstMixerTrack to set the volume on.
|
|
|
|
* @volumes: an array of integers (of size track->num_channels)
|
|
|
|
* that gives the wanted volume for each channel in
|
|
|
|
* this track.
|
|
|
|
*
|
|
|
|
* Sets the volume on each channel in a track. Short note about
|
|
|
|
* naming: a track is defined as one separate stream owned by
|
|
|
|
* the mixer/element, such as 'Line-in' or 'Microphone'. A
|
|
|
|
* channel is said to be a mono-stream inside this track. A
|
|
|
|
* stereo track thus contains two channels.
|
|
|
|
*/
|
|
|
|
|
2003-09-13 01:20:04 +00:00
|
|
|
void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
|
2003-09-13 01:20:04 +00:00
|
|
|
{
|
|
|
|
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
|
|
|
if (klass->set_volume) {
|
2003-10-09 22:02:35 +00:00
|
|
|
klass->set_volume (mixer, track, volumes);
|
2003-09-13 01:20:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-25 22:07:16 +00:00
|
|
|
/*
|
|
|
|
* gst_mixer_get_volume:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) that owns the track
|
|
|
|
* @track: the GstMixerTrack to get the volume from.
|
|
|
|
* @volumes: a pre-allocated array of integers (of size
|
|
|
|
* track->num_channels) to store the current volume
|
|
|
|
* of each channel in the given track in.
|
|
|
|
*
|
|
|
|
* Get the current volume(s) on the given track.
|
|
|
|
*/
|
|
|
|
|
2003-09-13 01:20:04 +00:00
|
|
|
void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
|
2003-09-13 01:20:04 +00:00
|
|
|
{
|
|
|
|
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
|
|
|
if (klass->get_volume) {
|
2003-10-09 22:02:35 +00:00
|
|
|
klass->get_volume (mixer, track, volumes);
|
2003-09-13 01:20:04 +00:00
|
|
|
} else {
|
|
|
|
gint i;
|
|
|
|
|
2003-10-09 22:02:35 +00:00
|
|
|
for (i = 0; i < track->num_channels; i++) {
|
2003-09-13 01:20:04 +00:00
|
|
|
volumes[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-25 22:07:16 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_set_mute:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) that owns the track.
|
|
|
|
* @track: the #GstMixerTrack to operate on.
|
|
|
|
* @mute: a boolean value indicating whether to turn on or off
|
|
|
|
* muting.
|
|
|
|
*
|
|
|
|
* Mutes or unmutes the given channel. To find out whether a
|
|
|
|
* track is currently muted, use GST_MIXER_TRACK_HAS_FLAG ().
|
|
|
|
*/
|
|
|
|
|
2003-09-13 01:20:04 +00:00
|
|
|
void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
|
2003-09-13 01:20:04 +00:00
|
|
|
{
|
|
|
|
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
|
|
|
if (klass->set_mute) {
|
2003-10-09 22:02:35 +00:00
|
|
|
klass->set_mute (mixer, track, mute);
|
2003-09-13 01:20:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-25 22:07:16 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_set_record:
|
|
|
|
* @mixer: The #GstMixer (a #GstElement) that owns the track.
|
|
|
|
* @track: the #GstMixerTrack to operate on.
|
|
|
|
* @record: a boolean value that indicates whether to turn on
|
|
|
|
* or off recording.
|
|
|
|
*
|
|
|
|
* Enables or disables recording on the given track. Note that
|
|
|
|
* this is only possible on input tracks, not on output tracks
|
|
|
|
* (see GST_MIXER_TRACK_HAS_FLAG () and the GST_MIXER_TRACK_INPUT
|
|
|
|
* flag).
|
|
|
|
*/
|
|
|
|
|
2003-09-13 01:20:04 +00:00
|
|
|
void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_set_record (GstMixer * mixer, GstMixerTrack * track, gboolean record)
|
2003-09-13 01:20:04 +00:00
|
|
|
{
|
|
|
|
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
|
|
|
if (klass->set_record) {
|
2003-10-09 22:02:35 +00:00
|
|
|
klass->set_record (mixer, track, record);
|
2003-09-13 01:20:04 +00:00
|
|
|
}
|
|
|
|
}
|
2003-12-07 12:11:30 +00:00
|
|
|
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_set_option:
|
|
|
|
* @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
|
|
|
|
* @opts: The #GstMixerOptions that we operate on.
|
|
|
|
* @value: The requested new option value.
|
|
|
|
*
|
|
|
|
* Sets a name/value option in the mixer to the requested value.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_mixer_set_option (GstMixer * mixer, GstMixerOptions * opts, gchar * value)
|
|
|
|
{
|
|
|
|
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
|
|
|
if (klass->set_option) {
|
|
|
|
klass->set_option (mixer, opts, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_mixer_g_option:
|
|
|
|
* @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
|
|
|
|
* @opts: The #GstMixerOptions that we operate on.
|
|
|
|
*
|
|
|
|
* Get the current value of a name/value option in the mixer.
|
|
|
|
*
|
|
|
|
* Returns: current value of the name/value option.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const gchar *
|
|
|
|
gst_mixer_get_option (GstMixer * mixer, GstMixerOptions * opts)
|
|
|
|
{
|
|
|
|
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
|
|
|
if (klass->get_option) {
|
|
|
|
return klass->get_option (mixer, opts);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-12-07 12:11:30 +00:00
|
|
|
void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_mute_toggled (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
|
2003-12-07 12:11:30 +00:00
|
|
|
{
|
|
|
|
g_signal_emit (G_OBJECT (mixer),
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
gst_mixer_signals[SIGNAL_MUTE_TOGGLED], 0, track, mute);
|
2003-12-07 12:11:30 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_emit_by_name (G_OBJECT (track), "mute_toggled", mute);
|
2003-12-07 12:11:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_record_toggled (GstMixer * mixer,
|
|
|
|
GstMixerTrack * track, gboolean record)
|
2003-12-07 12:11:30 +00:00
|
|
|
{
|
|
|
|
g_signal_emit (G_OBJECT (mixer),
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
gst_mixer_signals[SIGNAL_RECORD_TOGGLED], 0, track, record);
|
2003-12-07 12:11:30 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_emit_by_name (G_OBJECT (track), "record_toggled", record);
|
2003-12-07 12:11:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_volume_changed (GstMixer * mixer,
|
|
|
|
GstMixerTrack * track, gint * volumes)
|
2003-12-07 12:11:30 +00:00
|
|
|
{
|
|
|
|
g_signal_emit (G_OBJECT (mixer),
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
gst_mixer_signals[SIGNAL_VOLUME_CHANGED], 0, track, volumes);
|
2003-12-07 12:11:30 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_emit_by_name (G_OBJECT (track), "volume_changed", volumes);
|
2003-12-07 12:11:30 +00:00
|
|
|
}
|
ext/alsa/: Add enumerations (as GstMixerOptions). Make correct distinction between input/output tracks. Add capture/p...
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_interface_init),
(gst_alsa_mixer_build_list), (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixeroptions.c:
(gst_alsa_mixer_options_get_type),
(gst_alsa_mixer_options_class_init), (gst_alsa_mixer_options_init),
(gst_alsa_mixer_options_new):
* ext/alsa/gstalsamixeroptions.h:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_new):
* ext/alsa/gstalsamixertrack.h:
Add enumerations (as GstMixerOptions). Make correct distinction
between input/output tracks. Add capture/playback private flag.
Use flag to decide on whether to set capture or playback volumes
or switches. Use playback and record switches.
* gst-libs/gst/mixer/Makefile.am:
* gst-libs/gst/mixer/mixer-marshal.list:
* gst-libs/gst/mixer/mixer.c: (gst_mixer_class_init),
(gst_mixer_set_option), (gst_mixer_get_option),
(gst_mixer_mute_toggled), (gst_mixer_record_toggled),
(gst_mixer_volume_changed), (gst_mixer_option_changed):
* gst-libs/gst/mixer/mixer.h:
* gst-libs/gst/mixer/mixeroptions.c: (gst_mixer_options_get_type),
(gst_mixer_options_class_init), (gst_mixer_options_init),
(gst_mixer_options_dispose):
* gst-libs/gst/mixer/mixeroptions.h:
Add GstMixerOptions.
* sys/oss/gstosselement.c: (gst_osselement_class_probe_devices):
Rename Audio Mixer to OSS Mixer (similar to Alsa Mixer). Fix
broken device detection on computers with multiple OSS sound
cards.
2004-05-27 03:36:17 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gst_mixer_option_changed (GstMixer * mixer,
|
|
|
|
GstMixerOptions * opts, gchar * value)
|
|
|
|
{
|
|
|
|
g_signal_emit (G_OBJECT (mixer),
|
|
|
|
gst_mixer_signals[SIGNAL_OPTION_CHANGED], 0, opts, value);
|
|
|
|
|
|
|
|
g_signal_emit_by_name (G_OBJECT (opts), "value_changed", value);
|
|
|
|
}
|