- update to 0.2.41

- replace audio(4) backend with sio_open(3) (libsndio) backend

update by ajacoutot, new backend from me
This commit is contained in:
jakemsr 2008-12-20 08:58:32 +00:00
parent 368b3deb14
commit 2eebabbd75
12 changed files with 231 additions and 283 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.44 2008/03/31 01:05:54 jakemsr Exp $
# $OpenBSD: Makefile,v 1.45 2008/12/20 08:58:32 jakemsr Exp $
# $FreeBSD: Makefile,v 1.8 1999/03/09 01:08:46 nectar Exp $
COMMENT= sound library for Enlightenment
DISTNAME= esound-0.2.38
DISTNAME= esound-0.2.41
PKGNAME= ${DISTNAME}v0
SHARED_LIBS += esd 2.40 # .2.38
CATEGORIES= audio
@ -18,7 +18,7 @@ PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= c m wrap
WANTLIB= c m sndio wrap
FLAVORS= arts
FLAVOR?=
@ -47,10 +47,9 @@ FAKE_FLAGS= DESTDIR=${WRKINST} \
esdconfdir=${PREFIX}/share/examples/esound
post-extract:
@cp -f ${FILESDIR}/audio_sun.c ${WRKSRC}
@cp -f ${FILESDIR}/audio_sndio.c ${WRKSRC}
pre-configure:
@perl -pi -e 's|_LOCALBASE_|${LOCALBASE}|' \
${WRKSRC}/test-script
${SUBST_CMD} ${WRKSRC}/test-script
.include <bsd.port.mk>

View File

@ -1,5 +1,5 @@
MD5 (esound-0.2.38.tar.gz) = d8TpgFoBf7oGVSSH3zxmYg==
RMD160 (esound-0.2.38.tar.gz) = OwL3H38UZcIECjzwETbzHWJnfmE=
SHA1 (esound-0.2.38.tar.gz) = QFQ9y1sVcsdwKwuwt1aEQEY1G6U=
SHA256 (esound-0.2.38.tar.gz) = SKOU83d2M2JmBnlKUpTwHilOERTWzD54lMapDyImsGc=
SIZE (esound-0.2.38.tar.gz) = 519964
MD5 (esound-0.2.41.tar.gz) = PYlz7YcFPXrMH01EryxGiA==
RMD160 (esound-0.2.41.tar.gz) = 6TxjJLSj6DIFcCsGLcFKwQ2Kxso=
SHA1 (esound-0.2.41.tar.gz) = sq9p63wKBpdyCqGrkoXBbcvYvIY=
SHA256 (esound-0.2.41.tar.gz) = KjLev/636gdKZlckHwIq8CrF6xYPiyepmr+qXWnOI84=
SIZE (esound-0.2.41.tar.gz) = 518632

View File

