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"
|
2005-06-30 11:58:40 +00:00
|
|
|
#include "interfaces-marshal.h"
|
2003-12-07 12:11:30 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
#define GST_MIXER_MESSAGE_NAME "gst-mixer-message"
|
|
|
|
|
2006-06-07 11:03:03 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstmixer
|
|
|
|
* @short_description: Interface for elements that provide mixer operations
|
2009-12-12 18:58:39 +00:00
|
|
|
* @see_also: alsamixer, oss4mixer, sunaudiomixer
|
|
|
|
*
|
|
|
|
* Basic interface for hardware mixer controls.
|
|
|
|
*
|
|
|
|
* Applications rarely need to use this interface, it is provided mainly
|
|
|
|
* for system-level mixer applets and the like. Volume control in playback
|
|
|
|
* applications should be done using a <classname>volume</classname>
|
|
|
|
* element or, if available, using the <quote>volume</quote> property of
|
|
|
|
* the audio sink element used (as provided by <classname>pulsesink</classname>
|
|
|
|
* for example), or even better: just use the <classname>playbin2</classname>
|
|
|
|
* element's <quote>volume</quote> property.
|
|
|
|
*
|
|
|
|
* Usage: In order to use the <classname>GstMixer</classname> interface, the
|
|
|
|
* element needs to be at least in READY state (so that the element has opened
|
|
|
|
* the mixer device). Once the element has been set to READY state or higher,
|
|
|
|
* it can be cast to a <classname>GstMixer</classname> using the GST_MIXER
|
|
|
|
* macro (in C) and the mixer API can be used.
|
2006-06-07 11:03:03 +00:00
|
|
|
*/
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
#ifndef GST_DISABLE_DEPRECATED
|
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
|
|
|
|
2003-12-07 12:11:30 +00:00
|
|
|
static guint gst_mixer_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static void gst_mixer_class_init (GstMixerClass * klass);
|
|
|
|
|
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
|
|
|
{
|
2007-07-21 09:21:12 +00:00
|
|
|
#ifndef GST_DISABLE_DEPRECATED
|
2003-12-07 12:11:30 +00:00
|
|
|
static gboolean initialized = FALSE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
/* signals (deprecated) */
|
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,
|
2005-06-30 11:58:40 +00:00
|
|
|
gst_interfaces_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
|
2004-03-15 19:32:28 +00:00
|
|
|
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,
|
2005-06-30 11:58:40 +00:00
|
|
|
gst_interfaces_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
|
2004-03-15 19:32:28 +00:00
|
|
|
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,
|
2005-06-30 11:58:40 +00:00
|
|
|
gst_interfaces_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2,
|
2004-03-15 19:32:28 +00:00
|
|
|
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,
|
2005-06-30 11:58:40 +00:00
|
|
|
gst_interfaces_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2,
|
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_TYPE_MIXER_OPTIONS, G_TYPE_STRING);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-12-07 12:11:30 +00:00
|
|
|
initialized = TRUE;
|
|
|
|
}
|
2007-07-21 09:21:12 +00:00
|
|
|
#endif
|
2003-12-07 12:11:30 +00:00
|
|
|
|
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
|
|
|
/**
|
2004-11-25 12:52:24 +00:00
|
|
|
* gst_mixer_list_tracks:
|
2004-01-25 22:07:16 +00:00
|
|
|
* @mixer: the #GstMixer (a #GstElement) to get the tracks from.
|
|
|
|
*
|
2004-11-25 12:54:24 +00:00
|
|
|
* Returns a list of available tracks for this mixer/element. Note
|
2004-01-25 22:07:16 +00:00
|
|
|
* 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.
|
2009-01-09 17:17:50 +00:00
|
|
|
* The list is owned by the #GstMixer instance and must not be freed
|
|
|
|
* or modified.
|
2004-01-25 22:07:16 +00:00
|
|
|
*/
|
|
|
|
|
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
|
|
|
{
|
2006-10-13 08:57:52 +00:00
|
|
|
GstMixerClass *klass;
|
|
|
|
|
|
|
|
g_return_val_if_fail (mixer != NULL, NULL);
|
|
|
|
|
|
|
|
klass = GST_MIXER_GET_CLASS (mixer);
|
2003-09-13 01:20:04 +00:00
|
|
|
|
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
|
|
|
{
|
2006-10-13 08:57:52 +00:00
|
|
|
GstMixerClass *klass;
|
|
|
|
|
|
|
|
g_return_if_fail (mixer != NULL);
|
|
|
|
g_return_if_fail (track != NULL);
|
|
|
|
g_return_if_fail (volumes != NULL);
|
|
|
|
|
|
|
|
klass = GST_MIXER_GET_CLASS (mixer);
|
2003-09-13 01:20:04 +00:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
rename utils to pbutils
Original commit message from CVS:
* configure.ac:
* docs/libs/gst-plugins-base-libs-docs.sgml:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/Makefile.am:
* gst-libs/gst/interfaces/mixer.c:
* gst-libs/gst/pbutils/Makefile.am:
* gst-libs/gst/pbutils/descriptions.c:
(gst_pb_utils_get_source_description),
(gst_pb_utils_get_sink_description),
(gst_pb_utils_get_decoder_description),
(gst_pb_utils_get_encoder_description),
(gst_pb_utils_get_element_description),
(gst_pb_utils_add_codec_description_to_tag_list),
(gst_pb_utils_get_codec_description), (gst_pb_utils_list_all):
* gst-libs/gst/pbutils/descriptions.h:
* gst-libs/gst/pbutils/install-plugins.c:
* gst-libs/gst/pbutils/install-plugins.h:
* gst-libs/gst/pbutils/missing-plugins.c:
(gst_missing_uri_source_message_new),
(gst_missing_uri_sink_message_new),
(gst_missing_element_message_new),
(gst_missing_decoder_message_new),
(gst_missing_encoder_message_new),
(gst_missing_plugin_message_get_description):
* gst-libs/gst/pbutils/missing-plugins.h:
* gst-libs/gst/pbutils/pbutils.c: (gst_pb_utils_init):
* gst-libs/gst/pbutils/pbutils.h:
* gst-libs/gst/utils/Makefile.am:
* gst-libs/gst/utils/base-utils.c:
* gst-libs/gst/utils/base-utils.h:
* gst-libs/gst/utils/descriptions.c:
* gst-libs/gst/utils/descriptions.h:
* gst-libs/gst/utils/install-plugins.c:
* gst-libs/gst/utils/install-plugins.h:
* gst-libs/gst/utils/missing-plugins.c:
* gst-libs/gst/utils/missing-plugins.h:
* gst-plugins-base.spec.in:
* gst/playback/Makefile.am:
* gst/playback/gstdecodebin.c:
* gst/playback/gstdecodebin2.c:
* gst/playback/gstplaybasebin.c: (setup_subtitle),
(gen_source_element):
* gst/playback/gstplaybin.c: (plugin_init):
* tests/check/Makefile.am:
* tests/check/libs/pbutils.c: (GST_START_TEST),
(test_pb_utils_install_plugins_do_callout), (libgstpbutils_suite):
* tests/check/libs/utils.c:
rename utils to pbutils
2007-03-04 23:39:51 +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
|
|
|
{
|
2006-10-13 08:57:52 +00:00
|
|
|
GstMixerClass *klass;
|
|
|
|
|
|
|
|
g_return_if_fail (mixer != NULL);
|
|
|
|
g_return_if_fail (track != NULL);
|
|
|
|
g_return_if_fail (volumes != NULL);
|
|
|
|
|
|
|
|
klass = GST_MIXER_GET_CLASS (mixer);
|
2003-09-13 01:20:04 +00:00
|
|
|
|
|
|
|
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
|
|
|
{
|
2006-10-13 08:57:52 +00:00
|
|
|
GstMixerClass *klass;
|
|
|
|
|
|
|
|
g_return_if_fail (mixer != NULL);
|
|
|
|
g_return_if_fail (track != NULL);
|
|
|
|
|
|
|
|
klass = GST_MIXER_GET_CLASS (mixer);
|
2003-09-13 01:20:04 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2006-10-13 08:57:52 +00:00
|
|
|
GstMixerClass *klass;
|
|
|
|
|
|
|
|
g_return_if_fail (mixer != NULL);
|
|
|
|
g_return_if_fail (opts != NULL);
|
|
|
|
|
|
|
|
klass = GST_MIXER_GET_CLASS (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
|
|
|
|
|
|
|
if (klass->set_option) {
|
|
|
|
klass->set_option (mixer, opts, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-06-01 20:08:52 +00:00
|
|
|
* gst_mixer_get_option:
|
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
|
|
|
* @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)
|
|
|
|
{
|
2006-10-13 08:57:52 +00:00
|
|
|
GstMixerClass *klass;
|
|
|
|
|
|
|
|
g_return_val_if_fail (mixer != NULL, NULL);
|
|
|
|
g_return_val_if_fail (opts != NULL, NULL);
|
|
|
|
|
|
|
|
klass = GST_MIXER_GET_CLASS (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
|
|
|
|
|
|
|
if (klass->get_option) {
|
|
|
|
return klass->get_option (mixer, opts);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-05-10 15:25:58 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_get_mixer_type:
|
|
|
|
* @mixer: The #GstMixer implementation
|
|
|
|
*
|
|
|
|
* Get the #GstMixerType of this mixer implementation.
|
|
|
|
*
|
|
|
|
* Returns: A the #GstMixerType.
|
|
|
|
*
|
|
|
|
* Since: 0.10.24
|
|
|
|
*/
|
|
|
|
GstMixerType
|
|
|
|
gst_mixer_get_mixer_type (GstMixer * mixer)
|
|
|
|
{
|
|
|
|
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
|
|
|
return klass->mixer_type;
|
|
|
|
}
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_get_mixer_flags:
|
|
|
|
* @mixer: The #GstMixer implementation
|
|
|
|
*
|
|
|
|
* Get the set of supported flags for this mixer implementation.
|
|
|
|
*
|
|
|
|
* Returns: A set of or-ed GstMixerFlags for supported features.
|
|
|
|
*/
|
|
|
|
GstMixerFlags
|
|
|
|
gst_mixer_get_mixer_flags (GstMixer * mixer)
|
|
|
|
{
|
|
|
|
GstMixerClass *klass;
|
|
|
|
|
|
|
|
g_return_val_if_fail (mixer != NULL, FALSE);
|
|
|
|
klass = GST_MIXER_GET_CLASS (mixer);
|
|
|
|
|
|
|
|
if (klass->get_mixer_flags) {
|
|
|
|
return klass->get_mixer_flags (mixer);
|
|
|
|
}
|
|
|
|
return GST_MIXER_FLAG_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_mixer_mute_toggled:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) that owns the track
|
|
|
|
* @track: the GstMixerTrack that has change mute state.
|
|
|
|
* @mute: the new state of the mute flag on the track
|
|
|
|
*
|
|
|
|
* This function is called by the mixer implementation to produce
|
|
|
|
* a notification message on the bus indicating that the given track
|
|
|
|
* has changed mute state.
|
|
|
|
*
|
|
|
|
* This function only works for GstElements that are implementing the
|
|
|
|
* GstMixer interface, and the element needs to have been provided a bus.
|
|
|
|
*/
|
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
|
|
|
{
|
2007-07-21 09:21:12 +00:00
|
|
|
GstStructure *s;
|
|
|
|
GstMessage *m;
|
|
|
|
|
2006-10-13 08:57:52 +00:00
|
|
|
g_return_if_fail (mixer != NULL);
|
2007-07-21 09:21:12 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (mixer));
|
2006-10-13 08:57:52 +00:00
|
|
|
g_return_if_fail (track != NULL);
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
|
|
|
|
"type", G_TYPE_STRING, "mute-toggled",
|
|
|
|
"track", GST_TYPE_MIXER_TRACK, track, "mute", G_TYPE_BOOLEAN, mute, NULL);
|
2003-12-07 12:11:30 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
m = gst_message_new_element (GST_OBJECT (mixer), s);
|
|
|
|
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
|
|
|
|
GST_WARNING ("This element has no bus, therefore no message sent!");
|
|
|
|
}
|
2003-12-07 12:11:30 +00:00
|
|
|
}
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_record_toggled:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) that owns the track
|
|
|
|
* @track: the GstMixerTrack that has changed recording state.
|
|
|
|
* @record: the new state of the record flag on the track
|
|
|
|
*
|
|
|
|
* This function is called by the mixer implementation to produce
|
|
|
|
* a notification message on the bus indicating that the given track
|
|
|
|
* has changed recording state.
|
|
|
|
*
|
|
|
|
* This function only works for GstElements that are implementing the
|
|
|
|
* GstMixer interface, and the element needs to have been provided a bus.
|
|
|
|
*/
|
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
|
|
|
{
|
2007-07-21 09:21:12 +00:00
|
|
|
GstStructure *s;
|
|
|
|
GstMessage *m;
|
|
|
|
|
2006-10-13 08:57:52 +00:00
|
|
|
g_return_if_fail (mixer != NULL);
|
2007-07-21 09:21:12 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (mixer));
|
2006-10-13 08:57:52 +00:00
|
|
|
g_return_if_fail (track != NULL);
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
|
|
|
|
"type", G_TYPE_STRING, "record-toggled",
|
|
|
|
"track", GST_TYPE_MIXER_TRACK, track,
|
|
|
|
"record", G_TYPE_BOOLEAN, record, NULL);
|
2003-12-07 12:11:30 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
m = gst_message_new_element (GST_OBJECT (mixer), s);
|
|
|
|
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
|
|
|
|
GST_WARNING ("This element has no bus, therefore no message sent!");
|
|
|
|
}
|
2003-12-07 12:11:30 +00:00
|
|
|
}
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_volume_changed:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) that owns the track
|
|
|
|
* @track: the GstMixerTrack that has changed.
|
|
|
|
* @volumes: Array of volume values, one per channel on the mixer track.
|
|
|
|
*
|
|
|
|
* This function is called by the mixer implementation to produce
|
|
|
|
* a notification message on the bus indicating that the volume(s) for the
|
|
|
|
* given track have changed.
|
|
|
|
*
|
|
|
|
* This function only works for GstElements that are implementing the
|
|
|
|
* GstMixer interface, and the element needs to have been provided a bus.
|
|
|
|
*/
|
2003-12-07 12:11:30 +00:00
|
|
|
void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_mixer_volume_changed (GstMixer * mixer,
|
Revert commits towards #152864 made so far. We'll pick it up again after the 0.10.13 release.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_ensure_track_list),
(gst_alsa_mixer_free), (gst_alsa_mixer_update),
(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/gstalsamixerelement.c:
(gst_alsa_mixer_element_interface_supported),
(gst_alsa_mixer_element_finalize), (gst_alsa_mixer_element_init),
(gst_alsa_mixer_element_set_property),
(gst_alsa_mixer_element_get_property),
(gst_alsa_mixer_element_change_state):
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_update):
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_volume_changed),
(gst_mixer_option_changed):
* gst-libs/gst/interfaces/mixer.h:
Revert commits towards #152864 made so far. We'll pick it up again
after the 0.10.13 release.
2007-05-25 10:07:26 +00:00
|
|
|
GstMixerTrack * track, gint * volumes)
|
2003-12-07 12:11:30 +00:00
|
|
|
{
|
2007-07-21 09:21:12 +00:00
|
|
|
GstStructure *s;
|
|
|
|
GstMessage *m;
|
|
|
|
GValue l = { 0, };
|
|
|
|
GValue v = { 0, };
|
|
|
|
gint i;
|
|
|
|
|
2006-10-13 08:57:52 +00:00
|
|
|
g_return_if_fail (mixer != NULL);
|
2007-07-21 09:21:12 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (mixer));
|
2006-10-13 08:57:52 +00:00
|
|
|
g_return_if_fail (track != NULL);
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
|
|
|
|
"type", G_TYPE_STRING, "volume-changed",
|
|
|
|
"track", GST_TYPE_MIXER_TRACK, track, NULL);
|
2003-12-07 12:11:30 +00:00
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
g_value_init (&l, GST_TYPE_ARRAY);
|
|
|
|
|
|
|
|
g_value_init (&v, G_TYPE_INT);
|
|
|
|
|
|
|
|
/* FIXME 0.11: pass track->num_channels to the function */
|
|
|
|
for (i = 0; i < track->num_channels; ++i) {
|
|
|
|
g_value_set_int (&v, volumes[i]);
|
|
|
|
gst_value_array_append_value (&l, &v);
|
|
|
|
}
|
|
|
|
g_value_unset (&v);
|
|
|
|
|
|
|
|
gst_structure_set_value (s, "volumes", &l);
|
|
|
|
g_value_unset (&l);
|
|
|
|
|
|
|
|
m = gst_message_new_element (GST_OBJECT (mixer), s);
|
|
|
|
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
|
|
|
|
GST_WARNING ("This element has no bus, therefore no message sent!");
|
|
|
|
}
|
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
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_option_changed:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) that owns the options
|
|
|
|
* @opts: the GstMixerOptions that has changed value.
|
|
|
|
* @value: the new value of the GstMixerOptions.
|
|
|
|
*
|
|
|
|
* This function is called by the mixer implementation to produce
|
|
|
|
* a notification message on the bus indicating that the given options
|
|
|
|
* object has changed state.
|
|
|
|
*
|
|
|
|
* This function only works for GstElements that are implementing the
|
|
|
|
* GstMixer interface, and the element needs to have been provided a bus.
|
|
|
|
*/
|
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,
|
2010-03-15 21:49:53 +00:00
|
|
|
GstMixerOptions * opts, const gchar * value)
|
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
|
|
|
{
|
2007-07-21 09:21:12 +00:00
|
|
|
GstStructure *s;
|
|
|
|
GstMessage *m;
|
|
|
|
|
2006-10-13 08:57:52 +00:00
|
|
|
g_return_if_fail (mixer != NULL);
|
2007-07-21 09:21:12 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (mixer));
|
2006-10-13 08:57:52 +00:00
|
|
|
g_return_if_fail (opts != NULL);
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
|
|
|
|
"type", G_TYPE_STRING, "option-changed",
|
|
|
|
"options", GST_TYPE_MIXER_OPTIONS, opts,
|
|
|
|
"value", G_TYPE_STRING, value, NULL);
|
|
|
|
|
|
|
|
m = gst_message_new_element (GST_OBJECT (mixer), s);
|
|
|
|
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
|
|
|
|
GST_WARNING ("This element has no bus, therefore no message sent!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
API: add gst_mixer_options_list_changed(), gst_mixer_mixer_changed() and gst_mixer_message_parse_options_list_changed...
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_option_changed),
(gst_mixer_options_list_changed), (gst_mixer_mixer_changed),
(gst_mixer_message_get_type),
(gst_mixer_message_parse_option_changed),
(gst_mixer_message_parse_options_list_changed):
* gst-libs/gst/interfaces/mixer.h: (GstMixerType),
(GST_MIXER_MESSAGE_OPTION_CHANGED),
(GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED),
(GST_MIXER_MESSAGE_MIXER_CHANGED):
API: add gst_mixer_options_list_changed(), gst_mixer_mixer_changed()
and gst_mixer_message_parse_options_list_changed(). Fixes #519916.
2008-03-03 13:56:38 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_options_list_changed:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) that owns the options
|
|
|
|
* @opts: the GstMixerOptions whose list of values has changed
|
|
|
|
*
|
|
|
|
* This function is called by the mixer implementation to produce
|
|
|
|
* a notification message on the bus indicating that the list of possible
|
|
|
|
* options of a given options object has changed.
|
|
|
|
*
|
|
|
|
* The new options are not contained in the message on purpose. Applications
|
|
|
|
* should call gst_mixer_option_get_values() on @opts to make @opts update
|
|
|
|
* its internal state and obtain the new list of values.
|
|
|
|
*
|
|
|
|
* This function only works for GstElements that are implementing the
|
|
|
|
* GstMixer interface, and the element needs to have been provided a bus
|
|
|
|
* for this to work.
|
|
|
|
*
|
|
|
|
* Since: 0.10.18
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_mixer_options_list_changed (GstMixer * mixer, GstMixerOptions * opts)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
GstMessage *m;
|
|
|
|
|
|
|
|
g_return_if_fail (mixer != NULL);
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (mixer));
|
|
|
|
g_return_if_fail (opts != NULL);
|
|
|
|
g_return_if_fail (GST_IS_MIXER_OPTIONS (opts));
|
|
|
|
|
|
|
|
/* we do not include the new list here on purpose, so that the application
|
|
|
|
* has to use gst_mixer_options_get_values() to get the new list, which then
|
|
|
|
* allows the mixer options object to update the internal GList in a somewhat
|
|
|
|
* thread-safe way at least */
|
|
|
|
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
|
|
|
|
"type", G_TYPE_STRING, "options-list-changed",
|
|
|
|
"options", GST_TYPE_MIXER_OPTIONS, opts, NULL);
|
|
|
|
|
|
|
|
m = gst_message_new_element (GST_OBJECT (mixer), s);
|
|
|
|
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
|
|
|
|
GST_WARNING ("This element has no bus, therefore no message sent!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_mixer_mixer_changed:
|
|
|
|
* @mixer: the #GstMixer (a #GstElement) which has changed
|
|
|
|
*
|
|
|
|
* This function is called by the mixer implementation to produce
|
|
|
|
* a notification message on the bus indicating that the list of available
|
|
|
|
* mixer tracks for a given mixer object has changed. Applications should
|
|
|
|
* rebuild their interface when they receive this message.
|
|
|
|
*
|
|
|
|
* This function only works for GstElements that are implementing the
|
|
|
|
* GstMixer interface, and the element needs to have been provided a bus.
|
|
|
|
*
|
|
|
|
* Since: 0.10.18
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_mixer_mixer_changed (GstMixer * mixer)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
GstMessage *m;
|
|
|
|
|
|
|
|
g_return_if_fail (mixer != NULL);
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (mixer));
|
|
|
|
|
|
|
|
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
|
|
|
|
"type", G_TYPE_STRING, "mixer-changed", NULL);
|
|
|
|
|
|
|
|
m = gst_message_new_element (GST_OBJECT (mixer), s);
|
|
|
|
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
|
|
|
|
GST_WARNING ("This element has no bus, therefore no message sent!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mixer_message_is_mixer_message (GstMessage * message)
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
if (message == NULL)
|
|
|
|
return FALSE;
|
|
|
|
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
s = gst_message_get_structure (message);
|
|
|
|
return gst_structure_has_name (s, GST_MIXER_MESSAGE_NAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_mixer_message_get_type:
|
|
|
|
* @message: A GstMessage to inspect.
|
|
|
|
*
|
|
|
|
* Check a bus message to see if it is a GstMixer notification
|
|
|
|
* message and return the GstMixerMessageType identifying which
|
|
|
|
* type of notification it is.
|
|
|
|
*
|
2009-03-30 23:56:18 +00:00
|
|
|
* Returns: The type of the GstMixerMessage, or GST_MIXER_MESSAGE_INVALID
|
2007-07-21 09:21:12 +00:00
|
|
|
* if the message is not a GstMixer notification.
|
|
|
|
*
|
|
|
|
* Since: 0.10.14
|
|
|
|
*/
|
|
|
|
GstMixerMessageType
|
|
|
|
gst_mixer_message_get_type (GstMessage * message)
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
const gchar *m_type;
|
|
|
|
|
|
|
|
if (!gst_mixer_message_is_mixer_message (message))
|
|
|
|
return GST_MIXER_MESSAGE_INVALID;
|
|
|
|
|
|
|
|
s = gst_message_get_structure (message);
|
|
|
|
m_type = gst_structure_get_string (s, "type");
|
|
|
|
g_return_val_if_fail (m_type != NULL, GST_MIXER_MESSAGE_INVALID);
|
|
|
|
|
|
|
|
if (g_str_equal (m_type, "mute-toggled"))
|
|
|
|
return GST_MIXER_MESSAGE_MUTE_TOGGLED;
|
|
|
|
else if (g_str_equal (m_type, "record-toggled"))
|
|
|
|
return GST_MIXER_MESSAGE_RECORD_TOGGLED;
|
|
|
|
else if (g_str_equal (m_type, "volume-changed"))
|
|
|
|
return GST_MIXER_MESSAGE_VOLUME_CHANGED;
|
|
|
|
else if (g_str_equal (m_type, "option-changed"))
|
|
|
|
return GST_MIXER_MESSAGE_OPTION_CHANGED;
|
API: add gst_mixer_options_list_changed(), gst_mixer_mixer_changed() and gst_mixer_message_parse_options_list_changed...
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_option_changed),
(gst_mixer_options_list_changed), (gst_mixer_mixer_changed),
(gst_mixer_message_get_type),
(gst_mixer_message_parse_option_changed),
(gst_mixer_message_parse_options_list_changed):
* gst-libs/gst/interfaces/mixer.h: (GstMixerType),
(GST_MIXER_MESSAGE_OPTION_CHANGED),
(GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED),
(GST_MIXER_MESSAGE_MIXER_CHANGED):
API: add gst_mixer_options_list_changed(), gst_mixer_mixer_changed()
and gst_mixer_message_parse_options_list_changed(). Fixes #519916.
2008-03-03 13:56:38 +00:00
|
|
|
else if (g_str_equal (m_type, "options-list-changed"))
|
|
|
|
return GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED;
|
|
|
|
else if (g_str_equal (m_type, "mixer-changed"))
|
|
|
|
return GST_MIXER_MESSAGE_MIXER_CHANGED;
|
2007-07-21 09:21:12 +00:00
|
|
|
|
|
|
|
return GST_MIXER_MESSAGE_INVALID;
|
|
|
|
}
|
|
|
|
|
2008-02-29 17:59:16 +00:00
|
|
|
#define GST_MIXER_MESSAGE_HAS_TYPE(msg,msg_type) \
|
|
|
|
(gst_mixer_message_get_type (msg) == GST_MIXER_MESSAGE_ ## msg_type)
|
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
/**
|
|
|
|
* gst_mixer_message_parse_mute_toggled:
|
|
|
|
* @message: A mute-toggled change notification message.
|
|
|
|
* @track: Pointer to hold a GstMixerTrack object, or NULL.
|
|
|
|
* @mute: A pointer to a gboolean variable, or NULL.
|
|
|
|
*
|
|
|
|
* Extracts the contents of a mute-toggled bus message. Reads
|
|
|
|
* the GstMixerTrack that has changed, and the new value of the mute
|
|
|
|
* flag.
|
|
|
|
*
|
|
|
|
* The GstMixerTrack remains valid until the message is freed.
|
|
|
|
*
|
|
|
|
* Since: 0.10.14
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_mixer_message_parse_mute_toggled (GstMessage * message,
|
|
|
|
GstMixerTrack ** track, gboolean * mute)
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
|
2008-02-29 17:59:16 +00:00
|
|
|
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, MUTE_TOGGLED));
|
2007-07-21 09:21:12 +00:00
|
|
|
|
2008-02-29 17:59:16 +00:00
|
|
|
s = gst_message_get_structure (message);
|
2007-07-21 09:21:12 +00:00
|
|
|
|
|
|
|
if (track) {
|
|
|
|
const GValue *v = gst_structure_get_value (s, "track");
|
|
|
|
|
|
|
|
g_return_if_fail (v != NULL);
|
|
|
|
*track = (GstMixerTrack *) g_value_get_object (v);
|
|
|
|
g_return_if_fail (GST_IS_MIXER_TRACK (*track));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mute)
|
|
|
|
g_return_if_fail (gst_structure_get_boolean (s, "mute", mute));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_mixer_message_parse_record_toggled:
|
|
|
|
* @message: A record-toggled change notification message.
|
|
|
|
* @track: Pointer to hold a GstMixerTrack object, or NULL.
|
|
|
|
* @record: A pointer to a gboolean variable, or NULL.
|
|
|
|
*
|
|
|
|
* Extracts the contents of a record-toggled bus message. Reads
|
|
|
|
* the GstMixerTrack that has changed, and the new value of the
|
|
|
|
* recording flag.
|
|
|
|
*
|
|
|
|
* The GstMixerTrack remains valid until the message is freed.
|
|
|
|
*
|
|
|
|
* Since: 0.10.14
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_mixer_message_parse_record_toggled (GstMessage * message,
|
|
|
|
GstMixerTrack ** track, gboolean * record)
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
|
2008-02-29 17:59:16 +00:00
|
|
|
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, RECORD_TOGGLED));
|
2007-07-21 09:21:12 +00:00
|
|
|
|
2008-02-29 17:59:16 +00:00
|
|
|
s = gst_message_get_structure (message);
|
2007-07-21 09:21:12 +00:00
|
|
|
|
|
|
|
if (track) {
|
|
|
|
const GValue *v = gst_structure_get_value (s, "track");
|
|
|
|
|
|
|
|
g_return_if_fail (v != NULL);
|
|
|
|
*track = (GstMixerTrack *) g_value_get_object (v);
|
|
|
|
g_return_if_fail (GST_IS_MIXER_TRACK (*track));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (record)
|
|
|
|
g_return_if_fail (gst_structure_get_boolean (s, "record", record));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_mixer_message_parse_volume_changed:
|
|
|
|
* @message: A volume-changed change notification message.
|
|
|
|
* @track: Pointer to hold a GstMixerTrack object, or NULL.
|
|
|
|
* @volumes: A pointer to receive an array of gint values, or NULL.
|
|
|
|
* @num_channels: Result location to receive the number of channels, or NULL.
|
|
|
|
*
|
|
|
|
* Parses a volume-changed notification message and extracts the track object
|
|
|
|
* it refers to, as well as an array of volumes and the size of the volumes array.
|
|
|
|
*
|
|
|
|
* The track object remains valid until the message is freed.
|
|
|
|
*
|
|
|
|
* The caller must free the array returned in the volumes parameter using g_free
|
|
|
|
* when they are done with it.
|
|
|
|
*
|
|
|
|
* Since: 0.10.14
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_mixer_message_parse_volume_changed (GstMessage * message,
|
|
|
|
GstMixerTrack ** track, gint ** volumes, gint * num_channels)
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
|
2008-02-29 17:59:16 +00:00
|
|
|
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, VOLUME_CHANGED));
|
2007-07-21 09:21:12 +00:00
|
|
|
|
2008-02-29 17:59:16 +00:00
|
|
|
s = gst_message_get_structure (message);
|
2007-07-21 09:21:12 +00:00
|
|
|
|
|
|
|
if (track) {
|
|
|
|
const GValue *v = gst_structure_get_value (s, "track");
|
|
|
|
|
|
|
|
g_return_if_fail (v != NULL);
|
|
|
|
*track = (GstMixerTrack *) g_value_get_object (v);
|
|
|
|
g_return_if_fail (GST_IS_MIXER_TRACK (*track));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (volumes || num_channels) {
|
|
|
|
gint n_chans, i;
|
|
|
|
const GValue *v = gst_structure_get_value (s, "volumes");
|
|
|
|
|
|
|
|
g_return_if_fail (v != NULL);
|
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_ARRAY (v));
|
|
|
|
|
|
|
|
n_chans = gst_value_array_get_size (v);
|
|
|
|
if (num_channels)
|
|
|
|
*num_channels = n_chans;
|
|
|
|
|
|
|
|
if (volumes) {
|
|
|
|
*volumes = g_new (gint, n_chans);
|
|
|
|
for (i = 0; i < n_chans; i++) {
|
|
|
|
const GValue *e = gst_value_array_get_value (v, i);
|
|
|
|
|
|
|
|
g_return_if_fail (e != NULL && G_VALUE_HOLDS_INT (e));
|
|
|
|
(*volumes)[i] = g_value_get_int (e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_mixer_message_parse_option_changed:
|
|
|
|
* @message: A volume-changed change notification message.
|
|
|
|
* @options: Pointer to hold a GstMixerOptions object, or NULL.
|
|
|
|
* @value: Result location to receive the new options value, or NULL.
|
|
|
|
*
|
|
|
|
* Extracts the GstMixerOptions and new value from a option-changed bus notification
|
|
|
|
* message.
|
|
|
|
*
|
|
|
|
* The options and value returned remain valid until the message is freed.
|
|
|
|
*
|
|
|
|
* Since: 0.10.14
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_mixer_message_parse_option_changed (GstMessage * message,
|
|
|
|
GstMixerOptions ** options, const gchar ** value)
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
|
2008-02-29 17:59:16 +00:00
|
|
|
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, OPTION_CHANGED));
|
2007-07-21 09:21:12 +00:00
|
|
|
|
2008-02-29 17:59:16 +00:00
|
|
|
s = gst_message_get_structure (message);
|
2007-07-21 09:21:12 +00:00
|
|
|
|
|
|
|
if (options) {
|
|
|
|
const GValue *v = gst_structure_get_value (s, "options");
|
|
|
|
|
|
|
|
g_return_if_fail (v != NULL);
|
|
|
|
*options = (GstMixerOptions *) g_value_get_object (v);
|
|
|
|
g_return_if_fail (GST_IS_MIXER_OPTIONS (*options));
|
|
|
|
}
|
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
|
|
|
|
2007-07-21 09:21:12 +00:00
|
|
|
if (value)
|
|
|
|
*value = gst_structure_get_string (s, "value");
|
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
|
|
|
}
|
API: add gst_mixer_options_list_changed(), gst_mixer_mixer_changed() and gst_mixer_message_parse_options_list_changed...
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/interfaces/mixer.c: (gst_mixer_option_changed),
(gst_mixer_options_list_changed), (gst_mixer_mixer_changed),
(gst_mixer_message_get_type),
(gst_mixer_message_parse_option_changed),
(gst_mixer_message_parse_options_list_changed):
* gst-libs/gst/interfaces/mixer.h: (GstMixerType),
(GST_MIXER_MESSAGE_OPTION_CHANGED),
(GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED),
(GST_MIXER_MESSAGE_MIXER_CHANGED):
API: add gst_mixer_options_list_changed(), gst_mixer_mixer_changed()
and gst_mixer_message_parse_options_list_changed(). Fixes #519916.
2008-03-03 13:56:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_mixer_message_parse_options_list_changed:
|
|
|
|
* @message: A volume-changed change notification message.
|
|
|
|
* @options: Pointer to hold a GstMixerOptions object, or NULL.
|
|
|
|
*
|
|
|
|
* Extracts the GstMixerOptions whose value list has changed from an
|
|
|
|
* options-list-changed bus notification message.
|
|
|
|
*
|
|
|
|
* The options object returned remains valid until the message is freed. You
|
|
|
|
* do not need to unref it.
|
|
|
|
*
|
|
|
|
* Since: 0.10.18
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_mixer_message_parse_options_list_changed (GstMessage * message,
|
|
|
|
GstMixerOptions ** options)
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
|
|
|
|
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, OPTIONS_LIST_CHANGED));
|
|
|
|
|
|
|
|
s = gst_message_get_structure (message);
|
|
|
|
|
|
|
|
if (options) {
|
|
|
|
const GValue *v = gst_structure_get_value (s, "options");
|
|
|
|
|
|
|
|
g_return_if_fail (v != NULL);
|
|
|
|
*options = (GstMixerOptions *) g_value_get_object (v);
|
|
|
|
g_return_if_fail (GST_IS_MIXER_OPTIONS (*options));
|
|
|
|
}
|
|
|
|
}
|