From d1981e9fa5c39ce069249489ec3336bad86a86a1 Mon Sep 17 00:00:00 2001 From: atmos4 Date: Tue, 28 May 2002 01:52:40 +0000 Subject: aRts audio out support by Michele Balistreri git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6215 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/Makefile | 2 +- libao2/ao_arts.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++ libao2/audio_out.c | 6 +++ 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 libao2/ao_arts.c (limited to 'libao2') 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 + * + * This driver is distribuited under terms of GPL + * + */ + +#include +#include + +#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 ", + "" +}; + +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<