@ -0,0 +1,134 @@
/* $OpenBSD: audio_sndio.c,v 1.1 2008/12/20 08:58:32 jakemsr Exp $ */
/*
* Copyright (c) 2008 Jacob Meuser <jakemsr@sdf.lonestar.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.h"
#include <sndio.h>
struct sio_hdl *hdl = NULL;
#define ARCH_esd_audio_close
void esd_audio_close()
{
if (hdl != NULL) {
sio_close(hdl);
hdl = NULL;
}
}
#define ARCH_esd_audio_open
int esd_audio_open()
{
char *device;
struct sio_par par;
int mode = SIO_PLAY;
if (hdl != NULL) {
fprintf(stderr, "sndio already opened\n");
return(1);
}
sio_initpar(&par);
if ((esd_audio_format & ESD_MASK_FUNC) == ESD_RECORD)
mode |= SIO_REC;
device = esd_audio_device ? esd_audio_device : getenv("AUDIODEVICE");
if ((hdl = sio_open(device, mode, 0)) == NULL) {
fprintf(stderr, "sio_open failed\n");
goto bad;
}
par.le = (BYTE_ORDER == 4321) ? 0 : 1;
if ((esd_audio_format & ESD_MASK_BITS) == ESD_BITS16) {
par.bits = 16;
par.sig = 1;
} else {
par.bits = 8;
par.sig = 0;
}
par.pchan = (((esd_audio_format & ESD_MASK_CHAN) == ESD_STEREO) ? 2 : 1);
if (mode & SIO_REC)
par.rchan = par.pchan;
par.appbufsz = ESD_BUF_SIZE;
par.rate = esd_audio_rate;
if (!sio_setpar(hdl, &par)) {
fprintf(stderr, "sio_setpar failed\n");
goto bad;
}
if (!sio_getpar(hdl, &par)) {
fprintf(stderr, "sio_getpar failed\n");
goto bad;
}
/* check that the actual parameters are what we asked for */
if (fabs(par.rate - esd_audio_rate) > esd_audio_rate * 0.05) {
fprintf(stderr, "Unsupported rate: %i Hz\n", esd_audio_rate);
goto bad;
}
if ((esd_audio_format & ESD_MASK_BITS) == ESD_BITS16) {
if (par.sig != 1 || par.bits != 16) {
fprintf(stderr, "Unsupported bits: 16\n");
goto bad;
}
} else {
if (par.sig != 0 || par.bits != 8) {
fprintf(stderr, "Unsupported bits: 8\n");
goto bad;
}
}
if ((esd_audio_format & ESD_MASK_CHAN) == ESD_STEREO) {
if (par.pchan != 2) {
fprintf(stderr, "Unsupported channels: 2\n");
goto bad;
}
} else {
if (par.pchan != 1) {
fprintf(stderr, "Unsupported channels: 1\n");
goto bad;
}
}
if (!sio_start(hdl)) {
fprintf(stderr, "sio_start failed\n");
goto bad;
}
return(1);
bad:
esd_audio_close();
return(-1);
}
#define ARCH_esd_audio_write
int esd_audio_write(void *buffer, int buf_size)
{
return sio_write(hdl, buffer, buf_size);
}
#define ARCH_esd_audio_read
int esd_audio_read(void *buffer, int buf_size)
{
return sio_read(hdl, buffer, buf_size);
}

View File

