Fix support for 24-bit and 32-bit resolution

While on it:
- Pet portlint

PR:		199558
Submitted by:	hselasky@FreeBSD.org
This commit is contained in:
Thomas Zander 2015-06-14 15:05:09 +00:00
parent b845f65fed
commit 7fa927df12
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=389640
10 changed files with 216 additions and 50 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= jackit
PORTVERSION= 0.124.1
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= audio
MASTER_SITES= http://jackaudio.org/downloads/
DISTNAME= jack-audio-connection-kit-${PORTVERSION}

View File

@ -1,6 +1,7 @@
--- configure 2014-01-22 15:23:47.000000000 -0500
+++ configure 2014-11-30 13:05:39.000000000 -0500
@@ -2608,48 +2608,4 @@
--- configure.orig 2014-01-22 20:23:47 UTC
+++ configure
@@ -2607,50 +2607,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
@ -49,3 +50,4 @@
-
ac_aux_dir=
for ac_dir in config "$srcdir"/config; do
for ac_t in install-sh install.sh shtool; do

View File

@ -1,11 +0,0 @@
--- drivers/alsa/memops.c.orig 2010-05-08 20:23:13.000000000 -0300
+++ drivers/alsa/memops.c 2010-05-08 20:23:24.000000000 -0300
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
-#include <endian.h>
+#include <sys/endian.h>
#include <jack/memops.h>

View File

@ -1,6 +1,6 @@
--- drivers/dummy/dummy_driver.c.orig 2009-02-12 04:44:04.000000000 +0100
+++ drivers/dummy/dummy_driver.c 2009-02-12 04:44:15.000000000 +0100
@@ -73,7 +73,7 @@
--- drivers/dummy/dummy_driver.c.orig 2013-10-04 00:45:25 UTC
+++ drivers/dummy/dummy_driver.c
@@ -73,7 +73,7 @@ FakeVideoSync( dummy_driver_t *driver )
}
}

View File

@ -1,6 +1,6 @@
--- drivers/dummy/dummy_driver.h.orig 2009-02-12 05:04:38.000000000 +0100
+++ drivers/dummy/dummy_driver.h 2009-02-12 05:04:44.000000000 +0100
@@ -44,7 +44,7 @@
--- drivers/dummy/dummy_driver.h.orig 2013-10-04 00:45:25 UTC
+++ drivers/dummy/dummy_driver.h
@@ -44,7 +44,7 @@ struct _dummy_driver
jack_nframes_t period_size;
unsigned long wait_time;

View File

