]> git.alsa-project.org Git - alsa-oss.git/commitdiff
Cleanup - the libaoss.so shouldn't depend on libasound.so
authorJaroslav Kysela <perex@perex.cz>
Thu, 26 Feb 2004 10:52:40 +0000 (10:52 +0000)
committerJaroslav Kysela <perex@perex.cz>
Thu, 26 Feb 2004 10:52:40 +0000 (10:52 +0000)
alsa/alsa-local.h [new file with mode: 0644]
alsa/alsa-oss-emul.h
alsa/alsa-oss.c
alsa/mixer.c
alsa/pcm.c

diff --git a/alsa/alsa-local.h b/alsa/alsa-local.h
new file mode 100644 (file)
index 0000000..e5c89aa
--- /dev/null
@@ -0,0 +1,20 @@
+#include "alsa-oss-emul.h"
+
+#if 1
+#define DEBUG_POLL
+#define DEBUG_SELECT
+#ifdef NEW_MACRO_VARARGS
+#define DEBUG(...) do { if (alsa_oss_debug) fprintf(stderr, __VA_ARGS__); } while (0)
+#else /* !NEW_MACRO_VARARGS */
+#define DEBUG(args...) do { if (alsa_oss_debug) fprintf(stderr, ##args); } while (0)
+#endif
+#else
+#ifdef NEW_MACRO_VARARGS
+#define DEBUG(...)
+#else /* !NEW_MACRO_VARARGS */
+#define DEBUG(args...)
+#endif
+#endif
+
+extern int alsa_oss_debug;
+extern snd_output_t *alsa_oss_debug_out;
index 5fbd906dce5994b526a416353921ba93efc8df1f..756f50b4a1f713ed36df0ab90a078fd89caee1f1 100644 (file)
 #define NEW_MACRO_VARARGS
 #endif
 
-#if 1
-#define DEBUG_POLL
-#define DEBUG_SELECT
-#ifdef NEW_MACRO_VARARGS
-#define DEBUG(...) do { if (alsa_oss_debug) fprintf(stderr, __VA_ARGS__); } while (0)
-#else /* !NEW_MACRO_VARARGS */
-#define DEBUG(args...) do { if (alsa_oss_debug) fprintf(stderr, ##args); } while (0)
-#endif
-#else
-#ifdef NEW_MACRO_VARARGS
-#define DEBUG(...)
-#else /* !NEW_MACRO_VARARGS */
-#define DEBUG(args...)
-#endif
-#endif
-
 #define OSS_MAJOR              14
 #define OSS_DEVICE_MIXER       0
 #define OSS_DEVICE_SEQUENCER   1
@@ -78,7 +62,4 @@ extern int lib_oss_mixer_open(const char *pathname, int flags, ...);
 extern int lib_oss_mixer_close(int fd);
 extern int lib_oss_mixer_ioctl(int fd, unsigned long int request, ...);
 
-extern int alsa_oss_debug;
-extern snd_output_t *alsa_oss_debug_out;
-
 #endif /* __ALSA_OSS_EMUL_H */
index 1005f19b308e1cd40e6fec9bdfb7605585cc1495..497e7e4d254e95f44925d617f1c32e54aca1d072 100644 (file)
 #include <sys/mman.h>
 #include <stdarg.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <dlfcn.h>
 #include <stdio.h>
-#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
 #include <limits.h>
 #include <errno.h>
 #include <assert.h>
-#include <linux/soundcard.h>
-#include <alsa/asoundlib.h>
 
 #include "alsa-oss-emul.h"
 
+#ifndef ATTRIBUTE_UNUSED
+/** do not print warning (gcc) when function parameter is not used */
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+#if 1
+#define DEBUG_POLL
+#define DEBUG_SELECT
+#ifdef NEW_MACRO_VARARGS
+#define DEBUG(...) do { if (oss_wrapper_debug) fprintf(stderr, __VA_ARGS__); } while (0)
+#else /* !NEW_MACRO_VARARGS */
+#define DEBUG(args...) do { if (oss_wrapper_debug) fprintf(stderr, ##args); } while (0)
+#endif
+#else
+#ifdef NEW_MACRO_VARARGS
+#define DEBUG(...)
+#else /* !NEW_MACRO_VARARGS */
+#define DEBUG(args...)
+#endif
+#endif
+
 int (*_select)(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
 int (*_poll)(struct pollfd *ufds, unsigned int nfds, int timeout);
 int (*_open)(const char *file, int oflag, ...);
@@ -76,6 +97,7 @@ typedef struct {
        void *mmap_area;
 } fd_t;
 
+static int oss_wrapper_debug = 0;
 static int open_max;
 static int poll_fds_add = 0;
 static fd_t **fds;
@@ -407,7 +429,7 @@ int poll(struct pollfd *pfds, unsigned long nfds, int timeout)
        if (direct)
                return _poll(pfds, nfds, timeout);
 #ifdef DEBUG_POLL
-       if (alsa_oss_debug) {
+       if (oss_wrapper_debug) {
                fprintf(stderr, "Orig enter ");
                dump_poll(pfds, nfds, timeout);
                fprintf(stderr, "Changed enter ");
@@ -450,7 +472,7 @@ int poll(struct pollfd *pfds, unsigned long nfds, int timeout)
                        count1++;
        }
 #ifdef DEBUG_POLL
-       if (alsa_oss_debug) {
+       if (oss_wrapper_debug) {
                fprintf(stderr, "Changed exit ");
                dump_poll(pfds1, nfds1, timeout);
                fprintf(stderr, "Orig exit ");
@@ -529,7 +551,7 @@ int select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds,
        if (direct)
                return _select(nfds, rfds, wfds, efds, timeout);
 #ifdef DEBUG_SELECT
-       if (alsa_oss_debug) {
+       if (oss_wrapper_debug) {
                fprintf(stderr, "Orig enter ");
                dump_select(nfds, rfds, wfds, efds, timeout);
                fprintf(stderr, "Changed enter ");
@@ -598,7 +620,7 @@ int select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds,
                        count1++;
        }
 #ifdef DEBUG_SELECT
-       if (alsa_oss_debug) {
+       if (oss_wrapper_debug) {
                fprintf(stderr, "Changed exit ");
                dump_select(nfds1, rfds1, wfds1, efds1, timeout);
                fprintf(stderr, "Orig exit ");
@@ -676,7 +698,7 @@ static void initialize()
                return;
        s = getenv("ALSA_OSS_DEBUG");
        if (s)
-               alsa_oss_debug = 1;
+               oss_wrapper_debug = 1;
        open_max = sysconf(_SC_OPEN_MAX);
        if (open_max < 0)
                exit(1);
index c0e86ccdb595576bf1108bf107fa6574a764a4a5..f018362a6adce61c49b561d0a0b3e54597fede5c 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/soundcard.h>
 #include <alsa/asoundlib.h>
 
-#include "alsa-oss-emul.h"
+#include "alsa-local.h"
 
 typedef struct _oss_mixer {
        int fileno;
index 8f7faf2443899127352004325f2ca5023b8778c4..5d1a324e1d99eb72c9f04cc6be002c7e313defa8 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/soundcard.h>
 #include <alsa/asoundlib.h>
 
-#include "alsa-oss-emul.h"
+#include "alsa-local.h"
 
 int alsa_oss_debug = 0;
 snd_output_t *alsa_oss_debug_out = NULL;