@ -1,165 +0,0 @@
/* $OpenBSD: audio_sun.c,v 1.4 2008/03/31 01:05:54 jakemsr Exp $ */
/*
* Copyright (c) 2002 CubeSoft Communications, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Neither the name of CubeSoft Communications, nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/audioio.h>
#include <string.h>
static void sun_panic(int fd, char *s)
{
perror(s);
close(fd);
esd_audio_fd = -1;
}
#define ARCH_esd_audio_devices
const char *esd_audio_devices()
{
return "/dev/audio";
}
#define ARCH_esd_audio_open
int esd_audio_open()
{
const char *device;
int afd = -1;
int fmt = 0, channels = 0, bits = 0;
int mode = O_WRONLY;
audio_info_t info;
AUDIO_INITINFO(&info);
/* set the appropriate mode */
if((esd_audio_format & ESD_MASK_FUNC) == ESD_RECORD) {
mode = O_RDWR;
info.mode = AUMODE_PLAY | AUMODE_PLAY_ALL | AUMODE_RECORD;
} else {
info.mode = AUMODE_PLAY | AUMODE_PLAY_ALL;
}
/* open the sound device */
device = esd_audio_device ? esd_audio_device : "/dev/audio";
if ((afd = open(device, mode, 0)) == -1) {
perror(device);
return( -2 );
}
/* set the requested mode */
if(ioctl(afd, AUDIO_SETINFO, &info) < 0) {
sun_panic(afd, "AUDIO_SETINFO");
return(-1);
}
/* set full-duplex mode if we are recording */
if ( (esd_audio_format & ESD_MASK_FUNC) == ESD_RECORD ) {
if (ioctl(afd, AUDIO_SETFD, 1) == -1) {
sun_panic(afd, "AUDIO_SETFD");
return(-1);
}
}
/* pick a supported encoding */
if ((esd_audio_format & ESD_MASK_BITS) == ESD_BITS16) {
bits = 16;
fmt = (BYTE_ORDER == 4321) ?
AUDIO_ENCODING_SLINEAR_BE : AUDIO_ENCODING_SLINEAR_LE;
} else {
bits = 8;
fmt = (BYTE_ORDER == 4321) ?
AUDIO_ENCODING_ULINEAR_BE : AUDIO_ENCODING_ULINEAR_LE;
}
info.play.encoding = fmt;
info.play.precision = bits;
if(ioctl(afd, AUDIO_SETINFO, &info) == -1) {
fprintf(stderr, "Unsupported encoding: %i-bit (0x%x)\n",
bits, fmt);
sun_panic(afd, "SETINFO");
return(-1);
}
/* number of channels */
channels = (((esd_audio_format & ESD_MASK_CHAN) == ESD_STEREO)
? /* stereo */ 2
: /* mono */ 1);
info.play.channels = channels;
if((esd_audio_format & ESD_MASK_FUNC) == ESD_RECORD) {
info.record.channels = channels;
}
if(ioctl(afd, AUDIO_SETINFO, &info) == -1) {
fprintf(stderr, "Unsupported channel count: %d\n",
channels);
sun_panic(afd, "SETINFO");
return(-1);
}
/* blocksize, sync to internal esd buffer size */
info.blocksize = ESD_BUF_SIZE;
info.hiwat = 4;
if(ioctl(afd, AUDIO_SETINFO, &info) < 0) {
fprintf(stderr, "Unsupported blocksize: %d\n",
info.blocksize);
sun_panic(afd, "SETINFO");
return(-1);
}
/* finally, set the sample rate */
info.play.sample_rate = esd_audio_rate;
if(ioctl(afd, AUDIO_SETINFO, &info) < 0 ||
fabs(info.play.sample_rate - esd_audio_rate) > esd_audio_rate * 0.05) {
fprintf(stderr, "Unsupported rate: %i Hz\n", esd_audio_rate);
sun_panic(afd, "SETINFO");
return(-1);
}
return(esd_audio_fd = afd);
}
#define ARCH_esd_audio_pause
void esd_audio_pause()
{
audio_info_t info;
int afd = esd_audio_fd;
AUDIO_INITINFO(&info);
if(ioctl(afd, AUDIO_GETINFO, &info) < 0) {
sun_panic(afd, "AUDIO_GETINFO");
return;
}
if((info.mode & AUMODE_PLAY) == AUMODE_PLAY)
info.play.pause = !info.play.pause;
if((info.mode & AUMODE_RECORD) == AUMODE_RECORD)
info.record.pause = !info.record.pause;
return;
}

View File

