openbsd-ports/audio/pulseaudio/patches/patch-src_modules_module-detect_c
ajacoutot 5fea016b26 Update to pulseaudio-1.0.
Some refactoring: only enable what we really need (that is ossaudio(4)
for mixer control and events playing) -- disable everything else (avahi,
dbus, consolekit, x11, gconf...)

ok robert@ (maintainer)
2011-10-01 08:37:30 +00:00

46 lines
1.1 KiB
Plaintext

$OpenBSD: patch-src_modules_module-detect_c,v 1.3 2011/10/01 08:37:30 ajacoutot Exp $
--- src/modules/module-detect.c.orig Thu Sep 1 10:28:14 2011
+++ src/modules/module-detect.c Fri Sep 30 14:50:32 2011
@@ -118,6 +118,7 @@ static int detect_alsa(pa_core *c, int just_one) {
#endif
#ifdef HAVE_OSS_OUTPUT
+#if !defined(__OpenBSD__)
static int detect_oss(pa_core *c, int just_one) {
FILE *f;
int n = 0, b = 0;
@@ -175,6 +176,33 @@ static int detect_oss(pa_core *c, int just_one) {
fclose(f);
return n;
}
+#else
+static int detect_oss(pa_core *c, int just_one) {
+ struct stat s;
+ const char *dev;
+ char args[64];
+
+ dev = getenv("AUDIODEVICE");
+ if (!dev)
+ dev = "/dev/audio";
+
+ if (stat(dev, &s) < 0) {
+ if (errno != ENOENT)
+ pa_log_error("failed to open device %s: %s", dev, pa_cstrerror(errno));
+ return -1;
+ }
+
+ if (!S_ISCHR(s.st_mode))
+ return 0;
+
+ pa_snprintf(args, sizeof(args), "device=%s", dev);
+
+ if (!pa_module_load(c, "module-oss", args))
+ return 0;
+
+ return 1;
+}
+#endif
#endif
#ifdef HAVE_SOLARIS