--- /tmp/gst-mixer/element.c	2007-09-25 11:41:52.919920811 -0500
+++ gnome-media-2.20.1/gst-mixer/src/element.c	2007-09-25 11:47:49.710732000 -0500
@@ -209,7 +209,7 @@ gnome_volume_control_element_change (Gno
 {
   struct {
     gchar *label;
-    GtkWidget *page, *old_sep, *new_sep;
+    GtkWidget *page, *flagbuttonbox, *old_sep, *new_sep;
     gboolean use;
     gint pos, height, width;
     GnomeVolumeControlTrack * (* get_track_widget) (GtkTable      *table,
@@ -220,19 +220,21 @@ gnome_volume_control_element_change (Gno
 						    GtkWidget     *right_sep,
 						    GnomeAppBar   *appbar);
   } content[4] = {
-    { _("Playback"), NULL, NULL, NULL, FALSE, 0, 5, 1,
+    { _("Playback"), NULL, NULL, NULL, NULL, FALSE, 0, 5, 1,
       gnome_volume_control_track_add_playback },
-    { _("Recording"),  NULL, NULL, NULL, FALSE, 0, 5, 1,
+    { _("Recording"),  NULL, NULL, NULL, NULL, FALSE, 0, 5, 1,
       gnome_volume_control_track_add_recording },
-    { _("Switches"), NULL, NULL, NULL, FALSE, 0, 1, 3,
+    { _("Switches"), NULL, NULL, NULL, NULL, FALSE, 0, 1, 3,
       gnome_volume_control_track_add_switch },
-    { _("Options"),  NULL, NULL, NULL, FALSE, 0, 1, 3,
+    { _("Options"),  NULL, NULL, NULL, NULL, FALSE, 0, 1, 3,
       gnome_volume_control_track_add_option }
   };
   gvc_whitelist list[] = whitelist_init_list;
   gint i;
   const GList *item;
   GstMixer *mixer;
+  static gchar *devname  = NULL;
+  gchar *current_devname = NULL;
 
   /* remove old pages */
   while (gtk_notebook_get_n_pages (GTK_NOTEBOOK (el)) > 0) {
@@ -258,6 +260,27 @@ gnome_volume_control_element_change (Gno
   mixer = GST_MIXER (element);
   gst_object_replace ((GstObject **) &el->mixer, GST_OBJECT (element));
 
+#if __sun
+  /*
+   * If switching to Sun Audio, then inform the track that we are using
+   * this interface so we know when to display the additional needed
+   * buttons.
+   */
+  current_devname = g_object_get_data (G_OBJECT (mixer), "gnome-volume-control-name");
+  if (current_devname) {
+     if (devname == NULL || strcmp (current_devname, devname) != 0) {
+
+        if (current_devname != NULL)
+           g_free (current_devname);
+        devname = g_strdup (current_devname);
+        sun_reset_buttons (g_str_has_suffix (devname, "(Sun Audio Mixer)"));
+     }
+  } else {
+     /* Should never fail, just return if it does */
+     return;  
+  }
+#endif
+
   /* content pages */
   for (i = 0; i < 4; i++) {
     content[i].page = gtk_table_new (content[i].width, content[i].height, FALSE);
@@ -265,6 +288,7 @@ gnome_volume_control_element_change (Gno
     if (i >= 2)
       gtk_table_set_row_spacings (GTK_TABLE (content[i].page), 6);
     gtk_table_set_col_spacings (GTK_TABLE (content[i].page), 6);
+    content[i].flagbuttonbox = NULL;
   }
 
   /* show */
@@ -312,6 +336,10 @@ gnome_volume_control_element_change (Gno
 					el->appbar);
     gnome_volume_control_track_show (trkw, active);
 
+    /* Only the first trkw on the page will return flagbuttonbox */
+    if (trkw->flagbuttonbox != NULL)
+       content[i].flagbuttonbox = trkw->flagbuttonbox;
+
     g_object_set_data (G_OBJECT (track),
 		       "gnome-volume-control-trkw", trkw);
 
@@ -355,8 +383,31 @@ gnome_volume_control_element_change (Gno
     viewport = gtk_viewport_new (hadjustment, vadjustment);
     gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
 
-    gtk_container_add (GTK_CONTAINER (viewport), content[i].page);
-    gtk_container_add (GTK_CONTAINER (view), viewport);
+    if (content[i].flagbuttonbox != NULL) {
+       GtkWidget *vbox      = NULL;
+       GtkWidget *hbox      = NULL;
+       GtkWidget *hbox2     = NULL;
+       GtkWidget *separator = NULL;
+
+       vbox      = gtk_vbox_new (FALSE, 0);
+       hbox      = gtk_hbox_new (FALSE, 6);
+       hbox2     = gtk_hbox_new (FALSE, 6);
+       separator = gtk_hseparator_new ();
+
+       gtk_box_pack_start (GTK_BOX (vbox), content[i].page, TRUE, TRUE, 6);
+       gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 6);
+       gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 6);
+       gtk_box_pack_start (GTK_BOX (hbox2), separator, TRUE, TRUE, 6);
+       gtk_box_pack_start (GTK_BOX (hbox), content[i].flagbuttonbox, TRUE, FALSE, 6);
+
+       gtk_widget_show_all (vbox);
+
+       gtk_container_add (GTK_CONTAINER (viewport), vbox);
+       gtk_container_add (GTK_CONTAINER (view), viewport);
+    } else {
+       gtk_container_add (GTK_CONTAINER (viewport), content[i].page);
+       gtk_container_add (GTK_CONTAINER (view), viewport);
+    }
 
     label = gtk_label_new (content[i].label);
     gtk_notebook_append_page (GTK_NOTEBOOK (el), view, label);
--- /tmp/gst-mixer/track.c	2007-09-25 11:41:52.920634325 -0500
+++ gnome-media-2.20.1/gst-mixer/src/track.c	2007-09-25 11:43:01.953846000 -0500
@@ -19,6 +19,11 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#ifdef __sun
+#include <fcntl.h>
+#include <sys/audio.h>
+#endif
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -113,6 +118,161 @@ cb_option_changed (GtkComboBox *box,
   g_free (opt);
 }
 
+#ifdef __sun
+static gint      mixer_fd              = -1;
+static gboolean  sun_audio_interface   = FALSE;
+
+static gboolean  out_switch_display    = FALSE;
+static gboolean  in_switch_display     = FALSE;
+static gboolean  in_recording          = FALSE;
+
+static GtkWidget *out_speaker_button   = NULL;
+static GtkWidget *out_headphone_button = NULL;
+static GtkWidget *out_lineout_button   = NULL;
+static GtkWidget *out_spdif_button     = NULL;
+static GtkWidget *out_aux1_button      = NULL;
+static GtkWidget *out_aux2_button      = NULL;
+
+static GtkWidget *in_microphone_button = NULL;
+static GtkWidget *in_line_in_button    = NULL;
+static GtkWidget *in_cd_button         = NULL;
+static GtkWidget *in_spdif_button      = NULL;
+static GtkWidget *in_aux1_button       = NULL;
+static GtkWidget *in_aux2_button       = NULL;
+static GtkWidget *in_codec_button      = NULL;
+
+static void
+sun_out_button_cb (GtkToggleButton *tb, gpointer data)
+{
+   audio_info_t ainfo;
+   int ret;
+
+   AUDIO_INITINFO (&ainfo);
+
+   if (ioctl (mixer_fd, AUDIO_GETINFO, &ainfo) < 0)
+      g_warning ("Error getting audio device information");
+
+   if (out_speaker_button != NULL) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_speaker_button)))
+         ainfo.play.port |= AUDIO_SPEAKER;
+      else
+         ainfo.play.port &= ~AUDIO_SPEAKER;
+   }
+
+   if (out_headphone_button != NULL) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_headphone_button)))
+         ainfo.play.port |= AUDIO_HEADPHONE;
+      else
+         ainfo.play.port &= ~AUDIO_HEADPHONE;
+   }
+      
+   if (out_lineout_button != NULL) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_lineout_button)))
+         ainfo.play.port |= AUDIO_LINE_OUT;
+      else
+         ainfo.play.port &= ~AUDIO_LINE_OUT;
+   }
+
+   if (out_spdif_button != NULL) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_spdif_button)))
+         ainfo.play.port |= AUDIO_SPDIF_OUT;
+      else
+         ainfo.play.port &= ~AUDIO_SPDIF_OUT;
+   }
+
+   if (out_aux1_button != NULL) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_aux1_button)))
+         ainfo.play.port |= AUDIO_AUX1_OUT;
+      else
+         ainfo.play.port &= ~AUDIO_AUX1_OUT;
+   }
+
+   if (out_aux2_button != NULL) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_aux2_button)))
+         ainfo.play.port |= AUDIO_AUX2_OUT;
+      else
+         ainfo.play.port &= ~AUDIO_AUX2_OUT;
+   }
+
+   if (ioctl (mixer_fd, AUDIO_SETINFO, &ainfo) < 0)
+      g_warning ("Error setting audio device information");
+}
+
+static void
+sun_in_button_cb (GtkToggleButton *tb, gpointer data)
+{
+   audio_info_t ainfo;
+   int ret;
+
+   AUDIO_INITINFO (&ainfo);
+
+   if (ioctl (mixer_fd, AUDIO_GETINFO, &ainfo) < 0)
+      g_warning ("Error getting audio device information");
+
+   if (in_microphone_button != NULL &&
+       tb == GTK_TOGGLE_BUTTON (in_microphone_button)) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_microphone_button)))
+         ainfo.record.port = AUDIO_MICROPHONE;
+   }
+
+   if (in_line_in_button != NULL &&
+       tb == GTK_TOGGLE_BUTTON (in_line_in_button)) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_line_in_button)))
+         ainfo.record.port = AUDIO_LINE_IN;
+   }
+
+   if (in_cd_button != NULL && tb == GTK_TOGGLE_BUTTON (in_cd_button)) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_cd_button)))
+         ainfo.record.port = AUDIO_CD;
+   }
+
+   if (in_spdif_button != NULL && tb == GTK_TOGGLE_BUTTON (in_spdif_button)) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_spdif_button)))
+         ainfo.record.port = AUDIO_SPDIF_IN;
+   }
+
+   if (in_aux1_button != NULL && tb == GTK_TOGGLE_BUTTON (in_aux1_button)) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_aux1_button)))
+         ainfo.record.port = AUDIO_AUX1_IN;
+   }
+
+   if (in_aux2_button != NULL && tb == GTK_TOGGLE_BUTTON (in_aux2_button)) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_aux2_button)))
+         ainfo.record.port = AUDIO_AUX2_IN;
+   }
+
+   if (in_codec_button != NULL && tb == GTK_TOGGLE_BUTTON (in_codec_button)) {
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_codec_button)))
+         ainfo.record.port = AUDIO_CODEC_LOOPB_IN;
+   }
+
+   if (ioctl (mixer_fd, AUDIO_SETINFO, &ainfo) < 0)
+      g_warning ("Error setting audio device information");
+}
+
+void
+sun_reset_buttons (gboolean sun_interface)
+{
+   sun_audio_interface  = sun_interface;
+   out_switch_display   = FALSE;
+   in_switch_display    = FALSE;
+
+   out_speaker_button   = NULL;
+   out_headphone_button = NULL;
+   out_lineout_button   = NULL;
+   out_spdif_button     = NULL;
+   out_aux1_button      = NULL;
+   out_aux2_button      = NULL;
+   in_microphone_button = NULL;
+   in_line_in_button    = NULL;
+   in_cd_button         = NULL;
+   in_spdif_button      = NULL;
+   in_aux1_button       = NULL;
+   in_aux2_button       = NULL;
+   in_codec_button      = NULL;
+}
+#endif
+
 /*
  * Timeout to check for changes in mixer outside ourselves.
  */