@ -1,39 +1,12 @@
$OpenBSD: patch-audio_c,v 1.5 2008/03/31 01:05:54 jakemsr Exp $
--- audio.c.orig Thu Apr 19 17:43:59 2007
+++ audio.c Sat Jun 2 23:15:49 2007
@@ -20,34 +20,7 @@ static int esd_audio_fd = -1;
/*******************************************************************/
/* returns audio_fd for use by main prog - platform dependent */
-/* ALSA before OSS as ALSA is OSS compatible */
-#if defined(DRIVER_ALSA_09)
-# include "audio_alsa09.c"
-#elif defined(DRIVER_ALSA) || defined(DRIVER_NEWALSA)
-# include "audio_alsa.c"
-#elif defined(DRIVER_OSS)
-# include "audio_oss.c"
-#elif defined(DRIVER_AIX)
-# include "audio_aix.c"
-#elif defined(DRIVER_IRIX)
-# include "audio_irix.c"
-#elif defined(DRIVER_HPUX)
-# include "audio_hpux.c"
-#elif defined(DRIVER_OSF)
-# include "audio_osf.c"
-#elif defined(DRIVER_SOLARIS)
-# include "audio_solaris.c"
-#elif defined(DRIVER_MKLINUX)
-# include "audio_mklinux.c"
-#elif defined(DRIVER_DART)
-# include "audio_dart.c"
-#elif defined(DRIVER_COREAUDIO)
-# include "audio_coreaudio.c"
-#elif defined(DRIVER_ARTS)
-# include "audio_arts.c"
-#else
-# include "audio_none.c"
-#endif
+#include "audio_sun.c"
/*******************************************************************/
/* display available devices */
$OpenBSD: patch-audio_c,v 1.6 2008/12/20 08:58:32 jakemsr Exp $
--- audio.c.orig Sat Dec 20 00:19:22 2008
+++ audio.c Sat Dec 20 00:19:22 2008
@@ -31,6 +31,8 @@ static int esd_write_size = ESD_BUF_SIZE;
# include "audio_alsa.c"
#elif defined(DRIVER_OSS)
# include "audio_oss.c"
+#elif defined(DRIVER_SNDIO)
+# include "audio_sndio.c"
#elif defined(DRIVER_AIX)
# include "audio_aix.c"
#elif defined(DRIVER_IRIX)

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-clients_c,v 1.1 2008/03/31 01:05:54 jakemsr Exp $
--- clients.c.orig Sun Mar 9 16:25:22 2008
+++ clients.c Sun Mar 9 16:28:43 2008
@@ -141,9 +141,9 @@ int get_new_clients( int listen )
$OpenBSD: patch-clients_c,v 1.2 2008/12/20 08:58:32 jakemsr Exp $
--- clients.c.orig Sun Dec 14 13:33:21 2008
+++ clients.c Sun Dec 14 13:35:02 2008
@@ -143,9 +143,9 @@ int get_new_clients( int listen )
struct sockaddr_in incoming;
#if defined (ENABLE_IPV6)
struct sockaddr_in6 incoming6;
@ -12,13 +12,4 @@ $OpenBSD: patch-clients_c,v 1.1 2008/03/31 01:05:54 jakemsr Exp $
+ socklen_t size_in = sizeof(struct sockaddr_in);
esd_client_t *new_client = NULL;
unsigned long addr;
@@ -186,7 +186,7 @@ int get_new_clients( int listen )
if (esd_use_tcpip)
{
struct request_info req;
- struct servent *serv;
+ /* struct servent *serv; */
request_init( &req, RQ_DAEMON, "esound", RQ_FILE, fd, NULL );
fromhost( &req );
short port;

View File

@ -1,7 +1,28 @@
$OpenBSD: patch-configure_ac,v 1.3 2008/03/31 01:05:54 jakemsr Exp $
--- configure.ac.orig Thu May 3 13:47:30 2007
+++ configure.ac Sun Mar 9 20:03:26 2008
@@ -301,21 +301,16 @@ if test "x$enable_local_sound" = "xyes"; then
$OpenBSD: patch-configure_ac,v 1.4 2008/12/20 08:58:32 jakemsr Exp $
--- configure.ac.orig Sat Dec 20 00:22:32 2008
+++ configure.ac Sat Dec 20 00:22:38 2008
@@ -202,6 +202,7 @@ if test "x$enable_local_sound" = "xyes"; then
echo "---------------------------------------------------------------------"
echo "--- Checking to see which audio header files your system uses.";
echo "--- Most of these checks should fail. Do not be alarmed.";
+ AC_CHECK_HEADERS(sndio.h)
AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h sys/audio.h)
AC_CHECK_HEADERS(sys/audioio.h sys/audio.io.h sun/audioio.h)
AC_CHECK_HEADERS(dmedia/audio.h sys/soundlib.h sys/asoundlib.h alsa/asoundlib.h)
@@ -215,6 +216,12 @@ if test "x$enable_local_sound" = "xyes"; then
dnl Define the driver needed based on the first header file found
+ if test "${ac_cv_header_sndio_h}" = "yes"; then
+ found_sound=yes
+ AC_DEFINE(DRIVER_SNDIO, 1, [Defined if libsndio backend is enabled])
+ SOUND_LIBS="-lsndio"
+ fi
+
if test x"$enable_oss" = xyes ; then
if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \
test "${ac_cv_header_soundcard_h}" = "yes" || \
@@ -299,7 +306,7 @@ if test "x$enable_local_sound" = "xyes"; then
if test "x$HAVE_ARTS" = "xyes"; then
found_sound=yes
CFLAGS="$CFLAGS $ARTSC_CFLAGS"
@ -10,21 +31,18 @@ $OpenBSD: patch-configure_ac,v 1.3 2008/03/31 01:05:54 jakemsr Exp $
AC_DEFINE(DRIVER_ARTS, 1, [Defined if Arts backend is enabled])
fi
fi
- if test "$found_sound" = "no"; then
- AC_MSG_ERROR([Could not find a support sound driver])
- fi
-
dnl Check for additional audio libs needed
@@ -313,7 +320,9 @@ if test "x$enable_local_sound" = "xyes"; then
echo "---------------------------------------------------------------------"
echo "--- Checking to see which audio libraries are required for linking.";
echo "--- Most of these checks should also fail. Do not be alarmed.";
- AC_CHECK_FUNC(_oss_ioctl,,[AC_CHECK_LIB(ossaudio,_oss_ioctl)])
+ if test "x$enable_oss" = "xyes"; then
+ AC_CHECK_FUNC(_oss_ioctl,,[AC_CHECK_LIB(ossaudio,_oss_ioctl)])
+ fi
AC_CHECK_FUNC(ALnewconfig,,[AC_CHECK_LIB(audio,ALnewconfig)])
if test "x$enable_alsa" = "xyes"; then
AC_CHECK_FUNC(snd_cards,,[AC_CHECK_LIB(sound,snd_cards)])
@@ -393,7 +388,8 @@ if test "x$with_libwrap" = "xyes"; then
@@ -391,7 +400,8 @@ if test "x$with_libwrap" = "xyes"; then
wrap_ok=no
AC_TRY_LINK(
@ -34,7 +52,7 @@ $OpenBSD: patch-configure_ac,v 1.3 2008/03/31 01:05:54 jakemsr Exp $
#include <syslog.h>
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;],
@@ -403,7 +399,8 @@ int deny_severity = LOG_WARNING;],
@@ -401,7 +411,8 @@ int deny_severity = LOG_WARNING;],
wrap_ok=yes],
[LIBS="$LIBS -lnsl"
AC_TRY_LINK(

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-esd_c,v 1.3 2008/03/31 01:05:54 jakemsr Exp $
--- esd.c.orig Thu May 3 13:28:35 2007
+++ esd.c Sun Mar 9 21:54:55 2008
@@ -274,12 +274,12 @@ struct stat dir_stats;
$OpenBSD: patch-esd_c,v 1.4 2008/12/20 08:58:32 jakemsr Exp $
--- esd.c.orig Tue Nov 18 21:35:19 2008
+++ esd.c Sun Dec 14 13:40:03 2008
@@ -287,12 +287,12 @@ struct stat dir_stats;
#if defined(S_ISVTX)
#define ESD_UNIX_SOCKET_DIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|\

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-esdlib_c,v 1.1 2008/03/31 01:05:54 jakemsr Exp $
--- esdlib.c.orig Thu Apr 19 07:43:59 2007
+++ esdlib.c Sun Mar 9 23:39:06 2008
@@ -769,7 +769,7 @@ int esd_open_sound( const char *host )
sprintf(cmd, "%s/esd %s -spawnfd %d", SERVERDIR, esd_spawn_options?esd_spawn_options:"", esd_pipe[1]);
$OpenBSD: patch-esdlib_c,v 1.2 2008/12/20 08:58:32 jakemsr Exp $
--- esdlib.c.orig Sun Dec 14 13:35:12 2008
+++ esdlib.c Sun Dec 14 13:35:42 2008
@@ -935,7 +935,7 @@ int esd_open_sound( const char *rhost )
* not included in the waiting time
*/
setsid();
- execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
+ execl("/bin/sh", "/bin/sh", "-c", cmd, (char *)NULL);
perror("execl");

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-test-script,v 1.5 2008/03/31 01:05:54 jakemsr Exp $
$OpenBSD: patch-test-script,v 1.6 2008/12/20 08:58:32 jakemsr Exp $
--- test-script.orig Thu Apr 19 07:43:59 2007
+++ test-script Sun Mar 9 16:23:07 2008
@@ -1,4 +1,4 @@
-#!/bin/tcsh
+#!/usr/local/bin/tcsh
+#!${LOCALBASE}/bin/tcsh
echo welcome to the test.
echo ""

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-util_c,v 1.5 2008/03/31 01:05:54 jakemsr Exp $
--- util.c.orig Thu Apr 19 17:43:59 2007
+++ util.c Sat Jun 2 23:38:31 2007
$OpenBSD: patch-util_c,v 1.6 2008/12/20 08:58:32 jakemsr Exp $
--- util.c.orig Sun Dec 14 13:35:48 2008
+++ util.c Sun Dec 14 13:39:45 2008
@@ -1,5 +1,8 @@
#include "config.h"
#include "esd.h"
@ -10,34 +10,32 @@ $OpenBSD: patch-util_c,v 1.5 2008/03/31 01:05:54 jakemsr Exp $
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
@@ -23,38 +26,31 @@ have_ipv6(void) {
@@ -24,36 +27,31 @@ have_ipv6(void) {
const char*
esd_get_socket_dirname (void)
{
- const char *audiodev;
- const char *audiodev = NULL;
- static char *dirname = NULL;
+ static char *sockdir = NULL, sockdirbuf[PATH_MAX];
+ struct passwd *pw;
- if (dirname == NULL) {
- if (!(audiodev = getenv("AUDIODEV"))) {
- audiodev = "";
- } else {
- char *newdev = strrchr(audiodev, '/');
- if (newdev != NULL) {
- audiodev = newdev++;
- }
- }
- dirname = malloc(strlen(audiodev) + sizeof("/tmp/.esd"));
- strcpy(dirname, "/tmp/.esd");
- strcat(dirname, audiodev);
- if (dirname == NULL) {
- if ((audiodev = getenv("AUDIODEV"))) {
- char *newdev = strrchr(audiodev, '/');
- if (newdev != NULL) {
- audiodev = newdev++;
- }
- } else
- audiodev = "";
- dirname = malloc(strlen(audiodev) + 40);
- sprintf (dirname, "/tmp/.esd%s-%i", audiodev, getuid());
+ if (sockdir != NULL)
+ return sockdir;
+ pw = getpwuid(getuid());
+ if (pw == NULL || pw->pw_dir == NULL) {
+ fprintf(stderr, "esd: could not find home directory\n");
+ exit(1);
}
}
-
- return dirname;
+ snprintf(sockdirbuf, sizeof(sockdirbuf), "%s/.esd", pw->pw_dir);

View File

@ -1,14 +1,14 @@
@comment $OpenBSD: PLIST,v 1.18 2008/03/31 01:05:54 jakemsr Exp $
bin/esd
@comment $OpenBSD: PLIST,v 1.19 2008/12/20 08:58:32 jakemsr Exp $
@bin bin/esd
bin/esd-config
bin/esdcat
bin/esdctl
bin/esdfilt
bin/esdloop
bin/esdmon
bin/esdplay
bin/esdrec
bin/esdsample
@bin bin/esdcat
@bin bin/esdctl
@bin bin/esdfilt
@bin bin/esdloop
@bin bin/esdmon
@bin bin/esdplay
@bin bin/esdrec
@bin bin/esdsample
include/esd.h
lib/libesd.a
lib/libesd.la