diff options
author | atmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-05-28 01:52:40 +0000 |
---|---|---|
committer | atmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-05-28 01:52:40 +0000 |
commit | d1981e9fa5c39ce069249489ec3336bad86a86a1 (patch) | |
tree | 4fb7fd0d12ad49079f3a3cafdef1fd67d7710f03 | |
parent | 1a2a9139f96333963abb21452a2241bd5e410167 (diff) | |
download | mpv-d1981e9fa5c39ce069249489ec3336bad86a86a1.tar.bz2 mpv-d1981e9fa5c39ce069249489ec3336bad86a86a1.tar.xz |
aRts audio out support by Michele Balistreri <brain at email.it>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6215 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | configure | 25 | ||||
-rw-r--r-- | libao2/Makefile | 2 | ||||
-rw-r--r-- | libao2/ao_arts.c | 117 | ||||
-rw-r--r-- | libao2/audio_out.c | 6 |
5 files changed, 150 insertions, 2 deletions
@@ -42,7 +42,7 @@ endif V_LIBS = $(X_LIB) $(MP1E_LIB) $(GGI_LIB) $(MLIB_LIB) $(SDL_LIB) $(SVGA_LIB) $(AA_LIB) $(DIRECTFB_LIB) AO_LIBS = -Llibao2 -lao2 -A_LIBS = $(ALSA_LIB) $(NAS_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(SGIAUDIO_LIB) +A_LIBS = $(ALSA_LIB) $(ARTS_LIB) $(NAS_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(SGIAUDIO_LIB) CODEC_LIBS = -Llibmpcodecs -lmpcodecs -Lmp3lib -lMP3 -Lliba52 -la52 -Llibmpeg2 -lmpeg2 $(AV_LIB) $(FAME_LIB) COMMON_LIBS = $(CODEC_LIBS) -Llibmpdemux -lmpdemux $(NEW_INPUT_LIB) $(LIB_LOADER) $(A_LIBS) $(CSS_LIB) $(ARCH_LIB) -Lpostproc -lpostproc $(DECORE_LIB) -Llinux -losdep $(TERMCAP_LIB) $(STREAMING_LIB) $(Z_LIB) $(GTK_LIBS) $(PNG_LIB) $(JPEG_LIB) $(GIF_LIB) -lm @@ -185,6 +185,7 @@ Video: Audio: --disable-ossaudio disable OSS sound support [autodetect] + --disable-arts disable aRts sound support [autodetect] --disable-alsa disable alsa sound support [autodetect] --disable-sunaudio disable Sun sound support [autodetect] --disable-mad disable mad audio support [autodetect] @@ -838,6 +839,7 @@ _dxr3=auto _iconv=auto _rtc=auto _ossaudio=auto +_arts=auto _mad=auto _vorbis=auto _faad=auto @@ -948,6 +950,8 @@ for ac_option do --disable-libdv) _libdv=no ;; --enable-ossaudio) _ossaudio=yes ;; --disable-ossaudio) _ossaudio=no ;; + --enable-arts) _arts=yes ;; + --disable-arts) _arts=no ;; --enable-mad) _mad=yes ;; --disable-mad) _mad=no ;; --enable-vorbis) _vorbis=yes ;; @@ -2672,6 +2676,24 @@ fi echores "$_ossaudio" +echocheck "aRts" +if test "$_arts" = auto ; then + _arts=no + if ( artsc-config --version >> /dev/null ) ; then + _arts=yes + fi +fi + +if test "$_arts" = yes ; then + _def_arts='#define USE_ARTS 1' + _aosrc="$_aosrc ao_arts.c" + _aomodules="arts $_aomodules" + _ld_arts=`artsc-config --libs` + _inc_arts=`artsc-config --cflags` +fi +echores "$_arts" + + echocheck "ALSA audio" if test "$_alsa" != no ; then _alsa=no @@ -3808,6 +3830,8 @@ AA_LIB = $_ld_aa ALSA_LIB = $_ld_alsa NAS_LIB = $_ld_nas MAD_LIB = $_ld_mad +ARTS_LIB = $_ld_arts +ARTS_INC = $_inc_arts VORBIS_LIB = $_ld_vorbis FAAD_LIB = $_ld_faad SGIAUDIO_LIB = $_ld_sgiaudio @@ -4066,6 +4090,7 @@ $_def_ossaudio_devdsp $_def_ossaudio_devmixer $_def_alsa5 $_def_alsa9 +$_def_arts $_def_sys_asoundlib_h $_def_alsa_asoundlib_h $_def_sunaudio diff --git a/libao2/Makefile b/libao2/Makefile index 372cc907fc..118f455b54 100644 --- a/libao2/Makefile +++ b/libao2/Makefile @@ -8,7 +8,7 @@ SRCS=afmt.c audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c ao_plugin.c pl_delay.c p OBJS=$(SRCS:.c=.o) -CFLAGS = $(OPTFLAGS) -I. -I.. $(SDL_INC) $(X11_INC) $(EXTRA_INC) $(DXR2_INC) $(DVB_INC) +CFLAGS = $(OPTFLAGS) -I. -I.. $(ARTS_INC) $(SDL_INC) $(X11_INC) $(EXTRA_INC) $(DXR2_INC) $(DVB_INC) .SUFFIXES: .c .o diff --git a/libao2/ao_arts.c b/libao2/ao_arts.c new file mode 100644 index 0000000000..6fa6b88cf0 --- /dev/null +++ b/libao2/ao_arts.c @@ -0,0 +1,117 @@ +/* + * ao_arts - aRts audio output driver for MPlayer + * + * Michele Balistreri <brain87@gmx.net> + * + * This driver is distribuited under terms of GPL + * + */ + +#include <artsc.h> +#include <stdio.h> + +#include "audio_out.h" +#include "audio_out_internal.h" +#include "afmt.h" +#include "../config.h" +#include "../mp_msg.h" + +#define OBTAIN_BITRATE(a) (((a != AFMT_U8) || (a != AFMT_S8)) ? 16 : 8) + +static arts_stream_t stream; + +static ao_info_t info = +{ + "aRts audio output", + "arts", + "Michele Balistreri <brain87@gmx.net>", + "" +}; + +LIBAO_EXTERN(arts) + +static int control(int cmd, int arg) +{ + return(CONTROL_UNKNOWN); +} + +static int init(int rate_hz, int channels, int format, int flags) +{ + int err; + int frag_spec; + + if(err=arts_init()) { + mp_msg(MSGT_AO, MSGL_ERR, "AO: [arts] %s\n", arts_error_text(err)); + return 0; + } + + else + mp_msg(MSGT_AO, MSGL_INFO, "AO: [arts] Connected to sound server\n"); + + ao_data.format = format; + ao_data.channels = channels; + ao_data.samplerate = rate_hz; + ao_data.bps = (rate_hz*channels); + ao_data.buffersize = 4096; + + if(format != AFMT_U8 && format != AFMT_S8) + ao_data.bps*=2; + + for (frag_spec = 0; (0x01<<frag_spec) < ao_data.buffersize; ++frag_spec) + ; + frag_spec |= 0x00020000; + stream=arts_play_stream(rate_hz, OBTAIN_BITRATE(format), channels, "Mplayer"); + arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec); + arts_stream_set(stream, ARTS_P_BLOCKING, 0); + + if(stream == NULL) { + mp_msg(MSGT_AO, MSGL_ERR, "AO: [arts] Unable to open a stream\n"); + return 0; + } + + else + mp_msg(MSGT_AO, MSGL_INFO, "AO: [arts] Stream opened\n"); + + + return 1; +} + +static void uninit() +{ + arts_close_stream(stream); + arts_free(); +} + +static int play(void* data,int len,int flags) +{ + arts_write(stream, data, len); +} + +static void audio_pause() +{ +} + +static void audio_resume() +{ +} + +static void reset() +{ +} + +static int get_space() +{ + return arts_stream_get(stream, ARTS_P_BUFFER_SPACE); +} + +static float get_delay() +{ + return ((float) arts_stream_get(stream, ARTS_P_BUFFER_SIZE) / (float) ao_data.bps); +} + + + + + + + diff --git a/libao2/audio_out.c b/libao2/audio_out.c index e1c8d6dd7c..8b861ede6b 100644 --- a/libao2/audio_out.c +++ b/libao2/audio_out.c @@ -12,6 +12,9 @@ char *ao_subdevice = NULL; #ifdef USE_OSS_AUDIO extern ao_functions_t audio_out_oss; #endif +#ifdef USE_ARTS +extern ao_functions_t audio_out_arts; +#endif extern ao_functions_t audio_out_null; #ifdef HAVE_ALSA5 extern ao_functions_t audio_out_alsa5; @@ -47,6 +50,9 @@ ao_functions_t* audio_out_drivers[] = #ifdef USE_OSS_AUDIO &audio_out_oss, #endif +#ifdef USE_ARTS + &audio_out_arts, +#endif #ifdef USE_SUN_AUDIO &audio_out_sun, #endif |