Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  9 Nov 2005 14:47:23 +0100 (CET)
From:      Jean-Yves Lefort <jylefort@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        erik@smluc.org
Subject:   ports/88728: Update port: audio/openal (fix OSS support, add support for other backends)
Message-ID:  <20051109134723.77D34C157@jsite.lefort.net>
Resent-Message-ID: <200511091350.jA9DoDQq054210@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         88728
>Category:       ports
>Synopsis:       Update port: audio/openal (fix OSS support, add support for other backends)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 09 13:50:13 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Jean-Yves Lefort
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD jsite.lefort.net 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Tue Nov 8 17:13:42 CET 2005 jylefort@jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386
>Description:
- Fix OSS support:
    OpenAL uses a buffer size of 1024 bytes, which is too small on
    some systems and/or with some applications, causing heavy drops in
    the audio output. I solve the problem by using the value returned
    by SNDCTL_DSP_GETBLKSIZE rather than 1024.
- Add options for enabling aRts, esd, SDL, vorbis and smpeg support
- Enable capture
- Fix info file handling (install in post-install, and do not use
  install-info since bsd.port.mk takes care of it)
>How-To-Repeat:
>Fix:
diff -ruN /usr/ports/audio/openal/Makefile openal/Makefile
--- /usr/ports/audio/openal/Makefile	Sun Aug 28 14:50:01 2005
+++ openal/Makefile	Wed Nov  9 13:14:11 2005
@@ -7,6 +7,7 @@
 
 PORTNAME=	openal
 PORTVERSION=	20050401
+PORTREVISION=	1
 CATEGORIES=	audio
 MASTER_SITES=	http://math.missouristate.edu/~erik/files/fbsd/\
 		http://www.smluc.org/~erik/files/fbsd/
@@ -19,16 +20,59 @@
 WRKSRC=		${WRKDIR}/${DISTNAME}/linux
 GNU_CONFIGURE=	yes
 CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
+CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib"
+CONFIGURE_ARGS=	--enable-capture
 USE_GMAKE=	yes
 USE_GNOME=	pkgconfig
+WANT_SDL=	yes
 INSTALLS_SHLIB=	yes
 USE_REINPLACE=	yes
 
+OPTIONS=	ARTS "aRts backend" off \
+		ESD "esd backend" off \
+		SDL "SDL backend" off \
+		VORBIS "vorbis support" off \
+		SMPEG "smpeg support" off
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_SMPEG)
+WITH_SDL=	yes	# smpeg requires SDL
+.endif
+
+.if defined(WITH_ARTS)
+LIB_DEPENDS+=	artsc.0:${PORTSDIR}/audio/arts
+CONFIGURE_ARGS+=--enable-arts
+.endif
+
+.if defined(WITH_ESD)
+USE_GNOME+=	esound
+CONFIGURE_ARGS+=--enable-esd
+.endif
+
+.if defined(WITH_SDL)
+USE_SDL+=	sdl
+CONFIGURE_ENV+=	HAVESDL="${SDL_CONFIG}"
+CONFIGURE_ARGS+=--enable-sdl
+.endif
+
+.if defined(WITH_VORBIS)
+LIB_DEPENDS+=	vorbisfile.4:${PORTSDIR}/audio/libvorbis
+CONFIGURE_ARGS+=--enable-vorbis
+.endif
+
+.if defined(WITH_SMPEG)
+LIB_DEPENDS+=	smpeg.1:${PORTSDIR}/multimedia/smpeg
+CONFIGURE_ARGS+=--enable-smpeg
+.endif
+
 post-patch:
-	@${REINPLACE_CMD} -e "s/-pthread/${PTHREAD_LIBS}/" ${WRKSRC}/configure
+	@${REINPLACE_CMD} -e 's/-pthread/${PTHREAD_LIBS}/; \
+		/CPPFLAGS=/ d' ${WRKSRC}/configure
+	@${REINPLACE_CMD} -e '/#include/ s|SDL/||' \
+		${WRKSRC}/src/extensions/al_ext_mp3.c
 
-pre-install:
-	@${INSTALL_DATA} ${WRKSRC}/doc/openal.info ${PREFIX}/info
-	@install-info ${PREFIX}/info/openal.info ${PREFIX}/info/dir
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/doc/openal.info ${PREFIX}/info
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -ruN /usr/ports/audio/openal/files/patch-src_arch_bsd_bsd__dsp.c openal/files/patch-src_arch_bsd_bsd__dsp.c
--- /usr/ports/audio/openal/files/patch-src_arch_bsd_bsd__dsp.c	Thu Jan  1 01:00:00 1970
+++ openal/files/patch-src_arch_bsd_bsd__dsp.c	Wed Nov  9 14:12:15 2005
@@ -0,0 +1,58 @@
+--- src/arch/bsd/bsd_dsp.c.orig	Wed Nov  9 13:15:27 2005
++++ src/arch/bsd/bsd_dsp.c	Wed Nov  9 14:09:12 2005
+@@ -113,7 +113,6 @@
+  */
+ void *grab_write_native(void) {
+ 	const char *dsppath = "/dev/dsp";
+-	int divisor = _alSpot(_AL_DEF_BUFSIZ) | (2<<16);
+ 
+ 	dsp_fd = open(dsppath, O_WRONLY | O_NONBLOCK);
+ 
+@@ -126,10 +125,6 @@
+ 		perror("fcntl");
+ 	}
+ 
+-	if(ioctl(dsp_fd, SNDCTL_DSP_SETFRAGMENT, &divisor) < 0) {
+-		perror("ioctl SETFRAGMENT");
+-	}
+-
+ 	_alBlitBuffer = native_blitbuffer;
+ 
+ 	FD_ZERO(&dsp_fd_set);
+@@ -320,10 +315,11 @@
+ }
+ 
+ ALboolean set_write_native(UNUSED(void *handle),
+-		     UNUSED(unsigned int *bufsiz),
++		     unsigned int *bufsiz,
+ 		     ALenum *fmt,
+ 		     unsigned int *speed) {
+ 	ALuint channels = _al_ALCHANNELS(*fmt);
++	int divisor;
+ 
+ 	if(dsp_fd < 0) {
+ 		return AL_FALSE;
+@@ -365,6 +361,23 @@
+ 
+ 
+ 	*fmt = BSD2ALFMT(*fmt, channels);
++
++	if(ioctl(dsp_fd, SNDCTL_DSP_GETBLKSIZE, bufsiz) < 0) {
++#ifdef DEBUG_MAXIMUS
++		fprintf(stderr, "blksize %d\n", *bufsiz);
++		perror("get_devsp blksize ioctl");
++#endif
++		return AL_FALSE;
++	}
++
++	divisor = _alSpot(*bufsiz) | (2<<16);
++	if(ioctl(dsp_fd, SNDCTL_DSP_SETFRAGMENT, &divisor) < 0) {
++#ifdef DEBUG_MAXIMUS
++		fprintf(stderr, "divisor %d\n", divisor);
++		perror("set_devsp fragment ioctl");
++#endif
++		return AL_FALSE;
++	}
+ 
+ 	return AL_TRUE;
+ }
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051109134723.77D34C157>