On Sun, Dec 02, 2007 at 05:10:29AM -0800, Bryan Linton wrote:
> On 2007-11-30 22:34:25, Jacob Meuser <[EMAIL PROTECTED]> wrote:
> > On Thu, Nov 29, 2007 at 03:00:10PM +0000, Christian Weisgerber wrote:
> > > Giovanni Bechis <[EMAIL PROTECTED]> wrote:
> > > 
> > > > Mpg123 updated to latest version,
> > > > files/* and patches/* are no more needed to build,
> > > 
> > > I looked into updating mpg123 a while back but got bogged down
> > > because the port has substantial audio-related patches my Marc
> > > Espie, and the function of these patches was far from clear.  Silently
> > > dropping them may not be the best course.
> > 
> > looks like a good test if the patches are needed would be to try playing
> > an 8-bit mono 22050Hz mp3 on azalia(4) or snapper(4).
> > 
> 
> The new version of mpg123 works for me on a Thinkpad T60's azalia(4).
> 

> shoshoni-m% mpg123 test-low.mp3
> High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
>       version 0.68; written and copyright by Michael Hipp and others
>       free software (LGPL/GPL) without any warranty but with best wishes
> 
> Playing MPEG stream 1 of 1: test-low.mp3 ...
> MPEG 2.0 layer III, 96 kbits/s, 22050 Hz mono
> 
> [3:25] Decoding of test-low.mp3 finished.
> 
> shoshoni-m% audioctl | grep play
> play.rate=22050

well, thanks for testing, but it seems I forgot a) mono playback has
been added to azalia and b) some azalia codecs support 22050 Hz sampling
rates.

I just tested this on an azalia that does not support 22050 Hz.  playing
a 22050 Hz stream with this update, it plays double speed.  previously
mpg123 would error out.  both new and old work correctly when -r 44100 is
used, and the update does work better with .pls files.

updated diff below checks that the device is correctly configured
instead of just assuming all is well if AUDIO_SETINFO didn't return
an error code.  also accounts for the fact that it is possible to
set the encoding to AUDIO_ENCODING_SLINEAR, but you will get back
AUIO_ENCODING_SLINEAR_LE or AUDIO_ENCODING_BE depending on machine
endianness.

with the added checks, if it tries to play something that isn't
supported by the hardware, it displays a matrix of supported formats/
sample rate/channels and then exits.

could someone try playing a 22050 Hz stream with snapper or tumbler
with this?

also could someone try this on arm?

-- 
[EMAIL PROTECTED]
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: Makefile
===================================================================
RCS file: /home/cvs/OpenBSD/ports/audio/mpg123/Makefile,v
retrieving revision 1.38
diff -u -r1.38 Makefile
--- Makefile    15 Sep 2007 21:26:02 -0000      1.38
+++ Makefile    9 Dec 2007 22:12:09 -0000
@@ -1,51 +1,31 @@
 # $OpenBSD: Makefile,v 1.38 2007/09/15 21:26:02 simon Exp $
 
-# mpg123 is unusable without FPU
-NOT_FOR_ARCHS= arm
-
 COMMENT=       mpeg audio 1/2 layer 1, 2 and 3 player
 
-DISTNAME=      mpg123-0.59r
-PKGNAME=       ${DISTNAME}p4
+DISTNAME=      mpg123-0.68
 CATEGORIES=    audio
-HOMEPAGE=      http://www.mpg123.de/
+HOMEPAGE=      http://www.mpg123.org/
 
-# Long, unclear license in ${WRKSRC}/COPYING.
-PERMIT_PACKAGE_CDROM=  No
+# LGPL
+PERMIT_PACKAGE_CDROM=  Yes
 PERMIT_PACKAGE_FTP=    Yes
-PERMIT_DISTFILES_CDROM=        No
+PERMIT_DISTFILES_CDROM=        Yes
 PERMIT_DISTFILES_FTP=  Yes
 WANTLIB=               c m
 
-MASTER_SITES=  http://www.mpg123.de/mpg123/ \
-               http://www-ti.informatik.uni-tuebingen.de/~hippm/mpg123/ \
-               ftp://ftp.tu-clausthal.de/pub/unix/audio/mpg123/ \
-               http://ftp.tu-clausthal.de/pub/unix/audio/mpg123
-MASTER_SITES0= ftp://ftp.kame.net/pub/kame/misc/
-
-PATCHFILES=    mpg123-059r-v6-20000713b.diff.gz:0
-PATCH_DIST_STRIP= -p1
+MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=mpg123/}
 
 FLAVORS=       esd
 FLAVOR?=
 
 .if ${FLAVOR:L:Mesd}
 LIB_DEPENDS=   esd.>=2::audio/esound
-ALL_TARGET=    openbsd-esd
 WANTLIB+=      audiofile
+CONFIGURE_ARGS=--with-audio=esd
 .else
-ALL_TARGET=    openbsd
+CONFIGURE_ARGS=--with-audio=sun
 .endif
 
-MAKE_FLAGS=    CC='${CC}'
-
-post-patch:
-       @cp ${FILESDIR}/audio_openbsd.c ${FILESDIR}/term.c ${WRKSRC}
-
-post-install:
-       ${INSTALL_DATA_DIR} ${PREFIX}/share/mpg123
-       ${INSTALL_DATA} ${WRKSRC}/COPYING ${PREFIX}/share/mpg123
-
-NO_REGRESS=    Yes
+CONFIGURE_STYLE=gnu
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /home/cvs/OpenBSD/ports/audio/mpg123/distinfo,v
retrieving revision 1.4
diff -u -r1.4 distinfo
--- distinfo    5 Apr 2007 15:37:43 -0000       1.4
+++ distinfo    9 Dec 2007 22:12:09 -0000
@@ -1,10 +1,5 @@
-MD5 (mpg123-0.59r.tar.gz) = ld9ZrRZR3SNG1J+vyDdH5w==
-MD5 (mpg123-059r-v6-20000713b.diff.gz) = uDDO/IgFyK2Cf3OYXAPSfw==
-RMD160 (mpg123-0.59r.tar.gz) = F9R8oE/crF4tcflcy9I7YbXtizw=
-RMD160 (mpg123-059r-v6-20000713b.diff.gz) = wZQlZty6+b1gWhVEtcOQ4n3BUMo=
-SHA1 (mpg123-0.59r.tar.gz) = wy/iQvRQbSGL0ZpRpANNqf3HlJM=
-SHA1 (mpg123-059r-v6-20000713b.diff.gz) = +rEUibahq3nWwpeHFh8cBeSS3As=
-SHA256 (mpg123-0.59r.tar.gz) = eseraW1eaSdlcGYeK0ROKVzdjCGvllYYMjhXolWwvpQ=
-SHA256 (mpg123-059r-v6-20000713b.diff.gz) = 
8TqCLMzNCMGpOg+cJp77h1PpnWNP2NxDH37LYJmAVZE=
-SIZE (mpg123-0.59r.tar.gz) = 159028
-SIZE (mpg123-059r-v6-20000713b.diff.gz) = 5600
+MD5 (mpg123-0.68.tar.gz) = Ab6pCi8Q4hHiikMx3x5uRQ==
+RMD160 (mpg123-0.68.tar.gz) = 1gUu057y10J8081uEcM0p5TXzvg=
+SHA1 (mpg123-0.68.tar.gz) = 39wogtf/uWAR82a8AU1WR9EfAbk=
+SHA256 (mpg123-0.68.tar.gz) = CKzb2YQvT/IdiP4SrB7ytrws+lv5mZ0CipW/U6F/HRE=
+SIZE (mpg123-0.68.tar.gz) = 652279
Index: files/audio_openbsd.c
===================================================================
RCS file: files/audio_openbsd.c
diff -N files/audio_openbsd.c
--- files/audio_openbsd.c       12 Jun 2003 22:25:59 -0000      1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,286 +0,0 @@
-/* $OpenBSD: audio_openbsd.c,v 1.6 2003/06/12 22:25:59 pvalchev Exp $ */
-/*-
- * Copyright (c) 1999 Marc Espie.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT 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 OPENBSD
- * PROJECT 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 <sys/types.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include <stdlib.h>
-
-#include <sys/ioctl.h>
-
-#include "mpg123.h"
-
-#include <sys/audioio.h>
-
-static void audio_set_format_helper(int fmt, audio_info_t *ainfo);
-
-static int audio_fd = -1;
-static int uptodate = 1;
-static int possible = 0;
-
-static audio_info_t ainfo;
-
-static void really_close_audio()
-{
-  if (audio_fd != -1)
-    close(audio_fd);
-}
-
-static void really_open_audio(struct audio_info_struct *ai)
-{
-  if (audio_fd == -1) {
-    audio_encoding_t cap;
-
-    if(!ai->device) {
-      if(getenv("AUDIODEV")) {
-       if(param.verbose > 1) 
-          fprintf(stderr,"Using audio-device value from AUDIODEV environment 
variable!\n");
-       ai->device = getenv("AUDIODEV");
-      }
-      else 
-       ai->device = "/dev/audio";
-    }
-    if ((audio_fd = open (ai->device, O_WRONLY)) == -1) {
-      fprintf (stderr, "Failed to open %.100s: %s\n", ai->device, 
-              strerror (errno));
-      return;
-    }
-    for (cap.index = 0; ioctl(audio_fd, AUDIO_GETENC, &cap) == 0; cap.index++) 
{
-      if (cap.flags & AUDIO_ENCODINGFLAG_EMULATED)
-       continue;
-      switch(cap.encoding) {
-      case AUDIO_ENCODING_ULAW:
-       possible |= AUDIO_FORMAT_ULAW_8;
-       break;
-      case AUDIO_ENCODING_ALAW:
-       possible |= AUDIO_FORMAT_ALAW_8;
-       break;
-      case AUDIO_ENCODING_SLINEAR:
-      case AUDIO_ENCODING_SLINEAR_BE:
-      case AUDIO_ENCODING_SLINEAR_LE:
-       if (cap.precision == 8)
-         possible |= AUDIO_FORMAT_SIGNED_8;
-       else
-         possible |= AUDIO_FORMAT_SIGNED_16;
-       break;
-      case AUDIO_ENCODING_ULINEAR:
-      case AUDIO_ENCODING_ULINEAR_BE:
-      case AUDIO_ENCODING_ULINEAR_LE:
-       if (cap.precision == 8)
-         possible |= AUDIO_FORMAT_UNSIGNED_8;
-       else
-         possible |= AUDIO_FORMAT_UNSIGNED_16;
-       break;
-      }
-    }
-    atexit(really_close_audio);
-  }
-}
-  
-int audio_open(struct audio_info_struct *ai)
-{
-  really_open_audio(ai);
-
-  ai->fn = audio_fd;
-  if(ai->fn < 0)
-     return ai->fn;
-
-  AUDIO_INITINFO(&ainfo);
-  uptodate = 0;
-  {
-    audio_device_t ad;
-    if(ioctl(ai->fn, AUDIO_GETDEV, &ad) == -1)
-      return -1;
-    if(param.verbose > 1)
-      fprintf(stderr,"Audio device type: %s\n",ad.name);
-  }
-
-  if(audio_reset_parameters(ai) < 0) {
-    return -1;
-  }
-
-  if(ai->output > 0)
-    ainfo.play.port = 0;
-  if(ai->output & AUDIO_OUT_INTERNAL_SPEAKER)
-    ainfo.play.port |= AUDIO_SPEAKER;
-  if(ai->output & AUDIO_OUT_HEADPHONES)
-    ainfo.play.port |= AUDIO_HEADPHONE;
-  if(ai->output & AUDIO_OUT_LINE_OUT)
-    ainfo.play.port |= AUDIO_LINE_OUT;
-
-  return ai->fn;
-}
-
-int audio_reset_parameters(struct audio_info_struct *ai)
-{
-  if(ai->rate != -1)
-    ainfo.play.sample_rate = ai->rate;
-  if(ai->channels >= 0)
-    ainfo.play.channels = ai->channels;
-  audio_set_format_helper(ai->format,&ainfo);
-  uptodate = 0;
-
-  return 0;
-}
-
-int audio_rate_best_match(struct audio_info_struct *ai)
-{
-  audio_info_t ainfo;
- 
-  ainfo.play.sample_rate = ai->rate;
-  if(ioctl(ai->fn, AUDIO_SETINFO, &ainfo) < 0) {
-    ai->rate = 0;
-    return 0;
-  }
-  if(ioctl(ai->fn, AUDIO_GETINFO, &ainfo) < 0) {
-    return -1;
-  }
-  ai->rate = ainfo.play.sample_rate;
-  uptodate = 1;
-  return 0;
-}
-
-int audio_set_rate(struct audio_info_struct *ai)
-{
-  audio_info_t ainfo;
-
-  if(ai->rate != -1) {
-    ainfo.play.sample_rate = ai->rate;
-    uptodate = 0;
-    return 0;
-  }
-  return -1;
-}
-
-int audio_set_channels(struct audio_info_struct *ai)
-{
-  audio_info_t ainfo;
-
-  ainfo.play.channels = ai->channels;
-  uptodate = 0;
-  return 0;
-}
-
-static void audio_set_format_helper(int fmt, audio_info_t *ainfo)
-{
-  switch(fmt) {
-    case -1:
-    case AUDIO_FORMAT_SIGNED_16:
-    default:
-      ainfo->play.encoding = AUDIO_ENCODING_SLINEAR;
-      ainfo->play.precision = 16;
-      break;
-    case AUDIO_FORMAT_UNSIGNED_16:
-      ainfo->play.encoding = AUDIO_ENCODING_ULINEAR;
-      ainfo->play.precision = 16;
-      break;
-    case AUDIO_FORMAT_UNSIGNED_8:
-      ainfo->play.encoding = AUDIO_ENCODING_ULINEAR;
-      ainfo->play.precision = 8;
-      break;
-    case AUDIO_FORMAT_SIGNED_8:
-      ainfo->play.encoding = AUDIO_ENCODING_SLINEAR;
-      ainfo->play.precision = 8;
-      break;
-    case AUDIO_FORMAT_ULAW_8:
-      ainfo->play.encoding = AUDIO_ENCODING_ULAW;
-      ainfo->play.precision = 8;
-      break;
-    case AUDIO_FORMAT_ALAW_8:
-      ainfo->play.encoding = AUDIO_ENCODING_ALAW;
-      ainfo->play.precision = 8;
-      break;
-  }
-}
-
-int audio_set_format(struct audio_info_struct *ai)
-{
-  audio_set_format_helper(ai->format,&ainfo);
-  uptodate = 0;
-
-  return 0;
-}
-
-
-static int try_format(int fmt, struct audio_info_struct *ai)
-{
-  audio_info_t ainfo;
-
-  AUDIO_INITINFO(&ainfo);
-
-  audio_set_format_helper(fmt, &ainfo);
-  ainfo.play.sample_rate = ai->rate;
-  ainfo.play.channels = ai->channels;
-  if(ioctl(audio_fd, AUDIO_SETINFO, &ainfo) >= 0) 
-    return fmt;
-  else
-    return 0;
-}
-
-int audio_get_formats(struct audio_info_struct *ai)
-{
-  int fmts = 0;
-
-  really_open_audio(ai);
-
-  if ((possible & AUDIO_FORMAT_SIGNED_16) == AUDIO_FORMAT_SIGNED_16)
-    fmts |= try_format(AUDIO_FORMAT_SIGNED_16, ai);
-  else if ((possible & AUDIO_FORMAT_UNSIGNED_16) == AUDIO_FORMAT_UNSIGNED_16)
-    fmts |= try_format(AUDIO_FORMAT_UNSIGNED_16, ai);
-  if ((possible & AUDIO_FORMAT_SIGNED_8) == AUDIO_FORMAT_SIGNED_8)
-    fmts |= try_format(AUDIO_FORMAT_SIGNED_8, ai);
-  else if ((possible & AUDIO_FORMAT_UNSIGNED_8) == AUDIO_FORMAT_UNSIGNED_8)
-    fmts |= try_format(AUDIO_FORMAT_UNSIGNED_8, ai);
-  if (!fmts && ((possible & AUDIO_FORMAT_ULAW_8) == AUDIO_FORMAT_ULAW_8))
-    fmts |= try_format(AUDIO_FORMAT_ULAW_8, ai);
-  if (!fmts && ((possible & AUDIO_FORMAT_ALAW_8) == AUDIO_FORMAT_ALAW_8))
-    fmts |= try_format(AUDIO_FORMAT_ALAW_8, ai);
-  return fmts;
-}
-    
-
-int audio_play_samples(struct audio_info_struct *ai,unsigned char *buf,int len)
-{
-  if (!uptodate) {
-    uptodate = 1;
-    ioctl(ai->fn, AUDIO_SETINFO, &ainfo);
-  }
-  
-  return write(ai->fn,buf,len);
-}
-
-int audio_close(struct audio_info_struct *ai)
-{
-  return 0;
-}
-
-void audio_queueflush (struct audio_info_struct *ai)
-{
-  ioctl (ai->fn, AUDIO_FLUSH, 0);
-}
Index: files/term.c
===================================================================
RCS file: files/term.c
diff -N files/term.c
--- files/term.c        12 Jun 2003 22:15:26 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,159 +0,0 @@
-/* $OpenBSD: term.c,v 1.4 2003/06/12 22:15:26 pvalchev Exp $ */
-/*-
- * Copyright (c) 1999 Marc Espie.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT 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 OPENBSD
- * PROJECT 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.
- */
-
-/* Set terminal discipline to non blocking io and such.  */
-
-#include <signal.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include <sys/types.h>
-#include <sys/termios.h>       
-#include <errno.h>
-
-#include "mpg123.h"
-
-#ifdef TERM_CONTROL
-
-static void sane_tty(void);
-static void suspend(int sig);
-static int run_in_fg(void);
-static void if_fg_sane_tty(void);
-static int may_getchar(void);
-static void set_raw(int);
-
-static struct termios sanity;
-static struct termios *psanity = NULL;
-
-static int is_fg;
-
-#ifdef SIGTSTP
-static void suspend(int sig)
-{
-       sane_tty();
-       signal(SIGTSTP, SIG_DFL);
-       kill(0, SIGTSTP);
-}
-#endif
-
-static int run_in_fg(void)
-{
-       pid_t val;
-
-               /* this should work on every unix */
-       if (!isatty(fileno(stdin)) || !isatty(fileno(stdout)))
-               return 0;
-
-       val = tcgetpgrp(fileno(stdin));
-       if (val == -1) {
-               if (errno == ENOTTY)
-                       return 0;
-               else
-                       return 1;
-       }
-       if (val == getpgrp())
-               return 1;
-       else
-               return 0;
-}
-
-/* if_fg_sane_tty():
- * restore tty modes, _only_ if running in foreground
- */
-static void if_fg_sane_tty(void)
-{
-       if (run_in_fg())
-               sane_tty();
-}
-
-
-static void set_raw(int sig)
-{
-       struct termios zap;
-
-#ifdef SIGTSTP
-       signal(SIGTSTP, suspend);
-#endif
-#ifdef SIGCONT
-       signal(SIGCONT, set_raw);
-#endif
-       if (run_in_fg()) {
-               tcgetattr(fileno(stdin), &zap);
-               zap.c_cc[VMIN] = 0;     /* can't work with old */
-               zap.c_cc[VTIME] = 0; /* FreeBSD versions    */
-               zap.c_lflag &= ~(ICANON|ECHO|ECHONL);
-               tcsetattr(fileno(stdin), TCSADRAIN, &zap);      
-               is_fg = TRUE;
-       } else
-               is_fg = FALSE;
-}
-
-/* nonblocking_io():
- * try to setup the keyboard to non blocking io
- */
-void term_init(void)
-{
-       if (!psanity) {
-               psanity = &sanity;
-               tcgetattr(fileno(stdin), psanity);
-       }
-       set_raw(0);
-       atexit(if_fg_sane_tty);
-}
-
-
-/* sane_tty():
- * restores everything to a sane state before returning to shell */
-static void sane_tty(void)
-{
-       tcsetattr(fileno(stdin), TCSADRAIN, psanity);
-}
-
-static int may_getchar(void)
-{
-       char buffer;
-
-       if (run_in_fg() && !is_fg)
-              set_raw(0);
-       if (run_in_fg() && read(fileno(stdin), &buffer, 1))
-              return buffer;
-       return 0;
-}
-
-void term_control(void)
-{
-       int val = may_getchar();
-
-       if (val == 'b' || val == 'B')
-               rd->rewind(rd);
-}
-
-void term_restore(void)
-{
-}
-
-#endif
Index: patches/patch-Makefile
===================================================================
RCS file: patches/patch-Makefile
diff -N patches/patch-Makefile
--- patches/patch-Makefile      5 Apr 2006 19:19:29 -0000       1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,59 +0,0 @@
-$OpenBSD: patch-Makefile,v 1.6 2006/04/05 19:19:29 jolan Exp $
---- Makefile.orig      Wed Apr  5 14:14:35 2006
-+++ Makefile   Wed Apr  5 14:15:21 2006
-@@ -4,7 +4,7 @@
- 
- # Where to install binary and manpage on "make install":
- 
--PREFIX=/usr/local
-+PREFIX?=/usr/local
- BINDIR=$(PREFIX)/bin
- MANDIR=$(PREFIX)/man
- SECTION=1
-@@ -54,6 +54,7 @@ nothing-specified:
-       @echo "make aix-tk3play    IBM AIX"
-       @echo "make os2            IBM OS/2"
-       @echo "make netbsd         NetBSD"
-+      @echo "make openbsd        OpenBSD"
-       @echo "make bsdos          BSDI BSD/OS"
-       @echo "make bsdos4         BSDI BSD/OS 4.0"
-       @echo "make bsdos-nas      BSDI BSD/OS with NAS support"
-@@ -510,6 +511,30 @@ netbsd-i386:
-                       -DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
-               mpg123-make
- 
-+.if ${MACHINE_ARCH} == "i386"
-+ARCHOPTS=     -DROT_I386 -DI386_ASSEM -DPENTIUM_OPT
-+ARCHOBJS=     decode_i386.o decode_i586.o dct64_i386.o
-+.else
-+ARCHOPTS=
-+ARCHOBJS=     decode.o dct64.o
-+.endif
-+
-+openbsd:
-+      ${MAKE} CC="${CC}" LDFLAGS= \
-+              OBJECTS='${ARCHOBJS} audio_openbsd.o term.o' \
-+              CFLAGS='${CFLAGS} ${COPTS} \
-+                      ${ARCHOPTS} -DREAL_IS_FLOAT -DTERM_CONTROL \
-+                      -DINET6 -DUSE_MMAP -DOPENBSD' mpg123-make
-+
-+openbsd-esd:
-+      ${MAKE} CC="${CC}" LDFLAGS='-L${LOCALBASE}/lib' \
-+              AUDIO_LIB='-lesd -laudiofile' \
-+              OBJECTS='${ARCHOBJS} audio_esd.o term.o' \
-+              CFLAGS='-O3 -funroll-all-loops -ffast-math ${COPTS} \
-+                      ${ARCHOPTS} -I${LOCALBASE}/include \
-+                      -DREAL_IS_FLOAT -DTERM_CONTROL \
-+                      -DINET6 -DUSE_MMAP -DOPENBSD' mpg123-make
-+
- bsdos:
-       $(MAKE) CC=shlicc2 LDFLAGS= \
-               OBJECTS='decode_i386.o dct64_i386.o \
-@@ -642,7 +667,6 @@ system: mpg123.h system.c
-       $(CC) -o $@ -Wall -O2 system.c
- 
- install:      prepared-for-install
--      strip mpg123
-       if [ -x /usr/ccs/bin/mcs ]; then /usr/ccs/bin/mcs -d mpg123; fi
-       mkdir -p $(BINDIR)
-       mkdir -p $(MANDIR)/man$(SECTION)
Index: patches/patch-audio.c
===================================================================
RCS file: patches/patch-audio.c
diff -N patches/patch-audio.c
--- patches/patch-audio.c       15 Sep 2004 20:35:59 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,133 +0,0 @@
-$OpenBSD: patch-audio.c,v 1.3 2004/09/15 20:35:59 brad Exp $
---- audio.c.orig       Tue Apr  6 11:53:05 1999
-+++ audio.c    Wed Sep 15 16:22:34 2004
-@@ -68,41 +68,42 @@ void audio_capabilities(struct audio_inf
- {
-       int fmts;
-       int i,j,k,k1=NUM_RATES-1;
--      struct audio_info_struct ai1 = *ai;
- 
-         if (param.outmode != DECODE_AUDIO) {
-               memset(capabilities,1,sizeof(capabilities));
-               return;
-       }
- 
--      memset(capabilities,0,sizeof(capabilities));
-+      memset(capabilities,-1,sizeof(capabilities));
-       if(param.force_rate) {
-               rates[NUM_RATES-1] = param.force_rate;
-               k1 = NUM_RATES;
-       }
- 
--      if(audio_open(&ai1) < 0) {
--              perror("audio");
--              exit(1);
--      }
-+      if(param.verbose > 1) {
-+              struct audio_info_struct ai1 = *ai;
-+              if(audio_open(&ai1) < 0) {
-+                      perror("audio");
-+                      exit(1);
-+              }
- 
--      for(i=0;i<NUM_CHANNELS;i++) {
--              for(j=0;j<NUM_RATES;j++) {
--                      ai1.channels = channels[i];
--                      ai1.rate = rates[j];
--                      fmts = audio_get_formats(&ai1);
--                      if(fmts < 0)
--                              continue;
--                      for(k=0;k<NUM_ENCODINGS;k++) {
--                              if((fmts & encodings[k]) == encodings[k])
--                                      capabilities[i][k][j] = 1;
-+              for(i=0;i<NUM_CHANNELS;i++) {
-+                      for(j=0;j<NUM_RATES;j++) {
-+                              ai1.channels = channels[i];
-+                              ai1.rate = rates[j];
-+                              fmts = audio_get_formats(&ai1);
-+                              if(fmts < 0)
-+                                      continue;
-+                              for(k=0;k<NUM_ENCODINGS;k++) {
-+                                      if((fmts & encodings[k]) == 
encodings[k])
-+                                              capabilities[i][k][j] = 1;
-+                                      else
-+                                              capabilities[i][k][j] = 0;
-+                              }
-                       }
-               }
--      }
- 
--      audio_close(&ai1);
--
--      if(param.verbose > 1) {
-+              audio_close(&ai1);
-               fprintf(stderr,"\nAudio capabilities:\n        |");
-               for(j=0;j<NUM_ENCODINGS;j++) {
-                       fprintf(stderr," %5s |",audio_val2name[j].sname);
-@@ -144,7 +145,19 @@ static int audio_fit_cap_helper(struct a
- 
-         if(rn >= 0) {
-                 for(i=f0;i<f2;i++) {
--                        if(capabilities[c][i][rn]) {
-+                      if(capabilities[c][i][rn] == (char)-1) {
-+                              int fmts, k;
-+                              ai->channels = channels[c];
-+                              ai->rate = rates[rn];
-+                              fmts = audio_get_formats(ai);
-+                              for(k=0;k<NUM_ENCODINGS;k++) {
-+                                      if ((fmts & encodings[k]) == 
encodings[k])
-+                                              capabilities[c][k][rn] = 1;
-+                                      else
-+                                              capabilities[c][k][rn] = 0;
-+                              }
-+                      }
-+                        if(capabilities[c][i][rn] == 1) {
-                                 ai->rate = rates[rn];
-                                 ai->format = encodings[i];
-                                 ai->channels = channels[c];
-@@ -160,7 +173,11 @@ static int audio_fit_cap_helper(struct a
-  * c=num of channels of stream
-  * r=rate of stream
-  */
--void audio_fit_capabilities(struct audio_info_struct *ai,int c,int r)
-+#ifdef OPENBSD
-+void audio_fit_capabilities(struct audio_info_struct *ai, int c, int r)
-+#else
-+static void do_audio_fit_capabilities(struct audio_info_struct *ai,int c,int 
r)
-+#endif
- {
-       int rn;
-       int f0=0;
-@@ -247,6 +264,23 @@ void audio_fit_capabilities(struct audio
-       exit(1);
- }
- 
-+#ifndef OPENBSD
-+void audio_fit_capabilities(struct audio_info_struct *ai,int c,int r)
-+{
-+      struct audio_info_struct ai1 = *ai;
-+      
-+      if (param.verbose <= 1 && audio_open(&ai1) >= 0) {
-+              do_audio_fit_capabilities(&ai1, c, r);
-+              ai->rate = ai1.rate;
-+              ai->channels = ai1.channels;
-+              ai->format = ai1.format;
-+              audio_close(&ai1);
-+      } else {
-+              do_audio_fit_capabilities(ai, c, r);
-+      }
-+}
-+#endif
-+      
- char *audio_encoding_name(int format)
- {
-       int i;
-@@ -258,7 +292,7 @@ char *audio_encoding_name(int format)
-       return "Unknown";
- }
- 
--#if !defined(SOLARIS) && !defined(__NetBSD__) || defined(NAS)
-+#if !defined(SOLARIS) && !defined(__NetBSD__) && !defined(__OpenBSD__) || 
defined(NAS)
- void audio_queueflush(struct audio_info_struct *ai)
- {
- }
Index: patches/patch-audio_esd_c
===================================================================
RCS file: patches/patch-audio_esd_c
diff -N patches/patch-audio_esd_c
--- patches/patch-audio_esd_c   20 Apr 2004 01:45:30 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-$OpenBSD: patch-audio_esd_c,v 1.2 2004/04/20 01:45:30 jolan Exp $
---- audio_esd.c.orig   1999-05-28 10:06:29.000000000 -0500
-+++ audio_esd.c        2004-04-19 11:15:34.000000000 -0500
-@@ -75,7 +75,7 @@ int audio_open(struct audio_info_struct 
-   else if (ai->rate > esd_rate)
-     return -1;
- 
--  ai->fn = esd_play_stream_fallback(format, ai->rate, esdserver, "mpg123");
-+  ai->fn = esd_play_stream_fallback(format, ai->rate, NULL, "mpg123");
-   return (ai->fn);
- }
- 
-@@ -127,17 +127,7 @@ int audio_close(struct audio_info_struct
-   return 0;
- }
- 
--#ifdef SOLARIS
- void audio_queueflush (struct audio_info_struct *ai)
- {
--        ioctl (ai->fn, I_FLUSH, FLUSHRW);
-+  return;
- }
--#endif
--
--#ifdef NETBSD
--void audio_queueflush (struct audio_info_struct *ai)
--{
--        ioctl (ai->fn, AUDIO_FLUSH, 0);
--}
--#endif
--
Index: patches/patch-common_c
===================================================================
RCS file: patches/patch-common_c
diff -N patches/patch-common_c
--- patches/patch-common_c      17 Jul 2003 23:58:33 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-common_c,v 1.1 2003/07/17 23:58:33 brad Exp $
---- common.c.orig      Thu Jul 17 19:20:43 2003
-+++ common.c   Thu Jul 17 19:22:04 2003
-@@ -123,7 +123,7 @@ int head_check(unsigned long head)
-       return FALSE;
-     if(!((head>>17)&3))
-       return FALSE;
--    if( ((head>>12)&0xf) == 0xf)
-+    if( ((head>>12)&0xf) == 0xf || ((head>>12)&0xf) == 0)
-       return FALSE;
-     if( ((head>>10)&0x3) == 0x3 )
-       return FALSE;
Index: patches/patch-configure
===================================================================
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure     9 Dec 2007 22:12:09 -0000
@@ -0,0 +1,40 @@
+$OpenBSD$
+--- configure.orig     Wed Dec  5 00:04:43 2007
++++ configure  Wed Dec  5 00:06:04 2007
+@@ -9320,31 +9320,31 @@ echo "${ECHO_T}no" >&6; }
+               { echo "$as_me:$LINENO: WARNING: Unknown target operating 
system" >&5
+ echo "$as_me: WARNING: Unknown target operating system" >&2;}
+               cpu_type="i386"
+-              CFLAGS="-DGENERIC -DNOXFERMEM $CFLAGS"
++              CFLAGS="-DNOXFERMEM $CFLAGS"
+       ;;
+       i486-*)
+               { echo "$as_me:$LINENO: WARNING: Unknown target operating 
system" >&5
+ echo "$as_me: WARNING: Unknown target operating system" >&2;}
+               cpu_type="i486"
+-              CFLAGS="-DGENERIC -DNOXFERMEM $CFLAGS"
++              CFLAGS="-DNOXFERMEM $CFLAGS"
+       ;;
+       i586-*)
+               { echo "$as_me:$LINENO: WARNING: Unknown target operating 
system" >&5
+ echo "$as_me: WARNING: Unknown target operating system" >&2;}
+               cpu_type="i586"
+-              CFLAGS="-DGENERIC -DNOXFERMEM $CFLAGS"
++              CFLAGS="-DNOXFERMEM $CFLAGS"
+       ;;
+       i686-*)
+               { echo "$as_me:$LINENO: WARNING: Unknown target operating 
system" >&5
+ echo "$as_me: WARNING: Unknown target operating system" >&2;}
+               cpu_type="x86"
+-              CFLAGS="-DGENERIC -DNOXFERMEM $CFLAGS"
++              CFLAGS="-DNOXFERMEM $CFLAGS"
+       ;;
+   *)
+       { echo "$as_me:$LINENO: WARNING: Unknown target operating system" >&5
+ echo "$as_me: WARNING: Unknown target operating system" >&2;}
+     cpu_type="generic_fpu"
+-    CFLAGS="-DGENERIC -DNOXFERMEM $CFLAGS"
++    CFLAGS="-DNOXFERMEM $CFLAGS"
+   ;;
+ esac
+ 
Index: patches/patch-httpget_c
===================================================================
RCS file: patches/patch-httpget_c
diff -N patches/patch-httpget_c
--- patches/patch-httpget_c     13 Nov 2003 20:51:50 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
-$OpenBSD: patch-httpget_c,v 1.1 2003/11/13 20:51:50 margarida Exp $
---- httpget.c.orig     2003-11-13 18:34:37.000000000 +0000
-+++ httpget.c  2003-11-13 18:35:10.000000000 +0000
-@@ -55,11 +55,10 @@ void readstring (char *string, int maxle
- #endif
-       int pos = 0;
- 
--      while(1) {
-+      while(pos < maxlen) {
-               if( read(fileno(f),string+pos,1) == 1) {
-                       pos++;
-                       if(string[pos-1] == '\n') {
--                              string[pos] = 0;
-                               break;
-                       }
-               }
-@@ -68,6 +67,7 @@ void readstring (char *string, int maxle
-                       exit(1);
-               }
-       }
-+      string[pos] = 0;
- #if 0
-       do {
-               result = fgets(string, maxlen, f);
Index: patches/patch-layer2_c
===================================================================
RCS file: patches/patch-layer2_c
diff -N patches/patch-layer2_c
--- patches/patch-layer2_c      7 Sep 2004 21:23:24 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-layer2_c,v 1.1 2004/09/07 21:23:24 pvalchev Exp $
---- layer2.c.orig      Tue Sep  7 15:13:46 2004
-+++ layer2.c   Tue Sep  7 15:14:44 2004
-@@ -265,6 +265,11 @@ int do_layer2(struct frame *fr,int outmo
-   fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
-      (fr->mode_ext<<2)+4 : fr->II_sblimit;
- 
-+  if (fr->jsbound > fr->II_sblimit) {
-+        fprintf(stderr, "Truncating stereo boundary to sideband limit.\n");
-+        fr->jsbound=fr->II_sblimit;
-+  }
-+
-   if(stereo == 1 || single == 3)
-     single = 0;
- 
Index: patches/patch-layer3_c
===================================================================
RCS file: patches/patch-layer3_c
diff -N patches/patch-layer3_c
--- patches/patch-layer3_c      29 May 2006 19:34:59 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,97 +0,0 @@
-$OpenBSD: patch-layer3_c,v 1.4 2006/05/29 19:34:59 bernd Exp $
---- layer3.c.orig      Wed Apr 21 17:25:18 1999
-+++ layer3.c   Mon May 29 10:55:42 2006
-@@ -608,12 +608,21 @@ static int pretab2[22] = {0,0,0,0,0,0,0,
-  * Dequantize samples (includes huffman decoding)
-  */
- /* 24 is enough because tab13 has max. a 19 bit huffvector */
-+#if defined(__LP64__)
-+#define BITSHIFT ((sizeof(int)-1)*8)
-+#define REFRESH_MASK \
-+  while(num < BITSHIFT) { \
-+    mask |= getbyte()<<(BITSHIFT-num); \
-+    num += 8; \
-+    part2remain -= 8; }
-+#else
- #define BITSHIFT ((sizeof(long)-1)*8)
- #define REFRESH_MASK \
-   while(num < BITSHIFT) { \
-     mask |= getbyte()<<(BITSHIFT-num); \
-     num += 8; \
-     part2remain -= 8; }
-+#endif
- 
- static int III_dequantize_sample(real xr[SBLIMIT][SSLIMIT],int *scf,
-    struct gr_info_s *gr_info,int sfreq,int part2bits)
-@@ -625,7 +634,11 @@ static int III_dequantize_sample(real xr
-   int *me;
- 
-   int num=getbitoffset();
-+#if defined(__LP64__)
-+  int mask = (int) getbits(num)<<(BITSHIFT+8-num);
-+#else
-   long mask = (long) getbits(num)<<(BITSHIFT+8-num);
-+#endif
-   part2remain -= num;
- 
-   {
-@@ -709,7 +722,11 @@ static int III_dequantize_sample(real xr
-         if(x == 15 && h->linbits) {
-           max[lwin] = cb;
-           REFRESH_MASK;
-+#if defined(__LP64__)
-+          x += ((unsigned int) mask) >> (BITSHIFT+8-h->linbits);
-+#else
-           x += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-+#endif
-           num -= h->linbits+1;
-           mask <<= h->linbits;
-           if(mask < 0)
-@@ -733,7 +750,11 @@ static int III_dequantize_sample(real xr
-         if(y == 15 && h->linbits) {
-           max[lwin] = cb;
-           REFRESH_MASK;
-+#if defined(__LP64__)
-+          y += ((unsigned int) mask) >> (BITSHIFT+8-h->linbits);
-+#else
-           y += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-+#endif
-           num -= h->linbits+1;
-           mask <<= h->linbits;
-           if(mask < 0)
-@@ -883,7 +904,11 @@ static int III_dequantize_sample(real xr
-         if (x == 15 && h->linbits) {
-           max = cb;
-         REFRESH_MASK;
-+#if defined(__LP64__)
-+          x += ((unsigned int) mask) >> (BITSHIFT+8-h->linbits);
-+#else
-           x += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-+#endif
-           num -= h->linbits+1;
-           mask <<= h->linbits;
-           if(mask < 0)
-@@ -907,7 +932,11 @@ static int III_dequantize_sample(real xr
-         if (y == 15 && h->linbits) {
-           max = cb;
-         REFRESH_MASK;
-+#if defined(__LP64__)
-+          y += ((unsigned int) mask) >> (BITSHIFT+8-h->linbits);
-+#else
-           y += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits);
-+#endif
-           num -= h->linbits+1;
-           mask <<= h->linbits;
-           if(mask < 0)
-@@ -1119,7 +1148,10 @@ maybe still wrong??? (copy 12 to 13?) */
-       } 
-       else { /* ((gr_info->block_type != 2)) */
-         int sfb = gr_info->maxbandl;
--        int is_p,idx = bi->longIdx[sfb];
-+        int is_p,idx;
-+        if (sfb > 21)
-+                return;
-+        idx = bi->longIdx[sfb];
-         for ( ; sfb<21; sfb++) {
-           int sb = bi->longDiff[sfb];
-           is_p = scalefac[sfb]; /* scale: 0-15 */
Index: patches/patch-mpg123.c
===================================================================
RCS file: patches/patch-mpg123.c
diff -N patches/patch-mpg123.c
--- patches/patch-mpg123.c      24 Apr 2001 00:48:12 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-$OpenBSD: patch-mpg123.c,v 1.2 2001/04/24 00:48:12 naddy Exp $
---- mpg123.c.orig      Tue Jun 15 22:21:36 1999
-+++ mpg123.c   Sat Apr 14 23:57:31 2001
-@@ -177,6 +177,9 @@ void init_output(void)
-         _exit(0);
-       default: /* parent */
-         xfermem_init_writer (buffermem);
-+      if (xfermem_block(XF_WRITER, buffermem) == XF_CMD_TERMINATE) {
-+          intflag = TRUE;
-+      }
-         param.outmode = DECODE_BUFFER;
-     }
-   }
-@@ -913,18 +916,6 @@ int main(int argc, char *argv[])
-                               &dirname, &filename))
-                               fprintf(stderr, "\nDirectory: %s", dirname);
-                       fprintf(stderr, "\nPlaying MPEG stream from %s ...\n", 
filename);
--
--#if !defined(GENERIC)
--{
--     const char *term_type;
--         term_type = getenv("TERM");
--         if (!strcmp(term_type,"xterm"))
--         {
--           fprintf(stderr, "\033]0;%s\007", filename);
--         }
--}
--#endif
--
-               }
- 
- #if !defined(WIN32) && !defined(GENERIC)
Index: patches/patch-mpg123_h
===================================================================
RCS file: patches/patch-mpg123_h
diff -N patches/patch-mpg123_h
--- patches/patch-mpg123_h      22 Jul 2003 03:24:42 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
-$OpenBSD: patch-mpg123_h,v 1.1 2003/07/22 03:24:42 jason Exp $
---- mpg123.h.orig      Fri May 28 10:51:58 1999
-+++ mpg123.h   Mon Jul 21 17:05:15 2003
-@@ -125,26 +125,26 @@ struct frame {
- };
- 
- struct parameter {
--  int aggressive; /* renice to max. priority */
--  int shuffle;        /* shuffle/random play */
--  int remote; /* remote operation */
--  int outmode;        /* where to out the decoded sampels */
--  int quiet;  /* shut up! */
-+  long aggressive; /* renice to max. priority */
-+  long shuffle;       /* shuffle/random play */
-+  long remote;        /* remote operation */
-+  long outmode;       /* where to out the decoded sampels */
-+  long quiet; /* shut up! */
-   long usebuffer;     /* second level buffer size */
--  int tryresync;  /* resync stream after error */
-+  long tryresync;  /* resync stream after error */
-   int verbose;    /* verbose level */
- #ifdef TERM_CONTROL
--  int term_ctrl;
-+  long term_ctrl;
- #endif
--  int force_mono;
--  int force_stereo;
--  int force_8bit;
-+  long force_mono;
-+  long force_stereo;
-+  long force_8bit;
-   long force_rate;
--  int down_sample;
--  int checkrange;
-+  long down_sample;
-+  long checkrange;
-   long doublespeed;
-   long halfspeed;
--  int force_reopen;
-+  long force_reopen;
-   long realtime;
-   char filename[256];
- };
Index: patches/patch-src_audio_sun_c
===================================================================
RCS file: patches/patch-src_audio_sun_c
diff -N patches/patch-src_audio_sun_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_audio_sun_c       9 Dec 2007 22:12:09 -0000
@@ -0,0 +1,125 @@
+$OpenBSD$
+--- src/audio_sun.c.orig       Sun Oct 28 15:13:50 2007
++++ src/audio_sun.c    Sun Dec  9 13:46:09 2007
+@@ -44,7 +44,11 @@ static void audio_set_format_helper(struct audio_info_
+ #ifndef AUDIO_ENCODING_LINEAR /* not supported */
+ #define AUDIO_ENCODING_LINEAR 3
+ #endif
++#if defined(__OpenBSD__)
++      ainfo->play.encoding = AUDIO_ENCODING_SLINEAR_LE;
++#else
+       ainfo->play.encoding = AUDIO_ENCODING_LINEAR;
++#endif
+       ainfo->play.precision = 16;
+       break;
+     case AUDIO_FORMAT_UNSIGNED_8:
+@@ -72,6 +76,7 @@ static void audio_set_format_helper(struct audio_info_
+ static int audio_reset_parameters(struct audio_info_struct *ai)
+ {
+   audio_info_t ainfo;
++  u_int encoding, precision;
+ 
+   AUDIO_INITINFO(&ainfo);
+ 
+@@ -80,9 +85,25 @@ static int audio_reset_parameters(struct audio_info_st
+   if(ai->channels >= 0)
+     ainfo.play.channels = ai->channels;
+   audio_set_format_helper(ai,&ainfo);
++  encoding = ainfo.play.encoding;
++  precision = ainfo.play.precision;
+ 
+   if(ioctl(ai->fn, AUDIO_SETINFO, &ainfo) == -1)
+     return -1;
++  if(ioctl(ai->fn, AUDIO_GETINFO, &ainfo) == -1)
++    return -1;
++  if((ai->rate != -1) && (ainfo.play.sample_rate != ai->rate)) {
++    return -1;
++  }
++  if((ai->channels >= 0) && (ainfo.play.channels != ai->channels)) {
++    return -1;
++  }
++  if(ainfo.play.precision != precision) {
++    return -1;
++  }
++  if(ainfo.play.encoding != encoding) {
++    return -1;
++  }
+   return 0;
+ }
+ 
+@@ -112,6 +133,10 @@ static int audio_set_rate(struct audio_info_struct *ai
+     ainfo.play.sample_rate = ai->rate;
+     if(ioctl(ai->fn, AUDIO_SETINFO, &ainfo) == -1)
+       return -1;
++    if(ioctl(ai->fn, AUDIO_GETINFO, &ainfo) == -1)
++      return -1;
++    if(ainfo.play.sample_rate != ai->rate)
++      return -1;
+     return 0;
+   }
+   return -1;
+@@ -125,17 +150,30 @@ static int audio_set_channels(struct audio_info_struct
+   ainfo.play.channels = ai->channels;
+   if(ioctl(ai->fn, AUDIO_SETINFO, &ainfo) == -1)
+     return -1;
++  if(ioctl(ai->fn, AUDIO_GETINFO, &ainfo) == -1)
++    return -1;
++  if(ainfo.play.channels != ai->channels)
++    return -1;
+   return 0;
+ }
+ 
+ static int audio_set_format(struct audio_info_struct *ai)
+ {
+   audio_info_t ainfo;
++  u_int encoding, precision;
+ 
+   AUDIO_INITINFO(&ainfo);
+   audio_set_format_helper(ai,&ainfo);
++  encoding = ainfo.play.encoding;
++  precision = ainfo.play.precision;
+   if(ioctl(ai->fn, AUDIO_SETINFO, &ainfo) == -1)
+     return -1;
++  if(ioctl(ai->fn, AUDIO_GETINFO, &ainfo) == -1)
++    return -1;
++  if(ainfo.play.encoding != encoding)
++    return -1;
++  if(ainfo.play.precision != precision)
++    return -1;
+ 
+   return 0;
+ }
+@@ -214,10 +252,20 @@ int audio_get_formats(struct audio_info_struct *ai)
+   static int tab[][3] = {
+     { AUDIO_ENCODING_ULAW , 8,  AUDIO_FORMAT_ULAW_8 } ,
+     { AUDIO_ENCODING_ALAW , 8,  AUDIO_FORMAT_ALAW_8 } ,
++#if defined(__OpenBSD__)
++    { AUDIO_ENCODING_SLINEAR_LE , 16,  AUDIO_FORMAT_SIGNED_16 } ,
++#else
+     { AUDIO_ENCODING_LINEAR , 16,  AUDIO_FORMAT_SIGNED_16 } ,
++#endif
+ #if defined(SOLARIS) || defined(SPARCLINUX)
+     { AUDIO_ENCODING_LINEAR8 , 8,  AUDIO_FORMAT_UNSIGNED_8 } ,
++#else
++#if defined(__OpenBSD__)
++    { AUDIO_ENCODING_ULINEAR_LE , 8,  AUDIO_FORMAT_UNSIGNED_8 } ,
++    { AUDIO_ENCODING_ULINEAR_LE , 16,  AUDIO_FORMAT_UNSIGNED_16 } ,
++    { AUDIO_ENCODING_SLINEAR_LE , 8,  AUDIO_FORMAT_SIGNED_8 } ,
+ #endif
++#endif
+   };
+ 
+   audio_info_t ainfo;
+@@ -232,7 +280,11 @@ int audio_get_formats(struct audio_info_struct *ai)
+     ainfo.play.channels = ai->channels;
+ #endif
+     if(ioctl(ai->fn, AUDIO_SETINFO, &ainfo) >= 0) {
+-      fmts |= tab[i][2];
++      if(ioctl(ai->fn, AUDIO_GETINFO, &ainfo) >= 0) {
++        if ((ainfo.play.encoding == tab[i][0]) &&
++            (ainfo.play.precision == tab[i][1]))
++          fmts |= tab[i][2];
++      }
+     }
+   }
+   return fmts;
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/OpenBSD/ports/audio/mpg123/pkg/PLIST,v
retrieving revision 1.4
diff -u -r1.4 PLIST
--- pkg/PLIST   6 Aug 2004 14:37:27 -0000       1.4
+++ pkg/PLIST   9 Dec 2007 22:12:09 -0000
@@ -1,5 +1,3 @@
 @comment $OpenBSD: PLIST,v 1.4 2004/08/06 14:37:27 espie Exp $
 bin/mpg123
 @man man/man1/mpg123.1
-share/mpg123/
-share/mpg123/COPYING

Reply via email to