@@ -170,6 +330,113 @@ cb_check (gpointer data)
    * - options.
    */
 
+#ifdef __sun
+  /*
+   * Update the Sun flag buttons, if they change.  Only do this if
+   * using SunAudio interface.
+   */
+   if (sun_audio_interface) {
+      audio_info_t ainfo;
+      int ret;
+
+      if (ioctl (mixer_fd, AUDIO_GETINFO, &ainfo) < 0)
+         g_warning ("Error getting audio device information");
+
+      if (out_speaker_button != NULL &&
+          (ainfo.play.avail_ports & AUDIO_SPEAKER) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_speaker_button)) !=
+          (ainfo.play.port & AUDIO_SPEAKER)) {
+            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_speaker_button),
+               (ainfo.play.port & AUDIO_SPEAKER));
+      }
+
+      if (out_headphone_button != NULL &&
+          (ainfo.play.avail_ports & AUDIO_HEADPHONE) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_headphone_button)) !=
+          (ainfo.play.port & AUDIO_HEADPHONE)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_headphone_button),
+            (ainfo.play.port & AUDIO_HEADPHONE));
+      }
+
+      if (out_lineout_button != NULL && (ainfo.play.avail_ports & AUDIO_LINE_OUT) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_lineout_button)) !=
+          (ainfo.play.port & AUDIO_LINE_OUT)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_lineout_button),
+            (ainfo.play.port & AUDIO_LINE_OUT));
+      }
+
+      if (out_spdif_button != NULL && (ainfo.play.avail_ports & AUDIO_SPDIF_OUT) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_spdif_button)) !=
+          (ainfo.play.port & AUDIO_SPDIF_OUT)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_spdif_button),
+            (ainfo.play.port & AUDIO_SPDIF_OUT));
+      }
+
+      if (out_aux1_button != NULL && (ainfo.play.avail_ports & AUDIO_AUX1_OUT) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_aux1_button)) !=
+          (ainfo.play.port & AUDIO_AUX1_OUT)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_aux1_button),
+            (ainfo.play.port & AUDIO_AUX1_OUT));
+      }
+
+      if (out_aux2_button != NULL && (ainfo.play.avail_ports & AUDIO_AUX2_OUT) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (out_aux2_button)) !=
+          (ainfo.play.port & AUDIO_AUX2_OUT)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_aux2_button),
+            (ainfo.play.port & AUDIO_AUX2_OUT));
+      }
+
+      if (in_microphone_button != NULL && (ainfo.record.avail_ports & AUDIO_MICROPHONE) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_microphone_button)) !=
+          (ainfo.record.port & AUDIO_MICROPHONE)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_microphone_button),
+            (ainfo.record.port & AUDIO_MICROPHONE));
+      }
+
+      if (in_line_in_button != NULL && (ainfo.record.avail_ports & AUDIO_LINE_IN) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_line_in_button)) !=
+          (ainfo.record.port & AUDIO_LINE_IN)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_line_in_button),
+            (ainfo.record.port & AUDIO_LINE_IN));
+      }
+
+      if (in_cd_button != NULL && (ainfo.record.avail_ports & AUDIO_CD) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_cd_button)) !=
+          (ainfo.record.port & AUDIO_CD)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_cd_button),
+            (ainfo.record.port & AUDIO_CD));
+      }
+
+      if (in_spdif_button != NULL && (ainfo.record.avail_ports & AUDIO_SPDIF_IN) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_spdif_button)) !=
+          (ainfo.record.port & AUDIO_SPDIF_IN)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_spdif_button),
+            (ainfo.record.port & AUDIO_SPDIF_IN));
+      }
+
+      if (in_aux1_button != NULL && (ainfo.record.avail_ports & AUDIO_AUX1_IN) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_aux1_button)) !=
+          (ainfo.record.port & AUDIO_AUX1_IN)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_aux1_button),
+            (ainfo.record.port & AUDIO_AUX1_IN));
+      }
+
+      if (in_aux2_button != NULL && (ainfo.record.avail_ports & AUDIO_AUX2_IN) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_aux2_button)) !=
+          (ainfo.record.port & AUDIO_AUX2_IN)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_aux2_button),
+            (ainfo.record.port & AUDIO_AUX2_IN));
+      }
+
+      if (in_codec_button != NULL && (ainfo.record.avail_ports & AUDIO_CODEC_LOOPB_IN) &&
+          gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (in_codec_button)) !=
+          (ainfo.record.port & AUDIO_CODEC_LOOPB_IN)) {
+         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_codec_button),
+            (ainfo.record.port & AUDIO_CODEC_LOOPB_IN));
+      }
+   }
+#endif
+
   return TRUE;
 }
 
