static gboolean
gst_sunaudiosrc_close (GstAudioSrc * asrc)
{
  GstSunAudioSrc *sunaudiosrc = GST_SUNAUDIO_SRC (asrc);

  close (sunaudiosrc->fd);
  sunaudiosrc->fd = -1;

  if (sunaudiosrc->mixer) {
    gst_sunaudiomixer_ctrl_free (sunaudiosrc->mixer);
    sunaudiosrc->mixer = NULL;
  }

  return TRUE;
}
GstSunAudioMixerCtrl *
gst_sunaudiomixer_ctrl_new (const char *device)
{
  GstSunAudioMixerCtrl *ret = NULL;

  g_return_val_if_fail (device != NULL, NULL);

  ret = g_new0 (GstSunAudioMixerCtrl, 1);

  ret->device = g_strdup (device);
  ret->mixer_fd = -1;
  ret->tracklist = NULL;

  if (!gst_sunaudiomixer_ctrl_open (ret))
    goto error;

  return ret;

error:
  if (ret)
    gst_sunaudiomixer_ctrl_free (ret);

  return NULL;
}