[xiph-cvs] cvs commit: ao/src/plugins/sun .cvsignore Makefile.am ao_sun.c
Jack Moffitt
jack at xiph.org
Thu May 17 08:28:45 PDT 2001
jack 01/05/17 08:28:45
Modified: . configure.in
src/plugins Makefile.am
Added: src/plugins/sun .cvsignore Makefile.am ao_sun.c
Log:
Added the ao Sun driver.
Patch from Christian Weisgerber <naddy at openbsd.org>
Revision Changes Path
1.19 +6 -1 ao/configure.in
Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/ao/configure.in,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- configure.in 2001/02/28 03:13:38 1.18
+++ configure.in 2001/05/17 15:28:44 1.19
@@ -141,6 +141,11 @@
fi
AC_SUBST(ALSA_LIBS)
+dnl Check for Sun audio
+
+AC_CHECK_HEADERS(sys/audioio.h)
+AM_CONDITIONAL(HAVE_SUN_AUDIO,test "${ac_cv_header_sys_audioio_h}" = yes)
+
dnl Check for aRts
AC_PATH_PROG(ARTSC_CONFIG, artsc-config)
@@ -168,4 +173,4 @@
CFLAGS="$CFLAGS -DAO_PLUGIN_PATH=\\\"$plugindir\\\""
-AC_OUTPUT(Makefile src/Makefile doc/Makefile include/Makefile include/ao/Makefile include/ao/os_types.h src/plugins/Makefile src/plugins/esd/Makefile src/plugins/oss/Makefile src/plugins/alsa/Makefile src/plugins/arts/Makefile debian/Makefile)
+AC_OUTPUT(Makefile src/Makefile doc/Makefile include/Makefile include/ao/Makefile include/ao/os_types.h src/plugins/Makefile src/plugins/esd/Makefile src/plugins/oss/Makefile src/plugins/alsa/Makefile src/plugins/sun/Makefile src/plugins/arts/Makefile debian/Makefile)
1.3 +1 -1 ao/src/plugins/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.am 2000/12/30 05:03:25 1.2
+++ Makefile.am 2001/05/17 15:28:44 1.3
@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = oss esd alsa arts # solaris irix
+SUBDIRS = oss sun esd alsa arts # irix
1.1 ao/src/plugins/sun/.cvsignore
Index: .cvsignore
===================================================================
*.la
.libs
.deps
*.lo
Makefile
Makefile.in
1.1 ao/src/plugins/sun/Makefile.am
Index: Makefile.am
===================================================================
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
if HAVE_SUN_AUDIO
unltlibs = libsun.la
sunldflags = -export-dynamic -avoid-version
sunsources = ao_sun.c
else
unltlibs =
sunldflags =
sunsources =
endif
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/include
libdir = $(plugindir)
lib_LTLIBRARIES = $(sunltlibs)
libsun_la_LDFLAGS = $(sunldflags)
libsun_la_SOURCES = $(sunsources)
EXTRA_DIST = ao_sun.c
1.1 ao/src/plugins/sun/ao_sun.c
Index: ao_sun.c
===================================================================
/*
*
* ao_sun.c Solaris/NetBSD/OpenBSD
*
* Original Copyright (C) Aaron Holtzman - May 1999
* Modifications Copyright (C) Stan Seibert - July 2000
* and Copyright (C) Christian Weisgerber - March 2001
*
* libao is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* libao is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <sys/types.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/audioio.h>
#ifndef AUDIO_ENCODING_SLINEAR
#define AUDIO_ENCODING_SLINEAR AUDIO_ENCODING_LINEAR /* Solaris */
#endif
#include <ao/ao.h>
ao_info_t ao_sun_info = {
"Sun audio driver output",
"sun",
"Christian Weisgerber <naddy at openbsd.org>",
"Outputs to the sun audio system."
};
typedef struct ao_sun_internal_s {
char *dev;
int fd;
} ao_sun_internal_t;
void ao_sun_parse_options(ao_sun_internal_t *state, ao_option_t *options)
{
state->dev = NULL;
while (options) {
if (!strcmp(options->key, "dev"))
state->dev = strdup(options->value);
options = options->next;
}
}
ao_internal_t *plugin_open(uint_32 bits, uint_32 rate, uint_32 channels, ao_option_t *options)
{
ao_sun_internal_t *state;
audio_info_t info;
state = malloc(sizeof(ao_sun_internal_t));
if (state == NULL) {
fprintf(stderr,"libao: Error allocating state memory: %s\n",
strerror(errno));
goto ERR;
}
ao_sun_parse_options(state, options);
if (state->dev != NULL) {
/* open the user-specified path */
state->fd = open(state->dev, O_WRONLY);
if (state->fd < 0) {
fprintf(stderr, "libao: Error opening audio device %s: %s\n",
state->dev, strerror(errno));
goto ERR;
}
} else {
/* default */
state->dev = strdup("/dev/audio");
state->fd = open(state->dev, O_WRONLY);
if (state->fd < 0) {
fprintf(stderr,
"libao: Could not open default device %s: %s\n",
state->dev, strerror(errno));
goto ERR;
}
}
AUDIO_INITINFO(&info);
#ifdef AUMODE_PLAY /* NetBSD/OpenBSD */
info.mode = AUMODE_PLAY;
#endif
info.play.encoding = AUDIO_ENCODING_SLINEAR;
info.play.precision = bits;
info.play.sample_rate = rate;
info.play.channels = channels;
if (ioctl(state->fd, AUDIO_SETINFO, &info) < 0) {
fprintf(stderr,
"libao: Cannot set device to %d bits, %d Hz, %d channels: %s\n",
bits, rate, channels, strerror(errno));
goto ERR;
}
return state;
ERR:
if (state != NULL) {
if (state->fd >= 0)
close(state->fd);
if (state->dev)
free(state->dev);
free(state);
}
return NULL;
}
void plugin_play(ao_internal_t *state, void *output_samples, uint_32 num_bytes)
{
write(((ao_sun_internal_t *)state)->fd, output_samples, num_bytes);
}
void plugin_close(ao_internal_t *state)
{
ao_sun_internal_t *s = (ao_sun_internal_t *)state;
close(s->fd);
free(s->dev);
free(s);
}
int plugin_get_latency(ao_internal_t *state)
{
/* dummy */
return 0;
}
ao_info_t *plugin_get_driver_info(void)
{
return &ao_sun_info;
}
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list