@@ -202,6 +469,7 @@ gnome_volume_control_track_add_title (Gt
   ctrl->table = table;
   ctrl->pos = tab_pos;
   ctrl->id = g_timeout_add (200, cb_check, ctrl);
+  ctrl->flagbuttonbox = NULL;
 
   /* find image from label string (optional) */
   if (g_object_class_find_property (G_OBJECT_GET_CLASS (track), "untranslated-label"))
@@ -350,6 +618,117 @@ gnome_volume_control_track_add_playback	
   /* mute button */
   gnome_volume_control_track_put_switch (table, tab_pos, ctrl, appbar);
 
+#ifdef __sun
+  /*
+   * Only create the flagbuttonbox once.  Don't create if really we are
+   * in track_add_recording (if in_recording is TRUE).
+   */
+  if (sun_audio_interface == TRUE  &&
+      out_switch_display  == FALSE &&
+      in_recording        == FALSE) {
+
+     audio_info_t ainfo;
+     const char *audiodev;
+
+     out_switch_display  = TRUE;
+     ctrl->flagbuttonbox = gtk_vbox_new (FALSE, 0);
+
+     if (mixer_fd == -1) {
+        audiodev = g_getenv ("AUDIODEV");
+        if (audiodev == NULL) {
+          mixer_fd = open ("/dev/audioctl", O_RDWR | O_NONBLOCK);
+        } else {
+          gchar *device = g_strdup (audiodev);
+          mixer_fd = open (device, O_RDWR | O_NONBLOCK);
+          g_free (device);
+        }
+     }
+
+     if (ioctl (mixer_fd, AUDIO_GETINFO, &ainfo) < 0)
+        g_warning ("Error getting audio device information");
+
+     if (ainfo.play.avail_ports & AUDIO_SPEAKER) {
+
+        /* SUN_BRANDING */
+        out_speaker_button = gtk_check_button_new_with_mnemonic (_("_Built-in Speaker"));
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), out_speaker_button,
+                                     FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (out_speaker_button), "toggled",
+                                    G_CALLBACK (sun_out_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_speaker_button),
+           ainfo.play.port & AUDIO_SPEAKER);
+        gtk_widget_show (out_speaker_button);
+     }
+
+     if (ainfo.play.avail_ports & AUDIO_HEADPHONE) {
+        /* Set mnemonic to "P" since "H" is already used by Help menu item */
+
+        /* SUN_BRANDING */
+        out_headphone_button = gtk_check_button_new_with_mnemonic (_("Head_phone"));
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), out_headphone_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (out_headphone_button), "toggled",
+                          G_CALLBACK (sun_out_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_headphone_button),
+           ainfo.play.port & AUDIO_HEADPHONE);
+        gtk_widget_show (out_headphone_button);
+     }
+
+     if (ainfo.play.avail_ports & AUDIO_LINE_OUT) {
+
+        /* SUN_BRANDING */
+        out_lineout_button = gtk_check_button_new_with_mnemonic (_("_Line Out"));
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), out_lineout_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (out_lineout_button), "toggled",
+                          G_CALLBACK (sun_out_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_lineout_button),
+           ainfo.play.port & AUDIO_LINE_OUT);
+        gtk_widget_show (out_lineout_button);
+     }
+
+     if (ainfo.play.avail_ports & AUDIO_SPDIF_OUT) {
+
+        /* SUN_BRANDING */
+        out_spdif_button = gtk_check_button_new_with_mnemonic (_("_SPDIF Out"));
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), out_spdif_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (out_spdif_button), "toggled",
+                          G_CALLBACK (sun_out_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_spdif_button),
+           ainfo.play.port & AUDIO_SPDIF_OUT);
+        gtk_widget_show (out_spdif_button);
+     }
+
+     if (ainfo.play.avail_ports & AUDIO_AUX1_OUT) {
+
+        /* SUN_BRANDING */
+        out_aux1_button = gtk_check_button_new_with_mnemonic (_("AUX_1 Out"));
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), out_aux1_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (out_aux1_button), "toggled",
+                          G_CALLBACK (sun_out_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_aux1_button),
+           ainfo.play.port & AUDIO_AUX1_OUT);
+        gtk_widget_show (out_aux1_button);
+     }
+
+     if (ainfo.play.avail_ports & AUDIO_AUX2_OUT) {
+
+        /* SUN_BRANDING */
+        out_aux2_button = gtk_check_button_new_with_mnemonic (_("AUX_2 Out"));
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), out_aux2_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (out_aux2_button), "toggled",
+                          G_CALLBACK (sun_out_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (out_aux2_button),
+           ainfo.play.port & AUDIO_AUX2_OUT);
+        gtk_widget_show (out_aux2_button);
+     }
+     gtk_widget_show (ctrl->flagbuttonbox);
+  }
+#endif
+
   return ctrl;
 }
 
