diff options
author | Jan Schmidt <jan.schmidt@sun.com> | 2009-06-05 16:54:48 +0100 |
---|---|---|
committer | Jan Schmidt <jan.schmidt@sun.com> | 2009-06-05 16:54:48 +0100 |
commit | 7994f640063e583caf91346821566158d3904286 (patch) | |
tree | 44db28f5cd2c88a3d058465f6936251c64eef692 /sys | |
parent | 0fc43060e5e10e5a9fc24487d9fcb3e2865c0895 (diff) |
sunaudio: Fix switch setting on some devices. Add debug. Fix a FIXME.
Fix the setting of toggle switches on some broken audio drivers which
report that no audio ports are settable by ignoring the mod_port field
there.
Add some debug statements.
Fix a FIXME now that Good relies on a new enough gst-plugins-base.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sunaudio/gstsunaudiomixerctrl.c | 31 | ||||
-rw-r--r-- | sys/sunaudio/gstsunaudiomixeroptions.c | 8 | ||||
-rw-r--r-- | sys/sunaudio/gstsunaudiomixertrack.c | 24 |
3 files changed, 42 insertions, 21 deletions
diff --git a/sys/sunaudio/gstsunaudiomixerctrl.c b/sys/sunaudio/gstsunaudiomixerctrl.c index 3d9d5e2b5..07231348e 100644 --- a/sys/sunaudio/gstsunaudiomixerctrl.c +++ b/sys/sunaudio/gstsunaudiomixerctrl.c @@ -71,6 +71,8 @@ gst_sunaudiomixer_ctrl_open (GstSunAudioMixerCtrl * mixer) /* Try to set the multiple open flag if we can, but ignore errors */ ioctl (mixer->mixer_fd, AUDIO_MIXER_MULTIPLE_OPEN); + GST_DEBUG_OBJECT (mixer, "Opened mixer device %s", mixer->device); + return TRUE; } @@ -288,9 +290,9 @@ gst_sunaudiomixer_ctrl_get_volume (GstSunAudioMixerCtrl * mixer, } /* Likewise reset MUTE */ - if ((sunaudiotrack->track_num == GST_SUNAUDIO_TRACK_OUTPUT && - audioinfo.output_muted == 1) || - (sunaudiotrack->track_num != GST_SUNAUDIO_TRACK_OUTPUT && gain == 0)) { + if ((sunaudiotrack->track_num == GST_SUNAUDIO_TRACK_OUTPUT + && audioinfo.output_muted == 1) + || (sunaudiotrack->track_num != GST_SUNAUDIO_TRACK_OUTPUT && gain == 0)) { /* * If MUTE is set, then gain is always 0, so don't bother * resetting our internal value. @@ -469,13 +471,20 @@ gst_sunaudiomixer_ctrl_set_mute (GstSunAudioMixerCtrl * mixer, } if (audioinfo.play.port != ((unsigned) ~0)) { - /* mask off ports we can't modify */ - audioinfo.play.port &= oldinfo.play.mod_ports; - /* and add in any that are forced to be on */ - audioinfo.play.port |= (oldinfo.play.port & ~oldinfo.play.mod_ports); + /* mask off ports we can't modify. Hack for broken drivers where mod_ports == 0 */ + if (oldinfo.play.mod_ports != 0) { + audioinfo.play.port &= oldinfo.play.mod_ports; + /* and add in any that are forced to be on */ + audioinfo.play.port |= (oldinfo.play.port & ~oldinfo.play.mod_ports); + } } g_return_if_fail (mixer->mixer_fd != -1); + if (audioinfo.play.port != (guint) (-1) && + audioinfo.play.port != oldinfo.play.port) + GST_LOG_OBJECT (mixer, "Changing play port mask to 0x%08x", + audioinfo.play.port); + if (ioctl (mixer->mixer_fd, AUDIO_SETINFO, &audioinfo) < 0) { g_warning ("Error setting audio settings"); return; @@ -561,10 +570,16 @@ gst_sunaudiomixer_ctrl_get_option (GstSunAudioMixerCtrl * mixer, for (i = 0; i < 8; i++) { if ((1 << i) == audioinfo.record.port) { - return (g_quark_to_string (opts->names[i])); + const gchar *s = g_quark_to_string (opts->names[i]); + GST_DEBUG_OBJECT (mixer, "Getting value for option %d: %s", + opts->track_num, s); + return (s); } } + GST_DEBUG_OBJECT (mixer, "Unable to get value for option %d", + opts->track_num); + g_warning ("Record port value %d seems illegal", audioinfo.record.port); return (NULL); } diff --git a/sys/sunaudio/gstsunaudiomixeroptions.c b/sys/sunaudio/gstsunaudiomixeroptions.c index 0c0d95dc2..1fa025b9e 100644 --- a/sys/sunaudio/gstsunaudiomixeroptions.c +++ b/sys/sunaudio/gstsunaudiomixeroptions.c @@ -40,6 +40,9 @@ #include "gstsunaudiomixeroptions.h" #include "gstsunaudiomixertrack.h" +GST_DEBUG_CATEGORY_EXTERN (sunaudio_debug); +#define GST_CAT_DEFAULT sunaudio_debug + static void gst_sunaudiomixer_options_init (GstSunAudioMixerOptions * sun_opts); static void gst_sunaudiomixer_options_class_init (gpointer g_class, gpointer class_data); @@ -110,6 +113,9 @@ gst_sunaudiomixer_options_new (GstSunAudioMixerCtrl * mixer, gint track_num) sun_opts = GST_SUNAUDIO_MIXER_OPTIONS (opts); track = GST_MIXER_TRACK (opts); + GST_DEBUG_OBJECT (opts, "New mixer options, track %d: %s", + track_num, GST_STR_NULL (label)); + /* save off names for the record sources */ sun_opts->names[0] = g_quark_from_string (_("Microphone")); sun_opts->names[1] = g_quark_from_string (_("Line In")); @@ -142,6 +148,8 @@ gst_sunaudiomixer_options_new (GstSunAudioMixerCtrl * mixer, gint track_num) if ((1 << i) & audioinfo.record.avail_ports) { const char *s = g_quark_to_string (sun_opts->names[i]); opts->values = g_list_append (opts->values, g_strdup (s)); + GST_DEBUG_OBJECT (opts, "option for track %d: %s", + track_num, GST_STR_NULL (s)); } } diff --git a/sys/sunaudio/gstsunaudiomixertrack.c b/sys/sunaudio/gstsunaudiomixertrack.c index bee770430..786ef0d83 100644 --- a/sys/sunaudio/gstsunaudiomixertrack.c +++ b/sys/sunaudio/gstsunaudiomixertrack.c @@ -40,14 +40,17 @@ #include "gstsunaudiomixertrack.h" +GST_DEBUG_CATEGORY_EXTERN (sunaudio_debug); +#define GST_CAT_DEFAULT sunaudio_debug + #define MASK_BIT_IS_SET(mask, bit) \ (mask & (1 << bit)) G_DEFINE_TYPE (GstSunAudioMixerTrack, gst_sunaudiomixer_track, - GST_TYPE_MIXER_TRACK) + GST_TYPE_MIXER_TRACK); - static void - gst_sunaudiomixer_track_class_init (GstSunAudioMixerTrackClass * klass) +static void +gst_sunaudiomixer_track_class_init (GstSunAudioMixerTrackClass * klass) { /* nop */ } @@ -77,7 +80,6 @@ gst_sunaudiomixer_track_new (GstSunAudioTrackType track_num) GstSunAudioMixerTrack *sunaudiotrack; GstMixerTrack *track; - GObjectClass *klass; const gchar *untranslated_label; if ((guint) track_num < G_N_ELEMENTS (labels)) @@ -85,15 +87,11 @@ gst_sunaudiomixer_track_new (GstSunAudioTrackType track_num) else untranslated_label = NULL; - /* FIXME: remove this check once we depend on -base >= 0.10.12.1 */ - klass = G_OBJECT_CLASS (g_type_class_ref (GST_TYPE_SUNAUDIO_MIXER_TRACK)); - if (g_object_class_find_property (klass, "untranslated-label")) { - sunaudiotrack = g_object_new (GST_TYPE_SUNAUDIO_MIXER_TRACK, - "untranslated-label", untranslated_label, NULL); - } else { - sunaudiotrack = g_object_new (GST_TYPE_SUNAUDIO_MIXER_TRACK, NULL); - } - g_type_class_unref (klass); + sunaudiotrack = g_object_new (GST_TYPE_SUNAUDIO_MIXER_TRACK, + "untranslated-label", untranslated_label, NULL); + + GST_DEBUG_OBJECT (sunaudiotrack, "Creating new mixer track of type %d: %s", + track_num, GST_STR_NULL (untranslated_label)); switch (track_num) { case GST_SUNAUDIO_TRACK_OUTPUT: |