? libgstsunaudio_la-gstsunaudio.loT
Index: gstsunaudiosrc.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/sys/sunaudio/gstsunaudiosrc.c,v
retrieving revision 1.2
diff -u -p -r1.2 gstsunaudiosrc.c
--- gstsunaudiosrc.c	28 Jul 2006 08:32:47 -0000	1.2
+++ gstsunaudiosrc.c	14 Sep 2006 12:08:28 -0000
@@ -42,10 +42,12 @@
 #include "config.h"
 #endif
 
+#include <sys/types.h>
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
 #include <stropts.h>
+#include <sys/mixer.h>
 
 #include "gstsunaudiosrc.h"
 
@@ -241,15 +243,23 @@ static gboolean
 gst_sunaudiosrc_open (GstAudioSrc * asrc)
 {
   GstSunAudioSrc *sunaudiosrc = GST_SUNAUDIO_SRC (asrc);
-  int fd, ret;
+  int fd, ret, fd_flags;
 
   fd = open (sunaudiosrc->device, O_RDWR | O_NONBLOCK);
 
-  if (fd == -1) {
-    GST_ELEMENT_ERROR (sunaudiosrc, RESOURCE, OPEN_READ, (NULL),
-        ("can't open connection to Sun Audio device %s", sunaudiosrc->device));
+  if (fd == -1)
+    goto open_failed;
 
-    return FALSE;
+  if (ioctl (fd, AUDIO_MIXER_MULTIPLE_OPEN) == -1) {
+    GST_WARNING_OBJECT (asrc, "failed to set AUDIO_MIXER_MULTIPLE_OPEN: %s"
+        g_strerror (errno));
+    goto open_failed;
+  }
+
+  fd_flags = fcntl (fd, F_GETFD);
+  if (fd_flags == -1 || fcntl (fd, F_SETFD, fd_flags & (~O_NONBLOCK)) == -1) {
+    GST_WARNING_OBJECT (asrc, "fcntl failed: %s", g_strerror (errno));
+    goto open_failed;
   }
 
   sunaudiosrc->fd = fd;
@@ -299,6 +309,14 @@ gst_sunaudiosrc_open (GstAudioSrc * asrc
   }
 
   return TRUE;
+
+/* ERRORS */
+open_failed:
+  {
+    GST_ELEMENT_ERROR (sunaudiosrc, RESOURCE, OPEN_READ, (NULL),
+        ("can't open connection to Sun Audio device %s", sunaudiosrc->device));
+    return FALSE;
+  }
 }
 
 static gboolean
