1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
diff --git config/autoconf.mk.in config/autoconf.mk.in
index 44c0b06..748511b 100644
--- config/autoconf.mk.in
+++ config/autoconf.mk.in
@@ -536,9 +536,14 @@ MOZ_LIBNOTIFY_CFLAGS = @MOZ_LIBNOTIFY_CFLAGS@
MOZ_LIBNOTIFY_LIBS = @MOZ_LIBNOTIFY_LIBS@
MOZ_ENABLE_LIBNOTIFY = @MOZ_ENABLE_LIBNOTIFY@
+MOZ_ALSA = @MOZ_ALSA@
MOZ_ALSA_LIBS = @MOZ_ALSA_LIBS@
MOZ_ALSA_CFLAGS = @MOZ_ALSA_CFLAGS@
+MOZ_PULSEAUDIO = @MOZ_PULSEAUDIO@
+MOZ_PULSEAUDIO_LIBS = @MOZ_PULSEAUDIO_LIBS@
+MOZ_PULSEAUDIO_CFLAGS = @MOZ_PULSEAUDIO_CFLAGS@
+
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GLIB_GMODULE_LIBS = @GLIB_GMODULE_LIBS@
diff --git configure.in configure.in
index 5980b76..11f5f77 100644
--- configure.in
+++ configure.in
@@ -5600,13 +5600,45 @@ dnl ========================================================
dnl = Check alsa availability on Linux if using sydneyaudio
dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(alsa,
+[ --enable-alsa Enable Alsa support (default on Linux)],
+MOZ_ALSA=1,
+MOZ_ALSA= MOZ_ALSA_FORCE=$enableval)
+
dnl If using sydneyaudio with Linux, ensure that the alsa library is available
-if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
+if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux" -a "$MOZ_ALSA_FORCE" != "no"; then
+ MOZ_ALSA=1
+fi
+
+if test -n "$MOZ_ALSA"; then
+ AC_DEFINE(MOZ_CUBEB)
PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
[echo "$MOZ_ALSA_PKG_ERRORS"
AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
fi
+AC_SUBST(MOZ_ALSA)
+
+dnl ========================================================
+dnl = Enable PulseAudio
+dnl ========================================================
+
+MOZ_ARG_ENABLE_BOOL(pulseaudio,
+[ --enable-pulseaudio Enable PulseAudio support],
+MOZ_PULSEAUDIO=1,
+MOZ_PULSEAUDIO=)
+
+if test -n "$MOZ_PULSEAUDIO"; then
+ AC_DEFINE(MOZ_CUBEB)
+ PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
+ [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
+ AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
+fi
+
+AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
+AC_SUBST(MOZ_PULSEAUDIO_LIBS)
+AC_SUBST(MOZ_PULSEAUDIO)
+
dnl ========================================================
dnl = Enable GStreamer
dnl ========================================================
diff --git media/libcubeb/src/Makefile.in media/libcubeb/src/Makefile.in
index 5ab4dd8..c8df26f 100644
--- media/libcubeb/src/Makefile.in
+++ media/libcubeb/src/Makefile.in
@@ -24,10 +24,6 @@ endif
ifeq ($(OS_TARGET),Android)
# No Android implementation of libcubeb yet.
-else ifeq ($(OS_TARGET),Linux)
-CSRCS = \
- cubeb_alsa.c \
- $(NULL)
endif
ifeq ($(OS_TARGET),Darwin)
@@ -42,4 +38,16 @@ CSRCS = \
$(NULL)
endif
+ifdef MOZ_ALSA
+CSRCS = \
+ cubeb_alsa.c \
+ $(NULL)
+endif
+
+ifdef MOZ_PULSEAUDIO
+CSRCS = \
+ cubeb_pulse.c \
+ $(NULL)
+endif
+
include $(topsrcdir)/config/rules.mk
diff --git media/libcubeb/src/cubeb_alsa.c media/libcubeb/src/cubeb_alsa.c
index 599aea2..41fd5af 100644
--- media/libcubeb/src/cubeb_alsa.c
+++ media/libcubeb/src/cubeb_alsa.c
@@ -6,6 +6,6 @@
#undef NDEBUG
#define _BSD_SOURCE
-#define _POSIX_SOURCE
+#define _XOPEN_SOURCE 500
#include <pthread.h>
#include <sys/time.h>
#include <assert.h>
diff --git media/libsydneyaudio/src/Makefile.in media/libsydneyaudio/src/Makefile.in
index 8dda8ce..b19641d 100644
--- media/libsydneyaudio/src/Makefile.in
+++ media/libsydneyaudio/src/Makefile.in
@@ -30,10 +30,6 @@ else ifeq ($(MOZ_WIDGET_TOOLKIT),android)
CSRCS = \
sydney_audio_android.c \
$(NULL)
-else ifeq ($(OS_ARCH),Linux)
-CSRCS = \
- sydney_audio_alsa.c \
- $(NULL)
endif
ifeq ($(OS_ARCH),WINNT)
@@ -68,6 +64,18 @@ CSRCS = \
$(NULL)
endif
+ifdef MOZ_ALSA
+CSRCS = \
+ sydney_audio_alsa.c \
+ $(NULL)
+endif
+
+ifdef MOZ_PULSEAUDIO
+CSRCS = \
+ sydney_audio_pulseaudio.c \
+ $(NULL)
+endif
+
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += winmm.lib
endif
diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in
index 43384e9..e46a6e3 100644
--- toolkit/library/Makefile.in
+++ toolkit/library/Makefile.in
@@ -379,10 +379,13 @@ endif
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib)
-ifdef MOZ_SYDNEYAUDIO
-ifeq ($(OS_ARCH),Linux)
+ifneq (,$(MOZ_CUBEB)$(MOZ_SYDNEYAUDIO))
+ifdef MOZ_ALSA
EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS)
endif
+ifdef MOZ_PULSEAUDIO
+EXTRA_DSO_LDOPTS += $(MOZ_PULSEAUDIO_LIBS)
+endif
endif
ifdef HAVE_CLOCK_MONOTONIC
|