diff options
author | cladisch <cladisch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-02-27 10:09:05 +0000 |
---|---|---|
committer | cladisch <cladisch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-02-27 10:09:05 +0000 |
commit | 6ccd999a89ac91f1567dbd69d0ffd9c1ede7d121 (patch) | |
tree | bb83b75ac8e42f382fa7a2ccea1395daae01631b /libao2 | |
parent | 434f6b2347a92bc61108ca7355afe7f22f6a1854 (diff) | |
download | mpv-6ccd999a89ac91f1567dbd69d0ffd9c1ede7d121.tar.bz2 mpv-6ccd999a89ac91f1567dbd69d0ffd9c1ede7d121.tar.xz |
Output error messages from the ALSA library through mp_msg() instead of
the default stderr.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17692 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_alsa.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 7a7a65e7d3..4ed5779d65 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -15,6 +15,7 @@ #include <errno.h> #include <sys/time.h> #include <stdlib.h> +#include <stdarg.h> #include <math.h> #include <string.h> @@ -72,6 +73,25 @@ static int alsa_can_pause = 0; #undef BUFFERTIME #define SET_CHUNKSIZE +static void alsa_error_handler(const char *file, int line, const char *function, + int err, const char *format, ...) +{ + char tmp[0xc00]; + va_list va; + + va_start(va, format); + vsnprintf(tmp, sizeof tmp, format, va); + va_end(va); + tmp[sizeof tmp - 1] = '\0'; + + if (err) + mp_msg(MSGT_AO, MSGL_ERR, "alsa-lib: %s:%i:(%s) %s: %s\n", + file, line, function, tmp, snd_strerror(err)); + else + mp_msg(MSGT_AO, MSGL_ERR, "alsa-lib: %s:%i:(%s) %s\n", + file, line, function, tmp); +} + /* to set/get/query special features/parameters */ static int control(int cmd, void *arg) { @@ -275,6 +295,8 @@ static int init(int rate_hz, int channels, int format, int flags) #else mp_msg(MSGT_AO,MSGL_V,"alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); #endif + + snd_lib_error_set_handler(alsa_error_handler); if ((err = snd_card_next(&cards)) < 0 || cards < 0) { |