@@ -367,9 +746,12 @@ gnome_volume_control_track_add_recording
   AtkObject *accessible;
   gchar *accessible_name, *msg;
 
+  in_recording = TRUE;
   ctrl = gnome_volume_control_track_add_playback (table, tab_pos, mixer,
 						  track, l_sep, r_sep,
 						  appbar);
+  in_recording = FALSE;
+
   if (track->num_channels == 0) {
     return ctrl;
   }
@@ -378,6 +760,10 @@ gnome_volume_control_track_add_recording
    * - there's something fishy about this button, it
    *     is always FALSE.
    */
+#ifdef __sun
+  /* If not using Sun Audio interface, behave as default */
+  if (sun_audio_interface == FALSE) {
+#endif
 
   /* only the record button here */
   msg = g_strdup_printf (_("Toggle audio recording from %s"), ctrl->track->label);
@@ -406,6 +792,178 @@ gnome_volume_control_track_add_recording
 		      FALSE, FALSE, 0);
   gtk_widget_show (button);
 
+#ifdef __sun
+  /*
+   * Only create the flagbuttonbox once, and only if using Sun 
+   * Audio interface.
+   *
+   * Note that we do not want to show the record button when using
+   * SunAudio interfaces.  This record button is used to switch
+   * between microphone and line-in input.  Since this is managed
+   * by the flagbuttons defined below, we don't want this when
+   * using Sun Audio.  So this is why we avoid the above logic
+   * when using SunAudio.
+   */
+  } else if (in_switch_display == FALSE) {
+     GtkRadioButton *first_button = NULL;
+     audio_info_t ainfo;
+     const char *audiodev;
+
+     in_switch_display   = TRUE;
+     ctrl->flagbuttonbox = gtk_vbox_new (FALSE, 0);
+
+     if (mixer_fd == -1) {
+        audiodev = g_getenv ("AUDIODEV");
+        if (audiodev == NULL) {
+          mixer_fd = open ("/dev/audioctl", O_RDWR | O_NONBLOCK);
+        } else {
+          gchar *device = g_strdup (audiodev);
+          mixer_fd = open (device, O_RDWR | O_NONBLOCK);
+          g_free (device);
+        }
+     }
+
+     if (ioctl (mixer_fd, AUDIO_GETINFO, &ainfo) < 0)
+        g_warning ("Error getting audio device information");
+
+     if (ainfo.record.avail_ports & AUDIO_MICROPHONE) {
+        /* SUN_BRANDING */
+        in_microphone_button = gtk_radio_button_new_with_mnemonic (NULL, _("Micro_phone"));
+        first_button         = GTK_RADIO_BUTTON (in_microphone_button);
+
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), in_microphone_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (in_microphone_button), "toggled",
+                          G_CALLBACK (sun_in_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_microphone_button),
+           ainfo.record.port & AUDIO_MICROPHONE);
+        gtk_widget_show (in_microphone_button);
+     }
+
+     if (ainfo.record.avail_ports & AUDIO_LINE_IN) {
+        if (first_button != NULL) {
+           in_line_in_button = gtk_radio_button_new_with_mnemonic_from_widget
+              /* SUN_BRANDING */
+              (first_button, _("_Line In"));
+         } else {
+           /* SUN_BRANDING */
+           in_line_in_button = gtk_radio_button_new_with_mnemonic (NULL, _("_Line In"));
+           first_button = GTK_RADIO_BUTTON (in_line_in_button);
+        }
+
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), in_line_in_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (in_line_in_button), "toggled",
+                          G_CALLBACK (sun_in_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_line_in_button),
+           ainfo.record.port & AUDIO_LINE_IN);
+        gtk_widget_show (in_line_in_button);
+     }
+
+     if (ainfo.record.avail_ports & AUDIO_CD) {
+        if (first_button != NULL) {
+           in_cd_button = gtk_radio_button_new_with_mnemonic_from_widget
+              /* SUN_BRANDING */
+              (first_button, _("_Internal CD"));
+        } else {
+           /* SUN_BRANDING */
+           in_cd_button = gtk_radio_button_new_with_mnemonic (NULL, _("_Internal CD"));
+           first_button = GTK_RADIO_BUTTON (in_cd_button);
+        }
+
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), in_cd_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (in_cd_button), "toggled",
+                          G_CALLBACK (sun_in_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_cd_button),
+           ainfo.record.port & AUDIO_CD);
+        gtk_widget_show (in_cd_button);
+     }
+
+     if (ainfo.record.avail_ports & AUDIO_SPDIF_IN) {
+        if (first_button != NULL) {
+           in_spdif_button = gtk_radio_button_new_with_mnemonic_from_widget
+              /* SUN_BRANDING */
+              (first_button, _("_SPDIF In"));
+        } else {
+           /* SUN_BRANDING */
+           in_spdif_button = gtk_radio_button_new_with_mnemonic (NULL, _("_SPDIF In"));
+           first_button = GTK_RADIO_BUTTON (in_spdif_button);
+        }
+
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), in_spdif_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (in_spdif_button), "toggled",
+                          G_CALLBACK (sun_in_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_spdif_button),
+           ainfo.record.port & AUDIO_SPDIF_IN);
+        gtk_widget_show (in_spdif_button);
+     }
+
+     if (ainfo.record.avail_ports & AUDIO_AUX1_IN) {
+        if (first_button != NULL) {
+           in_aux1_button = gtk_radio_button_new_with_mnemonic_from_widget
+              /* SUN_BRANDING */
+              (first_button, _("AUX_1 Input"));
+        } else {
+           /* SUN_BRANDING */
+           in_aux1_button = gtk_radio_button_new_with_mnemonic (NULL, _("AUX_1 Input"));
+           first_button = GTK_RADIO_BUTTON (in_aux1_button);
+        }
+
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), in_aux1_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (in_aux1_button), "toggled",
+                          G_CALLBACK (sun_in_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_aux1_button),
+           ainfo.record.port & AUDIO_AUX1_IN);
+        gtk_widget_show (in_aux1_button);
+     }
+
+     if (ainfo.record.avail_ports & AUDIO_AUX2_IN) {
+        if (first_button != NULL) {
+           in_aux2_button = gtk_radio_button_new_with_mnemonic_from_widget
+              /* SUN_BRANDING */
+              (first_button, _("AUX_2 Input"));
+        } else {
+           /* SUN_BRANDING */
+           in_aux2_button = gtk_radio_button_new_with_mnemonic (NULL, _("AUX_2 Input"));
+           first_button = GTK_RADIO_BUTTON (in_aux2_button);
+        }
+
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), in_aux2_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (in_aux2_button), "toggled",
+                          G_CALLBACK (sun_in_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_aux2_button),
+           ainfo.record.port & AUDIO_AUX2_IN);
+        gtk_widget_show (in_aux2_button);
+     }
+
+     if (ainfo.record.avail_ports & AUDIO_CODEC_LOOPB_IN) {
+        if (first_button != NULL) {
+           in_codec_button = gtk_radio_button_new_with_mnemonic_from_widget
+              /* SUN_BRANDING */
+              (first_button, _("_Codec Loopback"));
+        } else {
+           /* SUN_BRANDING */
+           in_codec_button = gtk_radio_button_new_with_mnemonic (NULL, _("_Codec Loopback"));
+           first_button = GTK_RADIO_BUTTON (in_codec_button);
+        }
+
+        gtk_box_pack_start (GTK_BOX (ctrl->flagbuttonbox), in_codec_button,
+                            FALSE, FALSE, 0);
+        g_signal_connect (G_OBJECT (in_codec_button), "toggled",
+                          G_CALLBACK (sun_in_button_cb), NULL);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (in_codec_button),
+           ainfo.record.port & AUDIO_CODEC_LOOPB_IN);
+        gtk_widget_show (in_codec_button);
+     }
+
+     gtk_widget_show (ctrl->flagbuttonbox);
+  }
+#endif
+
   return ctrl;
 }
 
--- /tmp/gst-mixer/track.h	2007-09-25 11:41:52.921649297 -0500
+++ gnome-media-2.20.1/gst-mixer/src/track.h	2007-09-25 11:42:57.259582000 -0500
@@ -47,7 +47,8 @@ typedef struct _GnomeVolumeControlTrack 
 	    *sliderbox,
 	    *buttonbox,
 	    *toggle,
-	    *options;
+	    *options,
+	    *flagbuttonbox;
 
   GnomeVolumeControlButton *mute, *record;
 
@@ -105,6 +106,10 @@ void	gnome_volume_control_track_free		(G
 void	gnome_volume_control_track_show		(GnomeVolumeControlTrack *track,
 						 gboolean  visible);
 
+#ifdef __sun
+void    sun_reset_buttons                       (gboolean sun_interface);
+#endif
+
 G_END_DECLS
 
 #endif /* __GVC_TRACK_H__ */