@ -1,4 +1,4 @@
--- drivers/oss/oss_driver.c.orig
--- drivers/oss/oss_driver.c.orig 2013-10-04 00:45:25 UTC
+++ drivers/oss/oss_driver.c
@@ -23,6 +23,7 @@
@ -8,7 +8,7 @@
#ifdef USE_BARRIER
/*
* POSIX conformance level should be globally defined somewhere, possibly
@@ -181,7 +182,9 @@ static void set_period_size (oss_driver_
@@ -183,7 +184,9 @@ static void set_period_size (oss_driver_
((double) driver->period_size /
(double) driver->sample_rate) * 1e6;
driver->last_wait_ust = 0;
@ -19,7 +19,7 @@
driver->next_periodtime = 0;
driver->iodelay = 0.0F;
}
@@ -189,7 +192,9 @@ static void set_period_size (oss_driver_
@@ -191,7 +194,9 @@ static void set_period_size (oss_driver_
static inline void update_times (oss_driver_t *driver)
{
@ -30,7 +30,85 @@
if (driver->next_periodtime > 0)
{
driver->iodelay = (float)
@@ -759,7 +764,9 @@ static int oss_driver_start (oss_driver_
@@ -224,6 +229,7 @@ static void copy_and_convert_in (jack_sa
int dstidx;
signed short *s16src = (signed short *) src;
signed int *s32src = (signed int *) src;
+ unsigned char *s24src = (unsigned char *) src;
double *f64src = (double *) src;
jack_sample_t scale;
@@ -240,11 +246,14 @@ static void copy_and_convert_in (jack_sa
}
break;
case 24:
- scale = 1.0f / 0x7fffff;
+ scale = 1.0f / 0x7fffffff;
for (dstidx = 0; dstidx < nframes; dstidx++)
{
dst[dstidx] = (jack_sample_t)
- s32src[srcidx] * scale;
+ ((signed int)(
+ (s24src[3 * srcidx + 2] << 24) |
+ (s24src[3 * srcidx + 1] << 16) |
+ (s24src[3 * srcidx + 0] << 8))) * scale;
srcidx += chcount;
}
break;
@@ -274,6 +283,7 @@ static void copy_and_convert_out (void *
int srcidx;
int dstidx;
signed short *s16dst = (signed short *) dst;
+ unsigned char *s24dst = (unsigned char *) dst;
signed int *s32dst = (signed int *) dst;
double *f64dst = (double *) dst;
jack_sample_t scale;
@@ -293,13 +303,17 @@ static void copy_and_convert_out (void *
}
break;
case 24:
- scale = 0x7fffff;
+ scale = 0x7fffffff;
for (srcidx = 0; srcidx < nframes; srcidx++)
{
- s32dst[dstidx] = (signed int)
- (src[srcidx] >= 0.0f) ?
- (src[srcidx] * scale + 0.5f) :
- (src[srcidx] * scale - 0.5f);
+ signed int sample =
+ (src[srcidx] >= 0.0f) ?
+ (src[srcidx] * scale + 0.5f) :
+ (src[srcidx] * scale - 0.5f) ;
+
+ s24dst[3*dstidx + 2] = sample >> 24;
+ s24dst[3*dstidx + 1] = sample >> 16;
+ s24dst[3*dstidx + 0] = sample >> 8;
dstidx += chcount;
}
break;
@@ -471,20 +485,7 @@ static int oss_driver_start (oss_driver_
const char *indev = driver->indev;
const char *outdev = driver->outdev;
- switch (driver->bits)
- {
- case 24:
- case 32:
- samplesize = sizeof(int);
- break;
- case 64:
- samplesize = sizeof(double);
- break;
- case 16:
- default:
- samplesize = sizeof(short);
- break;
- }
+ samplesize = driver->bits / 8;
driver->trigger = 0;
if (strcmp(indev, outdev) != 0)
{
@@ -762,7 +763,9 @@ static int oss_driver_start (oss_driver_
if (driver->threads & 1) sem_post(&driver->sem_start);
if (driver->threads & 2) sem_post(&driver->sem_start);
@ -41,3 +119,89 @@
driver->next_periodtime = 0;
driver->iodelay = 0.0F;
@@ -1235,7 +1238,24 @@ jack_driver_t * driver_initialize (jack_
}
pnode = jack_slist_next(pnode);
}
-
+
+ switch (bits)
+ {
+ case 16: /* native-endian 16-bit integer */
+ driver->format = AFMT_S16_NE;
+ break;
+ case 24: /* little-endian 24-bit integer */
+ driver->format = AFMT_S24_LE;
+ break;
+ case 32: /* native-endian 32-bit integer */
+ driver->format = AFMT_S32_NE;
+ break;
+ default:
+ free(driver);
+ jack_error("OSS: invalid number of bits: %d",
+ __FILE__, __LINE__, bits);
+ return NULL;
+ }
driver->sample_rate = sample_rate;
driver->period_size = period_size;
driver->nperiods = nperiods;
@@ -1254,59 +1274,6 @@ jack_driver_t * driver_initialize (jack_
driver->outdev = strdup(OSS_DRIVER_DEF_DEV);
driver->infd = -1;
driver->outfd = -1;
- switch (driver->bits)
- {
-# ifndef OSS_ENDIAN
-# ifdef __GNUC__
-# if (defined(__i386__) || defined(__alpha__) || defined(__arm__) || defined(__x86_64__) || (defined(__sh__) && !defined(__LITTLE_ENDIAN__)))
-# define OSS_LITTLE_ENDIAN 1234
-# define OSS_ENDIAN OSS_LITTLE_ENDIAN
-# else
-# define OSS_BIG_ENDIAN 4321
-# define OSS_ENDIAN OSS_BIG_ENDIAN
-# endif
-# else /* __GNUC__ */
-# if (defined(_AIX) || defined(AIX) || defined(sparc) || defined(__hppa) || defined(PPC) || defined(__powerpc__) && !defined(i386) && !defined(__i386) && !defined(__i386__))
-# define OSS_BIG_ENDIAN 4321
-# define OSS_ENDIAN OSS_BIG_ENDIAN
-# else
-# define OSS_LITTLE_ENDIAN 1234
-# define OSS_ENDIAN OSS_LITTLE_ENDIAN
-# endif
-# endif /* __GNUC__ */
-# endif /* OSS_ENDIAN */
-# if (OSS_ENDIAN == 1234)
- /* little-endian architectures */
- case 24: /* little-endian LSB aligned 24-bits in 32-bits integer */
- driver->format = 0x00008000;
- break;
- case 32: /* little-endian 32-bit integer */
- driver->format = 0x00001000;
- break;
- case 64: /* native-endian 64-bit float */
- driver->format = 0x00004000;
- break;
- case 16: /* little-endian 16-bit integer */
- default:
- driver->format = 0x00000010;
- break;
- /* big-endian architectures */
-# else
- case 24: /* big-endian LSB aligned 24-bits in 32-bits integer */
- break;
- driver->format = 0x00010000;
- case 32: /* big-endian 32-bit integer */
- driver->format = 0x00002000;
- break;
- case 64: /* native-endian 64-bit float */
- driver->format = 0x00004000;
- break;
- case 16: /* big-endian 16-bit integer */
- default:
- driver->format = 0x00000020;
-# endif
- }
-
driver->indevbuf = driver->outdevbuf = NULL;
driver->capture_ports = NULL;

View File

@ -0,0 +1,11 @@
--- drivers/alsa/memops.c.orig 2013-10-04 00:45:25 UTC
+++ drivers/alsa/memops.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
-#include <endian.h>
+#include <sys/endian.h>
#include "memops.h"

View File

@ -1,9 +1,9 @@
--- jack.pc.in.orig Thu Jun 5 03:21:36 2003
+++ jack.pc.in Sun Mar 14 22:49:44 2004
@@ -6,5 +6,5 @@
--- jack.pc.in.orig 2013-10-04 00:45:25 UTC
+++ jack.pc.in
@@ -6,5 +6,5 @@ includedir=@includedir@
Name: jack
Description: the Jack Audio Connection Kit: a low-latency synchronous callback-based media server
Version: @JACK_VERSION@
-Libs: -L${libdir} -ljack -lpthread -ldl -lrt
-Libs: -L${libdir} -ljack -lpthread @OS_LDFLAGS@
+Libs: -L${libdir} -ljack -lpthread
Cflags: -I${includedir}

View File

@ -1,6 +1,6 @@
--- jackd/engine.c.orig 2008-12-02 17:29:23.000000000 +0100
+++ jackd/engine.c 2009-02-11 20:38:52.000000000 +0100
@@ -1383,7 +1383,7 @@
--- jackd/engine.c.orig 2013-11-30 17:04:00 UTC
+++ jackd/engine.c
@@ -1415,7 +1415,7 @@ handle_external_client_request (jack_eng
if ((r = read (client->request_fd, &req, sizeof (req)))
< (ssize_t) sizeof (req)) {
if (r == 0) {
@ -9,7 +9,7 @@
/* poll is implemented using
select (see the macosx/fakepoll
code). When the socket is closed
@@ -1396,7 +1396,7 @@
@@ -1428,7 +1428,7 @@ handle_external_client_request (jack_eng
and remove the client.
*/
jack_mark_client_socket_error (engine, fd);

View File

@ -1,6 +1,6 @@
--- libjack/client.c.orig 2014-10-23 09:09:09.000000000 +0200
+++ libjack/client.c 2014-10-23 09:20:15.000000000 +0200
@@ -116,6 +116,30 @@
--- libjack/client.c.orig 2014-01-21 22:48:10 UTC
+++ libjack/client.c
@@ -116,6 +116,30 @@ init_cpu ()
char *jack_tmpdir = DEFAULT_TMP_DIR;
@ -31,7 +31,7 @@
static int
jack_get_tmpdir ()
{
@@ -248,7 +272,7 @@
@@ -248,7 +272,7 @@ oop_client_deliver_request (void *ptr, j
int wok, rok;
jack_client_t *client = (jack_client_t*) ptr;
@ -40,7 +40,7 @@
== sizeof (*req));
/* if necessary, add variable length key data after a PropertyChange request
@@ -256,7 +280,7 @@
@@ -256,7 +280,7 @@ oop_client_deliver_request (void *ptr, j
if (req->type == PropertyChangeNotify) {
if (req->x.property.keylen) {
@ -49,7 +49,7 @@
jack_error ("cannot send property key of length %d to server",
req->x.property.keylen);
req->status = -1;
@@ -265,7 +289,7 @@
@@ -265,7 +289,7 @@ oop_client_deliver_request (void *ptr, j
}
}
@ -58,7 +58,7 @@
== sizeof (*req));
if (wok && rok) { /* everything OK? */
@@ -822,14 +846,14 @@
@@ -822,14 +846,14 @@ server_event_connect (jack_client_t *cli
jack_uuid_copy (&req.client_id, client->control->uuid);
@ -75,7 +75,7 @@
jack_error ("cannot read event connect result from server (%s)",
strerror (errno));
close (fd);
@@ -1070,14 +1094,14 @@
@@ -1070,14 +1094,14 @@ jack_request_client (ClientType type,
snprintf (req.object_data, sizeof (req.object_data),
"%s", va->load_init);
@ -92,7 +92,7 @@
if (errno == 0) {
/* server shut the socket */
@@ -1456,7 +1480,7 @@
@@ -1456,7 +1480,7 @@ jack_internal_client_close (const char *
return;
}
@ -101,7 +101,7 @@
jack_error ("cannot deliver ClientUnload request to JACK "
"server.");
}
@@ -1582,7 +1606,7 @@
@@ -1582,7 +1606,7 @@ jack_session_notify (jack_client_t* clie
request.x.session.type = code;
@ -110,7 +110,7 @@
!= sizeof (request)) ) {
jack_error ("cannot send request type %d to server",
request.type);
@@ -1592,7 +1616,7 @@
@@ -1592,7 +1616,7 @@ jack_session_notify (jack_client_t* clie
while( 1 ) {
jack_uuid_t uid;
@ -119,7 +119,7 @@
jack_error ("cannot read result for request type %d from"
" server (%s)", request.type, strerror (errno));
goto out;
@@ -1613,19 +1637,19 @@
@@ -1613,19 +1637,19 @@ jack_session_notify (jack_client_t* clie
break;
}
@ -142,7 +142,7 @@
!= sizeof(retval[num_replies-1].flags) ) {
jack_error ("cannot read result for request type %d from"
" server (%s)", request.type, strerror (errno));
@@ -1742,7 +1766,7 @@
@@ -1742,7 +1766,7 @@ jack_client_process_events (jack_client_
/* server has sent us an event. process the
* event and reply */
@ -151,7 +151,7 @@
!= sizeof (event)) {
jack_error ("cannot read server event (%s)",
strerror (errno));
@@ -1751,7 +1775,7 @@
@@ -1751,7 +1775,7 @@ jack_client_process_events (jack_client_
if (event.type == PropertyChange) {
key = (char *) malloc (event.y.key_size);
@ -160,7 +160,7 @@
event.y.key_size) {
jack_error ("cannot read property change key (%s)",
strerror (errno));
@@ -1868,7 +1892,7 @@
@@ -1868,7 +1892,7 @@ jack_client_process_events (jack_client_
DEBUG ("client has dealt with the event, writing "
"response on event fd");
@ -169,7 +169,7 @@
!= sizeof (status)) {
jack_error ("cannot send event response to "
"engine (%s)", strerror (errno));
@@ -1888,7 +1912,7 @@
@@ -1888,7 +1912,7 @@ jack_wake_next_client (jack_client_t* cl
int pret = 0;
char c = 0;
@ -178,7 +178,7 @@
!= sizeof (c)) {
DEBUG("cannot write byte to fd %d", client->graph_next_fd);
jack_error ("cannot continue execution of the "
@@ -1916,7 +1940,7 @@
@@ -1916,7 +1940,7 @@ jack_wake_next_client (jack_client_t* cl
}
if (pret > 0 && (pfds[0].revents & POLLIN)) {