aboutsummaryrefslogtreecommitdiffstats
path: root/android/config
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-07-28 12:20:14 -0700
committerDavid 'Digit' Turner <digit@android.com>2010-08-27 05:40:08 -0700
commit415a4b1f54f896bf28abe1beb2d8005a3d98f531 (patch)
tree417214fffb0be3e0f9e150fd74d83bf8bcaa1997 /android/config
parent3f16680b70d6c065fd2c1672ae324a49c5d1d316 (diff)
downloadexternal_qemu-415a4b1f54f896bf28abe1beb2d8005a3d98f531.zip
external_qemu-415a4b1f54f896bf28abe1beb2d8005a3d98f531.tar.gz
external_qemu-415a4b1f54f896bf28abe1beb2d8005a3d98f531.tar.bz2
Add a PulseAudio audio backend for Linux.
Change-Id: Ifaf876c41ab6c7275ba7d1dc8e12139f62840cd6
Diffstat (limited to 'android/config')
-rw-r--r--android/config/check-pulseaudio.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/android/config/check-pulseaudio.c b/android/config/check-pulseaudio.c
new file mode 100644
index 0000000..c696ecf
--- /dev/null
+++ b/android/config/check-pulseaudio.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/* this file is used to test that we can use libesd with lazy dynamic linking */
+
+#include <esd.h>
+#include <dlfcn.h>
+#include <stdio.h>
+
+#define D(...) fprintf(stderr,__VA_ARGS__)
+#define STRINGIFY(x) _STRINGIFY(x)
+#define _STRINGIFY(x) #x
+
+#define PULSEAUDIO_SYMBOLS \
+ PULSEAUDIO_SYMBOLS(pa_simple*,pa_simple_new,(const char* server,const char* name, pa_stream_direction_t dir, const char* dev, const char* stream_name, const pa_sample_spec* ss, const pa_channel_map* map, const pa_buffer_attr *attr, int *error)) \
+ PULSEAUDIO_SYMBOLS(void,pa+simple_free,(pa_simple* s))\
+ PULSEAUDIO_SYMBOLS(int,pa_simple_write,(pa_simple* s, const void* data, size_t bytes, int* error))\
+ PULSEAUDIO_SYMBOLS(int,pa_simple_read,(pa_simple* s,void* data, size_t bytes, int* error))\
+ PULSEAUDIO_SYMBOLS(const char*,pa_strerror,(int error))
+
+/* define pointers to library functions we're going to use */
+#define PULSEAUDIO_FUNCTION(ret,name,sig) \
+ static ret (*func_ ## name)sig;
+
+PULSEAUDIO_SYMBOLS
+
+#undef PULSEAUDIO_FUNCTION
+static void* pa_lib;
+
+int main( void )
+{
+ int fd;
+
+ pa_lib = dlopen( "libpulse-simple.so", RTLD_NOW );
+ if (pa_lib == NULL)
+ pa_lib = dlopen( "libpulse-simple.so.0", RTLD_NOW );
+
+ if (pa_lib == NULL) {
+ D("could not find libpulse on this system");
+ return 1;
+ }
+
+#undef PULSEAUDIO_FUNCTION
+#define PULSEAUDIO_FUNCTION(ret,name,sig) \
+ do { \
+ (func_ ##name) = dlsym( pa_lib, STRINGIFY(name) ); \
+ if ((func_##name) == NULL) { \
+ D("could not find %s in libpulse\n", STRINGIFY(name)); \
+ return 1; \
+ } \
+ } while (0);
+
+ PULSEAUDIO_SYMBOLS
+
+ return 0;
+}