FreeBSD Bugzilla – Attachment 155765 Details for
Bug 199558
[PATCH] Add support for 24-bit and 32-bit resolution to audio/jack
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for jack port
jack.diff (text/plain), 5.75 KB, created by
Hans Petter Selasky
on 2015-04-20 11:11:34 UTC
(
hide
)
Description:
Patch for jack port
Filename:
MIME Type:
Creator:
Hans Petter Selasky
Created:
2015-04-20 11:11:34 UTC
Size:
5.75 KB
patch
obsolete
>--- files/patch-drivers-oss-oss_driver.c.orig 2015-04-20 12:28:21.269053000 +0200 >+++ files/patch-drivers-oss-oss_driver.c 2015-04-20 12:53:08.517595000 +0200 >@@ -1,5 +1,5 @@ >---- drivers/oss/oss_driver.c.orig >-+++ drivers/oss/oss_driver.c >+--- drivers/oss/oss_driver.c.orig 2013-10-04 02:45:25.000000000 +0200 >++++ drivers/oss/oss_driver.c 2015-04-20 12:52:08.350806000 +0200 > @@ -23,6 +23,7 @@ > > #include <config.h> >@@ -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 @@ > ((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 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 @@ >+ 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 @@ >+ } >+ 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 @@ >+ 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 @@ >+ } >+ 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 @@ >+ 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 @@ > 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 @@ >+ } >+ 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 @@ >+ 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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 199558
: 155765 |
155766
|
155767