openbsd-ports/audio/mpg123/patches/patch-src_output_sndio_c

59 lines
1.6 KiB
Plaintext

$OpenBSD: patch-src_output_sndio_c,v 1.1 2009/04/28 19:07:26 naddy Exp $
--- src/output/sndio.c.orig Wed Mar 25 00:36:02 2009
+++ src/output/sndio.c Tue Mar 31 22:32:09 2009
@@ -46,6 +46,14 @@ static int open_sndio(audio_output_t *ao)
par.sig = 0;
par.bits = 16;
break;
+ case MPG123_ENC_SIGNED_32:
+ par.sig = 1;
+ par.bits = 32;
+ break;
+ case MPG123_ENC_UNSIGNED_32:
+ par.sig = 0;
+ par.bits = 32;
+ break;
case MPG123_ENC_UNSIGNED_8:
par.sig = 0;
par.bits = 8;
@@ -67,15 +75,27 @@ static int open_sndio(audio_output_t *ao)
sio_close(hdl);
return -1;
}
- if ((par.bits != 8 && par.bits != 16) || par.le != SIO_LE_NATIVE) {
+ if ((par.bits != 8 && par.bits != 16 && par.bits != 32) ||
+ par.le != SIO_LE_NATIVE) {
sio_close(hdl);
return -1;
}
ao->rate = par.rate;
ao->channels = par.pchan;
- ao->format = (par.bits == 8) ?
- (par.sig ? MPG123_ENC_SIGNED_8 : MPG123_ENC_UNSIGNED_8) :
- (par.sig ? MPG123_ENC_SIGNED_16 : MPG123_ENC_UNSIGNED_16);
+ switch (par.bits) {
+ case 8:
+ ao->format = par.sig ? MPG123_ENC_SIGNED_8 :
+ MPG123_ENC_UNSIGNED_8;
+ break;
+ case 16:
+ ao->format = par.sig ? MPG123_ENC_SIGNED_16 :
+ MPG123_ENC_UNSIGNED_16;
+ break;
+ case 32:
+ ao->format = par.sig ? MPG123_ENC_SIGNED_32 :
+ MPG123_ENC_UNSIGNED_32;
+ break;
+ }
ao->userptr = hdl;
return 0;
}
@@ -83,6 +103,7 @@ static int open_sndio(audio_output_t *ao)
static int get_formats_sndio(audio_output_t *ao)
{
return (MPG123_ENC_SIGNED_16|MPG123_ENC_UNSIGNED_16|
+ MPG123_ENC_SIGNED_32|MPG123_ENC_UNSIGNED_32|
MPG123_ENC_UNSIGNED_8|MPG123_ENC_SIGNED_8);
}