FreeBSD Bugzilla – Attachment 249946 Details for
Bug 259255
audio/portaudio: support ALSA by option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
experimental patch for audio/portaudio
patch.diff (text/plain), 50.05 KB, created by
Tatsuki Makino
on 2024-04-13 07:10:05 UTC
(
hide
)
Description:
experimental patch for audio/portaudio
Filename:
MIME Type:
Creator:
Tatsuki Makino
Created:
2024-04-13 07:10:05 UTC
Size:
50.05 KB
patch
obsolete
>diff --git a/audio/portaudio/Makefile b/audio/portaudio/Makefile >index 9f9c5c74f90..8a10ef24a8d 100644 >--- a/audio/portaudio/Makefile >+++ b/audio/portaudio/Makefile >@@ -1,73 +1,74 @@ > PORTNAME= portaudio >-PORTVERSION= 19.6.0 >-PORTREVISION= 7 >+PORTVERSION= 19.7.0 > PORTEPOCH= 1 > CATEGORIES= audio >-MASTER_SITES= http://www.portaudio.com/archives/ >-DISTNAME= pa_stable_v190600_20161030 > > MAINTAINER= multimedia@FreeBSD.org > COMMENT= Portable cross-platform Audio API >-WWW= http://www.portaudio.com/ >+WWW= https://www.portaudio.com/ > > LICENSE= MIT > LICENSE_FILE= ${WRKSRC}/LICENSE.txt > >-USES= autoreconf:2.69 cpe dos2unix gmake libtool localbase:ldflags \ >- pathfix pkgconfig tar:tgz >-USE_LDCONFIG= yes >+USES= cmake cpe pathfix pkgconfig > CPE_VENDOR= portaudio_project >- >-GNU_CONFIGURE= yes >-CONFIGURE_ARGS= --disable-dependency-tracking \ >- --enable-cxx \ >- --without-alsa >-MAKE_ARGS= EXAMPLES="" >- >-MAKE_JOBS_UNSAFE= yes >- >-WRKSRC= ${WRKDIR}/${PORTNAME} >- >+USE_GITHUB= yes >+GH_ACCOUNT= PortAudio >+GH_TAGNAME= 88ab584e7bf4358599744cd662cfbc978f41efbf >+USE_LDCONFIG= yes >+CMAKE_ARGS= -DOSS_INCLUDE_DIR:PATH=/usr/include \ >+ -DCMAKE_INSTALL_DOCDIR:PATH=${DOCSDIR_REL:Q} >+CMAKE_ON= PA_BUILD_SHARED_LIBS \ >+ PA_USE_OSS >+CMAKE_OFF= PA_ALSA_DYNAMIC \ >+ PA_USE_SKELETON \ >+ PA_WARNINGS_ARE_ERRORS >+SUB_FILES= pkg-message > PORTDOCS= * > PORTEXAMPLES= * > >-OPTIONS_DEFINE= DOCS DOXYGEN EXAMPLES JACK PATEST SNDIO >+OPTIONS_DEFINE= ALSA DOCS DOXYGEN EXAMPLES JACK PATEST PULSEAUDIO SNDIO >+OPTIONS_DEFAULT= > OPTIONS_SUB= yes >- >-SUB_FILES= pkg-message >- > PATEST_DESC= PortAudio Test Programs >- >+ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib >+ALSA_CMAKE_BOOL= PA_USE_ALSA > DOXYGEN_IMPLIES= DOCS > DOXYGEN_BUILD_DEPENDS= doxygen:devel/doxygen >- >+EXAMPLES_CMAKE_BOOL= PA_BUILD_EXAMPLES > JACK_LIB_DEPENDS= libjack.so:audio/jack >-JACK_CONFIGURE_WITH= jack >- >-PATEST_MAKE_ARGS_OFF= SELFTESTS="" \ >- TESTS="" >- >+JACK_CMAKE_BOOL= PA_USE_JACK >+PATEST_CMAKE_BOOL= PA_BUILD_TESTS >+PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio >+PULSEAUDIO_CMAKE_BOOL= PA_USE_PULSEAUDIO > SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio >-SNDIO_CONFIGURE_WITH= sndio >+SNDIO_CMAKE_BOOL= PA_USE_SNDIO > >-post-extract: >- @${MKDIR} ${WRKSRC}/src/hostapi/sndio >- @${CP} ${FILESDIR}/pa_sndio.c ${WRKSRC}/src/hostapi/sndio >+.include <bsd.port.options.mk> > >-post-install: >- @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libportaudio.so \ >- ${STAGEDIR}${PREFIX}/lib/libportaudiocpp.so >- ${INSTALL_DATA} ${FILESDIR}/pa_unix_oss.h ${STAGEDIR}${PREFIX}/include >+.ifdef WITH_DEBUG >+CMAKE_ON+= PA_ENABLE_DEBUG_OUTPUT >+.else >+CMAKE_OFF+= PA_ENABLE_DEBUG_OUTPUT >+.endif > >-post-install-DOCS-on: >+do-build-DOXYGEN-on: >+ @(cd ${WRKSRC}; if ! doxygen ; then \ >+ (${ECHO_CMD} "===> ${.TARGET} failed unexpectedly.") | ${FMT_80} ; \ >+ ${FALSE}; \ >+ fi) >+ >+${STAGEDIR}${DOCSDIR}: > @${MKDIR} ${STAGEDIR}${DOCSDIR} >- cd ${WRKSRC} && ${INSTALL_DATA} README.txt index.html ${STAGEDIR}${DOCSDIR} > >-post-install-DOXYGEN-on: >- @cd ${WRKSRC} && doxygen >+do-install-DOCS-on: ${STAGEDIR}${DOCSDIR} >+ >+do-install-DOXYGEN-on: ${STAGEDIR}${DOCSDIR} > @cd ${WRKSRC}/doc && ${COPYTREE_SHARE} html ${STAGEDIR}${DOCSDIR} > >-post-install-EXAMPLES-on: >+do-install-EXAMPLES-on: >+ ${FIND} ${INSTALL_WRKSRC}/examples -maxdepth 1 -type f -name pa\* -print0 |\ >+ ${XARGS} -0 -J % ${INSTALL_PROGRAM} % ${STAGEDIR}${PREFIX}/bin > @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} > ${INSTALL_DATA} ${WRKSRC}/bindings/cpp/example/*.cxx \ > ${WRKSRC}/examples/*.c ${WRKSRC}/examples/*.cpp \ >@@ -75,10 +76,10 @@ post-install-EXAMPLES-on: > ${WRKSRC}/src/common/*.[ch] \ > ${STAGEDIR}${EXAMPLESDIR} > >-post-install-PATEST-on: >-.for f in pa_m* paqa_* patest* >- ${STRIP_CMD} ${WRKSRC}/bin/.libs/${f} >- ${INSTALL_PROGRAM} ${WRKSRC}/bin/.libs/${f} ${STAGEDIR}${PREFIX}/bin/ >-.endfor >+do-install-PATEST-on: >+ ${FIND} ${INSTALL_WRKSRC}/test -maxdepth 1 -type f -name pa\* -print0 |\ >+ ${XARGS} -0 -J % ${INSTALL_PROGRAM} % ${STAGEDIR}${PREFIX}/bin >+ ${FIND} ${INSTALL_WRKSRC}/qa -maxdepth 1 -type f -name pa\* -print0 |\ >+ ${XARGS} -0 -J % ${INSTALL_PROGRAM} % ${STAGEDIR}${PREFIX}/bin > > .include <bsd.port.mk> >diff --git a/audio/portaudio/distinfo b/audio/portaudio/distinfo >index 3ade793e5e3..b92209f2a4f 100644 >--- a/audio/portaudio/distinfo >+++ b/audio/portaudio/distinfo >@@ -1,3 +1,3 @@ >-TIMESTAMP = 1531882553 >-SHA256 (pa_stable_v190600_20161030.tgz) = f5a21d7dcd6ee84397446fa1fa1a0675bb2e8a4a6dceb4305a8404698d8d1513 >-SIZE (pa_stable_v190600_20161030.tgz) = 1450572 >+TIMESTAMP = 1712286000 >+SHA256 (PortAudio-portaudio-19.7.0-88ab584e7bf4358599744cd662cfbc978f41efbf_GH0.tar.gz) = f5be535d62cab5f1becd4f19207466c813fbcf51d9057e72f7d57544a9e9ee03 >+SIZE (PortAudio-portaudio-19.7.0-88ab584e7bf4358599744cd662cfbc978f41efbf_GH0.tar.gz) = 1491142 >diff --git a/audio/portaudio/files/pa_sndio.c b/audio/portaudio/files/pa_sndio.c >deleted file mode 100644 >index 725ef4792b1..00000000000 >--- a/audio/portaudio/files/pa_sndio.c >+++ /dev/null >@@ -1,765 +0,0 @@ >-/* >- * Copyright (c) 2009 Alexandre Ratchov <alex@caoua.org> >- * >- * Permission to use, copy, modify, and distribute this software for any >- * purpose with or without fee is hereby granted, provided that the above >- * copyright notice and this permission notice appear in all copies. >- * >- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES >- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF >- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR >- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES >- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN >- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF >- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. >- */ >-#include <sys/types.h> >-#include <pthread.h> >-#include <poll.h> >-#include <errno.h> >-#include <string.h> >-#include <stdlib.h> >-#include <stdio.h> >-#include <sndio.h> >- >-#include "pa_util.h" >-#include "pa_hostapi.h" >-#include "pa_stream.h" >-#include "pa_process.h" >-#include "pa_allocation.h" >- >-#if 0 >-#define DPR(...) do { fprintf(stderr, __VA_ARGS__); } while (0) >-#else >-#define DPR(...) do {} while (0) >-#endif >- >-/* >- * per-stream data >- */ >-typedef struct PaSndioStream >-{ >- PaUtilStreamRepresentation base; >- PaUtilBufferProcessor bufproc; /* format conversion */ >- struct sio_hdl *hdl; /* handle for device i/o */ >- struct sio_par par; /* current device parameters */ >- unsigned mode; /* SIO_PLAY, SIO_REC or both */ >- int stopped; /* stop requested or not started */ >- int active; /* thread is running */ >- unsigned long long realpos; /* frame number h/w is processing */ >- char *rbuf, *wbuf; /* bounce buffers for conversions */ >- unsigned long long rpos, wpos; /* bytes read/written */ >- pthread_t thread; /* thread of the callback interface */ >-} PaSndioStream; >- >-/* >- * api "class" data, common to all streams >- */ >-typedef struct PaSndioHostApiRepresentation >-{ >- PaUtilHostApiRepresentation base; >- PaUtilStreamInterface callback; >- PaUtilStreamInterface blocking; >- /* >- * sndio has no device discovery mechanism and PortAudio has >- * no way of accepting raw device strings from users. >- * Normally we just expose the default device, which can be >- * changed via the AUDIODEVICE environment variable, but we >- * also allow specifying a list of up to 16 devices via the >- * PA_SNDIO_AUDIODEVICES environment variable. >- * >- * Example: >- * PA_SNDIO_AUDIODEVICES=default:snd/0.monitor:snd@remote/0 >- */ >-#define PA_SNDIO_AUDIODEVICES_MAX 16 >- PaDeviceInfo device_info[PA_SNDIO_AUDIODEVICES_MAX]; >- PaDeviceInfo *infos[PA_SNDIO_AUDIODEVICES_MAX]; >- char *audiodevices; >-} PaSndioHostApiRepresentation; >- >-/* >- * callback invoked when blocks are processed by the hardware >- */ >-static void >-sndioOnMove(void *addr, int delta) >-{ >- PaSndioStream *s = (PaSndioStream *)addr; >- >- s->realpos += delta; >-} >- >-/* >- * convert PA encoding to sndio encoding, return true on success >- */ >-static int >-sndioSetFmt(struct sio_par *sio, PaSampleFormat fmt) >-{ >- switch (fmt & ~paNonInterleaved) { >- case paInt32: >- sio->sig = 1; >- sio->bits = 32; >- break; >- case paInt24: >- sio->sig = 1; >- sio->bits = 24; >- sio->bps = 3; /* paInt24 is packed format */ >- break; >- case paInt16: >- case paFloat32: >- sio->sig = 1; >- sio->bits = 16; >- break; >- case paInt8: >- sio->sig = 1; >- sio->bits = 8; >- break; >- case paUInt8: >- sio->sig = 0; >- sio->bits = 8; >- break; >- default: >- DPR("sndioSetFmt: %x: unsupported\n", fmt); >- return 0; >- } >- sio->le = SIO_LE_NATIVE; >- return 1; >-} >- >-/* >- * convert sndio encoding to PA encoding, return true on success >- */ >-static int >-sndioGetFmt(struct sio_par *sio, PaSampleFormat *fmt) >-{ >- if ((sio->bps * 8 != sio->bits && !sio->msb) || >- (sio->bps > 1 && sio->le != SIO_LE_NATIVE)) { >- DPR("sndioGetFmt: bits = %u, le = %u, msb = %u, bps = %u\n", >- sio->bits, sio->le, sio->msb, sio->bps); >- return 0; >- } >- >- switch (sio->bits) { >- case 32: >- if (!sio->sig) >- return 0; >- *fmt = paInt32; >- break; >- case 24: >- if (!sio->sig) >- return 0; >- *fmt = (sio->bps == 3) ? paInt24 : paInt32; >- break; >- case 16: >- if (!sio->sig) >- return 0; >- *fmt = paInt16; >- break; >- case 8: >- *fmt = sio->sig ? paInt8 : paUInt8; >- break; >- default: >- DPR("sndioGetFmt: %u: unsupported\n", sio->bits); >- return 0; >- } >- return 1; >-} >- >-/* >- * I/O loop for callback interface >- */ >-static void * >-sndioThread(void *arg) >-{ >- PaSndioStream *s = (PaSndioStream *)arg; >- PaStreamCallbackTimeInfo ti; >- unsigned char *data; >- unsigned todo, rblksz, wblksz; >- int n, result; >- >- rblksz = s->par.round * s->par.rchan * s->par.bps; >- wblksz = s->par.round * s->par.pchan * s->par.bps; >- >- DPR("sndioThread: mode = %x, round = %u, rblksz = %u, wblksz = %u\n", >- s->mode, s->par.round, rblksz, wblksz); >- >- while (!s->stopped) { >- if (s->mode & SIO_REC) { >- todo = rblksz; >- data = s->rbuf; >- while (todo > 0) { >- n = sio_read(s->hdl, data, todo); >- if (n == 0) { >- DPR("sndioThread: sio_read failed\n"); >- goto failed; >- } >- todo -= n; >- data += n; >- } >- s->rpos += s->par.round; >- ti.inputBufferAdcTime = >- (double)s->realpos / s->par.rate; >- } >- if (s->mode & SIO_PLAY) { >- ti.outputBufferDacTime = >- (double)(s->realpos + s->par.bufsz) / s->par.rate; >- } >- ti.currentTime = s->realpos / (double)s->par.rate; >- PaUtil_BeginBufferProcessing(&s->bufproc, &ti, 0); >- if (s->mode & SIO_PLAY) { >- PaUtil_SetOutputFrameCount(&s->bufproc, s->par.round); >- PaUtil_SetInterleavedOutputChannels(&s->bufproc, >- 0, s->wbuf, s->par.pchan); >- } >- if (s->mode & SIO_REC) { >- PaUtil_SetInputFrameCount(&s->bufproc, s->par.round); >- PaUtil_SetInterleavedInputChannels(&s->bufproc, >- 0, s->rbuf, s->par.rchan); >- } >- result = paContinue; >- n = PaUtil_EndBufferProcessing(&s->bufproc, &result); >- if (n != s->par.round) { >- DPR("sndioThread: %d < %u frames, result = %d\n", >- n, s->par.round, result); >- } >- if (result != paContinue) { >- break; >- } >- if (s->mode & SIO_PLAY) { >- n = sio_write(s->hdl, s->wbuf, wblksz); >- if (n < wblksz) { >- DPR("sndioThread: sio_write failed\n"); >- goto failed; >- } >- s->wpos += s->par.round; >- } >- } >- failed: >- s->active = 0; >- DPR("sndioThread: done\n"); >-} >- >-static PaError >-OpenStream(struct PaUtilHostApiRepresentation *hostApi, >- PaStream **stream, >- const PaStreamParameters *inputPar, >- const PaStreamParameters *outputPar, >- double sampleRate, >- unsigned long framesPerBuffer, >- PaStreamFlags streamFlags, >- PaStreamCallback *streamCallback, >- void *userData) >-{ >- PaSndioHostApiRepresentation *sndioHostApi = (PaSndioHostApiRepresentation *)hostApi; >- PaSndioStream *s; >- PaError err; >- struct sio_hdl *hdl; >- struct sio_par par; >- unsigned mode; >- int inch, onch; >- PaSampleFormat ifmt, ofmt, siofmt; >- const char *dev; >- >- DPR("OpenStream:\n"); >- >- mode = 0; >- inch = onch = 0; >- ifmt = ofmt = 0; >- sio_initpar(&par); >- >- if (outputPar && outputPar->channelCount > 0) { >- if (outputPar->device >= sndioHostApi->base.info.deviceCount) { >- DPR("OpenStream: %d: bad output device\n", outputPar->device); >- return paInvalidDevice; >- } >- if (outputPar->hostApiSpecificStreamInfo) { >- DPR("OpenStream: output specific info\n"); >- return paIncompatibleHostApiSpecificStreamInfo; >- } >- if (!sndioSetFmt(&par, outputPar->sampleFormat)) { >- return paSampleFormatNotSupported; >- } >- ofmt = outputPar->sampleFormat; >- onch = par.pchan = outputPar->channelCount; >- mode |= SIO_PLAY; >- } >- if (inputPar && inputPar->channelCount > 0) { >- if (inputPar->device >= sndioHostApi->base.info.deviceCount) { >- DPR("OpenStream: %d: bad input device\n", inputPar->device); >- return paInvalidDevice; >- } >- if (inputPar->hostApiSpecificStreamInfo) { >- DPR("OpenStream: input specific info\n"); >- return paIncompatibleHostApiSpecificStreamInfo; >- } >- if (!sndioSetFmt(&par, inputPar->sampleFormat)) { >- return paSampleFormatNotSupported; >- } >- ifmt = inputPar->sampleFormat; >- inch = par.rchan = inputPar->channelCount; >- mode |= SIO_REC; >- } >- par.rate = sampleRate; >- if (framesPerBuffer != paFramesPerBufferUnspecified) >- par.round = framesPerBuffer; >- >- DPR("OpenStream: mode = %x, trying rate = %u\n", mode, par.rate); >- >- if (outputPar) { >- dev = sndioHostApi->device_info[outputPar->device].name; >- } else if (inputPar) { >- dev = sndioHostApi->device_info[inputPar->device].name; >- } else { >- return paUnanticipatedHostError; >- } >- hdl = sio_open(dev, mode, 0); >- if (hdl == NULL) >- return paUnanticipatedHostError; >- if (!sio_setpar(hdl, &par)) { >- sio_close(hdl); >- return paUnanticipatedHostError; >- } >- if (!sio_getpar(hdl, &par)) { >- sio_close(hdl); >- return paUnanticipatedHostError; >- } >- if (!sndioGetFmt(&par, &siofmt)) { >- sio_close(hdl); >- return paSampleFormatNotSupported; >- } >- if ((mode & SIO_REC) && par.rchan != inputPar->channelCount) { >- DPR("OpenStream: rchan(%u) != %d\n", par.rchan, inputPar->channelCount); >- sio_close(hdl); >- return paInvalidChannelCount; >- } >- if ((mode & SIO_PLAY) && par.pchan != outputPar->channelCount) { >- DPR("OpenStream: pchan(%u) != %d\n", par.pchan, outputPar->channelCount); >- sio_close(hdl); >- return paInvalidChannelCount; >- } >- if ((double)par.rate < sampleRate * 0.995 || >- (double)par.rate > sampleRate * 1.005) { >- DPR("OpenStream: rate(%u) != %g\n", par.rate, sampleRate); >- sio_close(hdl); >- return paInvalidSampleRate; >- } >- >- s = (PaSndioStream *)PaUtil_AllocateMemory(sizeof(PaSndioStream)); >- if (s == NULL) { >- sio_close(hdl); >- return paInsufficientMemory; >- } >- PaUtil_InitializeStreamRepresentation(&s->base, >- streamCallback ? &sndioHostApi->callback : &sndioHostApi->blocking, >- streamCallback, userData); >- DPR("inch = %d, onch = %d, ifmt = %x, ofmt = %x\n", >- inch, onch, ifmt, ofmt); >- err = PaUtil_InitializeBufferProcessor(&s->bufproc, >- inch, ifmt, siofmt, >- onch, ofmt, siofmt, >- sampleRate, >- streamFlags, >- framesPerBuffer, >- par.round, >- paUtilFixedHostBufferSize, >- streamCallback, userData); >- if (err) { >- DPR("OpenStream: PaUtil_InitializeBufferProcessor failed\n"); >- PaUtil_FreeMemory(s); >- sio_close(hdl); >- return err; >- } >- if (mode & SIO_REC) { >- s->rbuf = malloc(par.round * par.rchan * par.bps); >- if (s->rbuf == NULL) { >- DPR("OpenStream: failed to allocate rbuf\n"); >- PaUtil_FreeMemory(s); >- sio_close(hdl); >- return paInsufficientMemory; >- } >- } >- if (mode & SIO_PLAY) { >- s->wbuf = malloc(par.round * par.pchan * par.bps); >- if (s->wbuf == NULL) { >- DPR("OpenStream: failed to allocate wbuf\n"); >- free(s->rbuf); >- PaUtil_FreeMemory(s); >- sio_close(hdl); >- return paInsufficientMemory; >- } >- } >- s->base.streamInfo.inputLatency = 0; >- s->base.streamInfo.outputLatency = (mode & SIO_PLAY) ? >- (double)(par.bufsz + PaUtil_GetBufferProcessorOutputLatencyFrames(&s->bufproc)) / (double)par.rate : 0; >- s->base.streamInfo.sampleRate = par.rate; >- s->active = 0; >- s->stopped = 1; >- s->mode = mode; >- s->hdl = hdl; >- s->par = par; >- *stream = s; >- DPR("OpenStream: done\n"); >- return paNoError; >-} >- >-static PaError >-BlockingReadStream(PaStream *stream, void *data, unsigned long numFrames) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- unsigned n, res, todo; >- void *buf; >- >- while (numFrames > 0) { >- n = s->par.round; >- if (n > numFrames) >- n = numFrames; >- buf = s->rbuf; >- todo = n * s->par.rchan * s->par.bps; >- while (todo > 0) { >- res = sio_read(s->hdl, buf, todo); >- if (res == 0) >- return paUnanticipatedHostError; >- buf = (char *)buf + res; >- todo -= res; >- } >- s->rpos += n; >- PaUtil_SetInputFrameCount(&s->bufproc, n); >- PaUtil_SetInterleavedInputChannels(&s->bufproc, 0, s->rbuf, s->par.rchan); >- res = PaUtil_CopyInput(&s->bufproc, &data, n); >- if (res != n) { >- DPR("BlockingReadStream: copyInput: %u != %u\n"); >- return paUnanticipatedHostError; >- } >- numFrames -= n; >- } >- return paNoError; >-} >- >-static PaError >-BlockingWriteStream(PaStream* stream, const void *data, unsigned long numFrames) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- unsigned n, res; >- >- while (numFrames > 0) { >- n = s->par.round; >- if (n > numFrames) >- n = numFrames; >- PaUtil_SetOutputFrameCount(&s->bufproc, n); >- PaUtil_SetInterleavedOutputChannels(&s->bufproc, 0, s->wbuf, s->par.pchan); >- res = PaUtil_CopyOutput(&s->bufproc, &data, n); >- if (res != n) { >- DPR("BlockingWriteStream: copyOutput: %u != %u\n"); >- return paUnanticipatedHostError; >- } >- res = sio_write(s->hdl, s->wbuf, n * s->par.pchan * s->par.bps); >- if (res == 0) >- return paUnanticipatedHostError; >- s->wpos += n; >- numFrames -= n; >- } >- return paNoError; >-} >- >-static signed long >-BlockingGetStreamReadAvailable(PaStream *stream) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- struct pollfd pfd; >- int n, events; >- >- n = sio_pollfd(s->hdl, &pfd, POLLIN); >- while (poll(&pfd, n, 0) < 0) { >- if (errno == EINTR) >- continue; >- perror("poll"); >- abort(); >- } >- events = sio_revents(s->hdl, &pfd); >- if (!(events & POLLIN)) >- return 0; >- >- return s->realpos - s->rpos; >-} >- >-static signed long >-BlockingGetStreamWriteAvailable(PaStream *stream) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- struct pollfd pfd; >- int n, events; >- >- n = sio_pollfd(s->hdl, &pfd, POLLOUT); >- while (poll(&pfd, n, 0) < 0) { >- if (errno == EINTR) >- continue; >- perror("poll"); >- abort(); >- } >- events = sio_revents(s->hdl, &pfd); >- if (!(events & POLLOUT)) >- return 0; >- >- return s->par.bufsz - (s->wpos - s->realpos); >-} >- >-static PaError >-BlockingWaitEmpty( PaStream *stream ) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- >- /* >- * drain playback buffers; sndio always does it in background >- * and there is no way to wait for completion >- */ >- DPR("BlockingWaitEmpty: s=%d, a=%d\n", s->stopped, s->active); >- >- return paNoError; >-} >- >-static PaError >-StartStream(PaStream *stream) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- unsigned primes, wblksz; >- int err; >- >- DPR("StartStream: s=%d, a=%d\n", s->stopped, s->active); >- >- if (!s->stopped) { >- DPR("StartStream: already started\n"); >- return paNoError; >- } >- s->stopped = 0; >- s->active = 1; >- s->realpos = 0; >- s->wpos = 0; >- s->rpos = 0; >- PaUtil_ResetBufferProcessor(&s->bufproc); >- if (!sio_start(s->hdl)) >- return paUnanticipatedHostError; >- >- /* >- * send a complete buffer of silence >- */ >- if (s->mode & SIO_PLAY) { >- wblksz = s->par.round * s->par.pchan * s->par.bps; >- memset(s->wbuf, 0, wblksz); >- for (primes = s->par.bufsz / s->par.round; primes > 0; primes--) >- s->wpos += sio_write(s->hdl, s->wbuf, wblksz); >- } >- if (s->base.streamCallback) { >- err = pthread_create(&s->thread, NULL, sndioThread, s); >- if (err) { >- DPR("SndioStartStream: couldn't create thread\n"); >- return paUnanticipatedHostError; >- } >- DPR("StartStream: started...\n"); >- } >- return paNoError; >-} >- >-static PaError >-StopStream(PaStream *stream) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- void *ret; >- int err; >- >- DPR("StopStream: s=%d, a=%d\n", s->stopped, s->active); >- >- if (s->stopped) { >- DPR("StartStream: already started\n"); >- return paNoError; >- } >- s->stopped = 1; >- if (s->base.streamCallback) { >- err = pthread_join(s->thread, &ret); >- if (err) { >- DPR("SndioStop: couldn't join thread\n"); >- return paUnanticipatedHostError; >- } >- } >- if (!sio_stop(s->hdl)) >- return paUnanticipatedHostError; >- return paNoError; >-} >- >-static PaError >-CloseStream(PaStream *stream) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- >- DPR("CloseStream:\n"); >- >- if (!s->stopped) >- StopStream(stream); >- >- if (s->mode & SIO_REC) >- free(s->rbuf); >- if (s->mode & SIO_PLAY) >- free(s->wbuf); >- sio_close(s->hdl); >- PaUtil_TerminateStreamRepresentation(&s->base); >- PaUtil_TerminateBufferProcessor(&s->bufproc); >- PaUtil_FreeMemory(s); >- return paNoError; >-} >- >-static PaError >-AbortStream(PaStream *stream) >-{ >- DPR("AbortStream:\n"); >- >- return StopStream(stream); >-} >- >-static PaError >-IsStreamStopped(PaStream *stream) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- >- //DPR("IsStreamStopped: s=%d, a=%d\n", s->stopped, s->active); >- >- return s->stopped; >-} >- >-static PaError >-IsStreamActive(PaStream *stream) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- >- //DPR("IsStreamActive: s=%d, a=%d\n", s->stopped, s->active); >- >- return s->active; >-} >- >-static PaTime >-GetStreamTime(PaStream *stream) >-{ >- PaSndioStream *s = (PaSndioStream *)stream; >- >- return (double)s->realpos / s->base.streamInfo.sampleRate; >-} >- >-static PaError >-IsFormatSupported(struct PaUtilHostApiRepresentation *hostApi, >- const PaStreamParameters *inputPar, >- const PaStreamParameters *outputPar, >- double sampleRate) >-{ >- return paFormatIsSupported; >-} >- >-static void >-Terminate(struct PaUtilHostApiRepresentation *hostApi) >-{ >- PaSndioHostApiRepresentation *sndioHostApi; >- sndioHostApi = (PaSndioHostApiRepresentation *)hostApi; >- free(sndioHostApi->audiodevices); >- PaUtil_FreeMemory(hostApi); >-} >- >-static void >-InitDeviceInfo(PaDeviceInfo *info, PaHostApiIndex hostApiIndex, const char *name) >-{ >- info->structVersion = 2; >- info->name = name; >- info->hostApi = hostApiIndex; >- info->maxInputChannels = 128; >- info->maxOutputChannels = 128; >- info->defaultLowInputLatency = 0.01; >- info->defaultLowOutputLatency = 0.01; >- info->defaultHighInputLatency = 0.5; >- info->defaultHighOutputLatency = 0.5; >- info->defaultSampleRate = 48000; >-} >- >-PaError >-PaSndio_Initialize(PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex) >-{ >- PaSndioHostApiRepresentation *sndioHostApi; >- PaDeviceInfo *info; >- struct sio_hdl *hdl; >- char *audiodevices; >- char *device; >- size_t deviceCount; >- >- DPR("PaSndio_Initialize: initializing...\n"); >- >- /* unusable APIs should return paNoError and a NULL hostApi */ >- *hostApi = NULL; >- >- sndioHostApi = PaUtil_AllocateMemory(sizeof(PaSndioHostApiRepresentation)); >- if (sndioHostApi == NULL) >- return paNoError; >- >- // Add default device >- info = &sndioHostApi->device_info[0]; >- InitDeviceInfo(info, hostApiIndex, SIO_DEVANY); >- sndioHostApi->infos[0] = info; >- deviceCount = 1; >- >- // Add additional devices as specified in the PA_SNDIO_AUDIODEVICES >- // environment variable as a colon separated list >- sndioHostApi->audiodevices = NULL; >- audiodevices = getenv("PA_SNDIO_AUDIODEVICES"); >- if (audiodevices != NULL) { >- sndioHostApi->audiodevices = strdup(audiodevices); >- if (sndioHostApi->audiodevices == NULL) >- return paNoError; >- >- audiodevices = sndioHostApi->audiodevices; >- while ((device = strsep(&audiodevices, ":")) != NULL && >- deviceCount < PA_SNDIO_AUDIODEVICES_MAX) { >- if (*device == '\0') >- continue; >- info = &sndioHostApi->device_info[deviceCount]; >- InitDeviceInfo(info, hostApiIndex, device); >- sndioHostApi->infos[deviceCount] = info; >- deviceCount++; >- } >- } >- >- *hostApi = &sndioHostApi->base; >- (*hostApi)->info.structVersion = 1; >- (*hostApi)->info.type = paSndio; >- (*hostApi)->info.name = "sndio"; >- (*hostApi)->info.deviceCount = deviceCount; >- (*hostApi)->info.defaultInputDevice = 0; >- (*hostApi)->info.defaultOutputDevice = 0; >- (*hostApi)->deviceInfos = sndioHostApi->infos; >- (*hostApi)->Terminate = Terminate; >- (*hostApi)->OpenStream = OpenStream; >- (*hostApi)->IsFormatSupported = IsFormatSupported; >- >- PaUtil_InitializeStreamInterface(&sndioHostApi->blocking, >- CloseStream, >- StartStream, >- StopStream, >- AbortStream, >- IsStreamStopped, >- IsStreamActive, >- GetStreamTime, >- PaUtil_DummyGetCpuLoad, >- BlockingReadStream, >- BlockingWriteStream, >- BlockingGetStreamReadAvailable, >- BlockingGetStreamWriteAvailable); >- >- PaUtil_InitializeStreamInterface(&sndioHostApi->callback, >- CloseStream, >- StartStream, >- StopStream, >- AbortStream, >- IsStreamStopped, >- IsStreamActive, >- GetStreamTime, >- PaUtil_DummyGetCpuLoad, >- PaUtil_DummyRead, >- PaUtil_DummyWrite, >- PaUtil_DummyGetReadAvailable, >- PaUtil_DummyGetWriteAvailable); >- >- DPR("PaSndio_Initialize: done\n"); >- return paNoError; >-} >diff --git a/audio/portaudio/files/pa_unix_oss.h b/audio/portaudio/files/pa_unix_oss.h >deleted file mode 100644 >index 2351e6468c5..00000000000 >--- a/audio/portaudio/files/pa_unix_oss.h >+++ /dev/null >@@ -1,52 +0,0 @@ >-#ifndef PA_UNIX_OSS_H >-#define PA_UNIX_OSS_H >- >-/* >- * $Id: portaudio.patch,v 1.10 2009-06-30 04:52:59 llucius Exp $ >- * PortAudio Portable Real-Time Audio Library >- * OSS-specific extensions >- * >- * Copyright (c) 1999-2000 Ross Bencina and Phil Burk >- * >- * Permission is hereby granted, free of charge, to any person obtaining >- * a copy of this software and associated documentation files >- * (the "Software"), to deal in the Software without restriction, >- * including without limitation the rights to use, copy, modify, merge, >- * publish, distribute, sublicense, and/or sell copies of the Software, >- * and to permit persons to whom the Software is furnished to do so, >- * subject to the following conditions: >- * >- * The above copyright notice and this permission notice shall be >- * included in all copies or substantial portions of the Software. >- * >- * Any person wishing to distribute modifications to the Software is >- * requested to send the modifications to the original developer so that >- * they can be incorporated into the canonical version. >- * >- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, >- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF >- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. >- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR >- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF >- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION >- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. >- * >- */ >- >-/** @file >- * OSS-specific PortAudio API extension header file. >- */ >- >-#ifdef __cplusplus >-extern "C" { >-#endif >- >-const char *PaOSS_GetStreamInputDevice( PaStream *s ); >- >-const char *PaOSS_GetStreamOutputDevice( PaStream *s ); >- >-#ifdef __cplusplus >-} >-#endif >- >-#endif >diff --git a/audio/portaudio/files/patch-CMakeLists.txt b/audio/portaudio/files/patch-CMakeLists.txt >new file mode 100644 >index 00000000000..7c9251d2cf1 >--- /dev/null >+++ b/audio/portaudio/files/patch-CMakeLists.txt >@@ -0,0 +1,35 @@ >+--- CMakeLists.txt.orig 2024-03-08 23:13:37 UTC >++++ CMakeLists.txt >+@@ -349,6 +349,7 @@ elseif(UNIX) >+ target_link_libraries(PortAudio PRIVATE "${ALSA_LIBRARIES}") >+ set(PKGCONFIG_REQUIRES_PRIVATE "${PKGCONFIG_REQUIRES_PRIVATE} alsa") >+ endif() >++ target_include_directories(PortAudio PRIVATE ${ALSA_INCLUDE_DIRS}) >+ endif() >+ >+ # OSS is intentionally off by default to avoid confusing users of PortAudio >+@@ -393,11 +394,12 @@ elseif(UNIX) >+ pkg_check_modules(SNDIO sndio) >+ cmake_dependent_option(PA_USE_SNDIO "Enable support for sndio" ON SNDIO_FOUND OFF) >+ if(PA_USE_SNDIO) >+- target_link_libraries(PortAudio PRIVATE "${SNDIO_LIBRARIES}") >++ target_link_libraries(PortAudio PRIVATE "${SNDIO_LINK_LIBRARIES}") >+ target_sources(PortAudio PRIVATE src/hostapi/sndio/pa_sndio.c) >+ target_compile_definitions(PortAudio PUBLIC PA_USE_SNDIO=1) >+ set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_SNDIO=1") >+ set(PKGCONFIG_REQUIRES_PRIVATE "${PKGCONFIG_REQUIRES_PRIVATE} sndio") >++ target_include_directories(PortAudio PRIVATE ${SNDIO_INCLUDE_DIRS}) >+ endif() >+ endif() >+ endif() >+@@ -418,8 +420,8 @@ target_sources(PortAudio PRIVATE ${PORTAUDIO_PUBLIC_HE >+ include(CMakePackageConfigHelpers) >+ >+ if(NOT CMAKE_FRAMEWORK) >+- install(FILES README.md DESTINATION "${CMAKE_INSTALL_DOCDIR}/portaudio") >+- install(FILES LICENSE.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}/portaudio") >++ install(FILES README.md DESTINATION "${CMAKE_INSTALL_DOCDIR}") >++ install(FILES LICENSE.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}") >+ >+ configure_file(cmake/portaudio-2.0.pc.in "${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc" @ONLY) >+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc" >diff --git a/audio/portaudio/files/patch-Makefile.in b/audio/portaudio/files/patch-Makefile.in >deleted file mode 100644 >index 34b0ef54b5e..00000000000 >--- a/audio/portaudio/files/patch-Makefile.in >+++ /dev/null >@@ -1,11 +0,0 @@ >-$OpenBSD: patch-Makefile_in,v 1.4 2013/03/12 00:59:50 brad Exp $ >---- Makefile.in.orig 2016-06-22 08:28:31 UTC >-+++ Makefile.in >-@@ -146,6 +146,7 @@ SRC_DIRS = \ >- src/hostapi/dsound \ >- src/hostapi/jack \ >- src/hostapi/oss \ >-+ src/hostapi/sndio \ >- src/hostapi/wasapi \ >- src/hostapi/wdmks \ >- src/hostapi/wmme \ >diff --git a/audio/portaudio/files/patch-configure.in b/audio/portaudio/files/patch-configure.in >deleted file mode 100644 >index 27618f2ff38..00000000000 >--- a/audio/portaudio/files/patch-configure.in >+++ /dev/null >@@ -1,47 +0,0 @@ >-$OpenBSD: patch-configure_in,v 1.4 2014/09/13 04:56:28 bentley Exp $ >---- configure.in.orig 2016-06-22 08:28:31 UTC >-+++ configure.in >-@@ -24,6 +24,10 @@ AC_ARG_WITH(alsa, >- AS_HELP_STRING([--with-alsa], [Enable support for ALSA @<:@autodetect@:>@]), >- [with_alsa=$withval]) >- >-+AC_ARG_WITH(sndio, >-+ AS_HELP_STRING([--with-sndio], [Enable support for sndio @<:@autodetect@:>@]), >-+ [with_sndio=$withval]) >-+ >- AC_ARG_WITH(jack, >- AS_HELP_STRING([--with-jack], [Enable support for JACK @<:@autodetect@:>@]), >- [with_jack=$withval]) >-@@ -120,6 +124,10 @@ have_alsa=no >- if test "x$with_alsa" != "xno"; then >- AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no) >- fi >-+have_sndio=no >-+if test "x$with_sndio" != "xno"; then >-+ AC_CHECK_LIB(sndio, sio_open, have_sndio=yes, have_sndio=no) >-+fi >- have_asihpi=no >- if test "x$with_asihpi" != "xno"; then >- AC_CHECK_LIB(hpi, HPI_SubSysCreate, have_asihpi=yes, have_asihpi=no, -lm) >-@@ -397,6 +405,13 @@ case "${host_os}" in >- AC_DEFINE(PA_USE_ALSA,1) >- fi >- >-+ if [[ "$have_sndio" = "yes" -a "$with_sndio" != "no" ]] ; then >-+ DLL_LIBS="$DLL_LIBS -lsndio" >-+ LIBS="$LIBS -lsndio" >-+ OTHER_OBJS="$OTHER_OBJS src/hostapi/sndio/pa_sndio.o" >-+ AC_DEFINE(PA_USE_SNDIO,1) >-+ fi >-+ >- if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then >- DLL_LIBS="$DLL_LIBS $JACK_LIBS" >- CFLAGS="$CFLAGS $JACK_CFLAGS" >-@@ -500,6 +515,7 @@ case "$target_os" in >- ;; >- *) >- AC_MSG_RESULT([ >-+ Sndio ....................... $have_sndio >- OSS ......................... $have_oss >- JACK ........................ $have_jack >- ]) >diff --git a/audio/portaudio/files/patch-include_portaudio.h b/audio/portaudio/files/patch-include_portaudio.h >deleted file mode 100644 >index 03f8a427de6..00000000000 >--- a/audio/portaudio/files/patch-include_portaudio.h >+++ /dev/null >@@ -1,29 +0,0 @@ >-$OpenBSD: patch-include_portaudio_h,v 1.2 2013/03/12 00:59:50 brad Exp $ >---- include/portaudio.h.orig 2018-07-17 06:55:08 UTC >-+++ include/portaudio.h >-@@ -236,7 +236,8 @@ typedef enum PaHostApiTypeId >- paWDMKS=11, >- paJACK=12, >- paWASAPI=13, >-- paAudioScienceHPI=14 >-+ paAudioScienceHPI=14, >-+ paSndio=15 >- } PaHostApiTypeId; >- >- >-@@ -1144,6 +1145,15 @@ signed long Pa_GetStreamReadAvailable( PaStream* strea >- error is encountered. >- */ >- signed long Pa_GetStreamWriteAvailable( PaStream* stream ); >-+ >-+ >-+/** Retrieve the host type handling an open stream. >-+ >-+ @return Returns a non-negative value representing the host API type >-+ handling an open stream or, a PaErrorCode (which are always negative) >-+ if PortAudio is not initialized or an error is encountered. >-+*/ >-+PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream ); >- >- >- /* Miscellaneous utilities */ >diff --git a/audio/portaudio/files/patch-src_common_pa__front.c b/audio/portaudio/files/patch-src_common_pa__front.c >deleted file mode 100644 >index a480e9cbc7a..00000000000 >--- a/audio/portaudio/files/patch-src_common_pa__front.c >+++ /dev/null >@@ -1,47 +0,0 @@ >---- src/common/pa_front.c.orig 2018-07-17 06:44:39 UTC >-+++ src/common/pa_front.c >-@@ -1216,8 +1216,10 @@ PaError Pa_OpenStream( PaStream** stream, >- hostApiInputParametersPtr, hostApiOutputParametersPtr, >- sampleRate, framesPerBuffer, streamFlags, streamCallback, userData ); >- >-- if( result == paNoError ) >-+ if( result == paNoError ) { >- AddOpenStream( *stream ); >-+ PA_STREAM_REP(*stream)->hostApiType = hostApi->info.type; >-+ } >- >- >- PA_LOGAPI(("Pa_OpenStream returned:\n" )); >-@@ -1729,6 +1731,32 @@ signed long Pa_GetStreamWriteAvailable( PaStream* stre >- return result; >- } >- >-+PaHostApiTypeId Pa_GetStreamHostApiType( PaStream* stream ) >-+{ >-+ PaError error = PaUtil_ValidateStreamPointer( stream ); >-+ PaHostApiTypeId result; >-+ >-+#ifdef PA_LOG_API_CALLS >-+ PaUtil_DebugPrint("Pa_GetStreamHostApiType called:\n" ); >-+ PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream ); >-+#endif >-+ >-+ if( error == paNoError ) >-+ { >-+ result = PA_STREAM_REP(stream)->hostApiType; >-+ } >-+ else >-+ { >-+ result = (PaHostApiTypeId) error; >-+ } >-+ >-+#ifdef PA_LOG_API_CALLS >-+ PaUtil_DebugPrint("Pa_GetStreamHostApiType returned:\n" ); >-+ PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) ); >-+#endif >-+ >-+ return result; >-+} >- >- PaError Pa_GetSampleSize( PaSampleFormat format ) >- { >diff --git a/audio/portaudio/files/patch-src_common_pa__stream.c b/audio/portaudio/files/patch-src_common_pa__stream.c >deleted file mode 100644 >index 1e6b3d36257..00000000000 >--- a/audio/portaudio/files/patch-src_common_pa__stream.c >+++ /dev/null >@@ -1,11 +0,0 @@ >---- src/common/pa_stream.c.orig 2018-07-17 06:44:39 UTC >-+++ src/common/pa_stream.c >-@@ -93,6 +93,8 @@ void PaUtil_InitializeStreamRepresentation( PaUtilStre >- streamRepresentation->streamInfo.inputLatency = 0.; >- streamRepresentation->streamInfo.outputLatency = 0.; >- streamRepresentation->streamInfo.sampleRate = 0.; >-+ >-+ streamRepresentation->hostApiType = 0; >- } >- >- >diff --git a/audio/portaudio/files/patch-src_common_pa__stream.h b/audio/portaudio/files/patch-src_common_pa__stream.h >deleted file mode 100644 >index 957cd4f989e..00000000000 >--- a/audio/portaudio/files/patch-src_common_pa__stream.h >+++ /dev/null >@@ -1,10 +0,0 @@ >---- src/common/pa_stream.h.orig 2018-07-17 06:44:39 UTC >-+++ src/common/pa_stream.h >-@@ -152,6 +152,7 @@ typedef struct PaUtilStreamRepresentation { >- PaStreamFinishedCallback *streamFinishedCallback; >- void *userData; >- PaStreamInfo streamInfo; >-+ PaHostApiTypeId hostApiType; >- } PaUtilStreamRepresentation; >- >- >diff --git a/audio/portaudio/files/patch-src_hostapi_alsa_pa__linux__alsa.c b/audio/portaudio/files/patch-src_hostapi_alsa_pa__linux__alsa.c >new file mode 100644 >index 00000000000..6ab4d8ca00d >--- /dev/null >+++ b/audio/portaudio/files/patch-src_hostapi_alsa_pa__linux__alsa.c >@@ -0,0 +1,72 @@ >+--- src/hostapi/alsa/pa_linux_alsa.c.orig 2024-03-08 23:13:37 UTC >++++ src/hostapi/alsa/pa_linux_alsa.c >+@@ -849,6 +849,7 @@ static PaError GropeDevice( snd_pcm_t* pcm, int isPlug >+ double * defaultLowLatency, * defaultHighLatency, * defaultSampleRate = >+ &devInfo->baseDeviceInfo.defaultSampleRate; >+ double defaultSr = *defaultSampleRate; >++ int dir; >+ >+ assert( pcm ); >+ >+@@ -889,10 +890,11 @@ static PaError GropeDevice( snd_pcm_t* pcm, int isPlug >+ if( defaultSr < 0. ) /* Default sample rate not set */ >+ { >+ unsigned int sampleRate = 44100; /* Will contain approximate rate returned by alsa-lib */ >++ dir = 0; >+ >+ /* Don't allow rate resampling when probing for the default rate (but ignore if this call fails) */ >+ alsa_snd_pcm_hw_params_set_rate_resample( pcm, hwParams, 0 ); >+- if( alsa_snd_pcm_hw_params_set_rate_near( pcm, hwParams, &sampleRate, NULL ) < 0 ) >++ if( alsa_snd_pcm_hw_params_set_rate_near( pcm, hwParams, &sampleRate, &dir ) < 0 ) >+ { >+ result = paUnanticipatedHostError; >+ goto error; >+@@ -902,7 +904,7 @@ static PaError GropeDevice( snd_pcm_t* pcm, int isPlug >+ >+ ENSURE_( alsa_snd_pcm_hw_params_get_channels_min( hwParams, &minChans ), paUnanticipatedHostError ); >+ ENSURE_( alsa_snd_pcm_hw_params_get_channels_max( hwParams, &maxChans ), paUnanticipatedHostError ); >+- const unsigned int kReasonableMaxChannels = 1024; >++ const unsigned int kReasonableMaxChannels = 10000; /* alsa-lib-*?/src/pcm/pcm_plug.c snd_pcm_plug_hw_refine_cprepare */ >+ if( maxChans > kReasonableMaxChannels ) >+ { >+ PA_DEBUG(( "%s: maxChans = %u, which is unreasonably high\n", __FUNCTION__, maxChans )); >+@@ -938,18 +940,20 @@ static PaError GropeDevice( snd_pcm_t* pcm, int isPlug >+ /* Try low latency values, (sometimes the buffer & period that result are larger) */ >+ alsaBufferFrames = 512; >+ alsaPeriodFrames = 128; >++ dir = 0; >+ ENSURE_( alsa_snd_pcm_hw_params_set_buffer_size_near( pcm, hwParams, &alsaBufferFrames ), paUnanticipatedHostError ); >+- ENSURE_( alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, NULL ), paUnanticipatedHostError ); >++ ENSURE_( alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir ), paUnanticipatedHostError ); >+ *defaultLowLatency = (double) (alsaBufferFrames - alsaPeriodFrames) / defaultSr; >+ >+ /* Base the high latency case on values four times larger */ >+ alsaBufferFrames = 2048; >+ alsaPeriodFrames = 512; >++ dir = 0; >+ /* Have to reset hwParams, to set new buffer size; need to also set sample rate again */ >+ ENSURE_( alsa_snd_pcm_hw_params_any( pcm, hwParams ), paUnanticipatedHostError ); >+ ENSURE_( SetApproximateSampleRate( pcm, hwParams, defaultSr ), paUnanticipatedHostError ); >+ ENSURE_( alsa_snd_pcm_hw_params_set_buffer_size_near( pcm, hwParams, &alsaBufferFrames ), paUnanticipatedHostError ); >+- ENSURE_( alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, NULL ), paUnanticipatedHostError ); >++ ENSURE_( alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir ), paUnanticipatedHostError ); >+ *defaultHighLatency = (double) (alsaBufferFrames - alsaPeriodFrames) / defaultSr; >+ >+ *minChannels = (int)minChans; >+@@ -3234,13 +3238,15 @@ static int SetApproximateSampleRate( snd_pcm_t *pcm, s >+ { >+ PaError result = paNoError; >+ unsigned int reqRate, setRate, deviation; >++ int dir; >+ >+ assert( pcm && hwParams ); >+ >+ /* The Alsa sample rate is set by integer value; also the actual rate may differ */ >+ reqRate = setRate = (unsigned int) sampleRate; >++ dir = 0; >+ >+- ENSURE_( alsa_snd_pcm_hw_params_set_rate_near( pcm, hwParams, &setRate, NULL ), paUnanticipatedHostError ); >++ ENSURE_( alsa_snd_pcm_hw_params_set_rate_near( pcm, hwParams, &setRate, &dir ), paUnanticipatedHostError ); >+ /* The value actually set will be put in 'setRate' (may be way off); check the deviation as a proportion >+ * of the requested-rate with reference to the max-deviate-ratio (larger values allow less deviation) */ >+ deviation = abs( (int)setRate - (int)reqRate ); >diff --git a/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c b/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c >index 04ba48af304..1beac5cc3ab 100644 >--- a/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c >+++ b/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c >@@ -1,48 +1,18 @@ >---- src/hostapi/oss/pa_unix_oss.c.orig 2019-03-01 03:09:23 UTC >+--- src/hostapi/oss/pa_unix_oss.c.orig 2024-03-08 23:13:37 UTC > +++ src/hostapi/oss/pa_unix_oss.c >-@@ -535,13 +535,13 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta >- * add it to a linked list. >- * A: Set an arbitrary of 100 devices, should probably be a smarter way. */ >+@@ -683,13 +683,13 @@ static PaError IsFormatSupported( struct PaUtilHostApi > >-- for( i = 0; i < 100; i++ ) >-+ for( i = -1; i < 100; i++ ) >+ if( inputChannelCount > 0 ) > { >- char deviceName[32]; >- PaDeviceInfo *deviceInfo; >- int testResult; >- >-- if( i == 0 ) >-+ if( i == -1 ) >- snprintf(deviceName, sizeof (deviceName), "%s", DEVICE_NAME_BASE); >- else >- snprintf(deviceName, sizeof (deviceName), "%s%d", DEVICE_NAME_BASE, i); >-@@ -2041,5 +2041,29 @@ static signed long GetStreamWriteAvailable( PaStream* >- error: >- return result; >- #endif >-+} >-+ >-+const char *PaOSS_GetStreamInputDevice( PaStream* s ) >-+{ >-+ PaOssStream *stream = (PaOssStream*)s; >-+ >-+ if( stream->capture ) >-+ { >-+ return stream->capture->devName; >-+ } >-+ >-+ return NULL; >-+} >-+ >-+const char *PaOSS_GetStreamOutputDevice( PaStream* s ) >-+{ >-+ PaOssStream *stream = (PaOssStream*)s; >-+ >-+ if( stream->playback ) >-+ { >-+ return stream->playback->devName; >-+ } >-+ >-+ return NULL; >- } >- >+- result = PaUtil_DeviceIndexToHostApiDeviceIndex(&device, inputParameters->device, hostApi); >++ result = PaUtil_DeviceIndexToHostApiDeviceIndex(&device, inputParameters->device + hostApi->privatePaFrontInfo.baseDeviceIndex, hostApi); >+ if (result != paNoError) >+ return result; >+ } >+ else >+ { >+- result = PaUtil_DeviceIndexToHostApiDeviceIndex(&device, outputParameters->device, hostApi); >++ result = PaUtil_DeviceIndexToHostApiDeviceIndex(&device, outputParameters->device + hostApi->privatePaFrontInfo.baseDeviceIndex, hostApi); >+ if (result != paNoError) >+ return result; >+ } >diff --git a/audio/portaudio/files/patch-src_hostapi_pulseaudio_pa__linux__pulseaudio__cb.c b/audio/portaudio/files/patch-src_hostapi_pulseaudio_pa__linux__pulseaudio__cb.c >new file mode 100644 >index 00000000000..075d3d1ec55 >--- /dev/null >+++ b/audio/portaudio/files/patch-src_hostapi_pulseaudio_pa__linux__pulseaudio__cb.c >@@ -0,0 +1,74 @@ >+--- src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c.orig 2024-03-08 23:13:37 UTC >++++ src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c >+@@ -468,6 +468,7 @@ PaError PaPulseAudio_CloseStreamCb( PaStream * s ) >+ PaPulseAudio_Stream *stream = (PaPulseAudio_Stream *) s; >+ PaPulseAudio_HostApiRepresentation *pulseaudioHostApi = stream->hostapi; >+ pa_operation *pulseaudioOperation = NULL; >++ pa_stream_state_t pa_stream_state; >+ int waitLoop = 0; >+ int pulseaudioError = 0; >+ >+@@ -478,7 +479,7 @@ PaError PaPulseAudio_CloseStreamCb( PaStream * s ) >+ stream->pulseaudioIsStopped = 1; >+ >+ if( stream->outputStream != NULL >+- && pa_stream_get_state( stream->outputStream ) == PA_STREAM_READY ) >++ && PA_STREAM_IS_GOOD(pa_stream_get_state( stream->outputStream )) ) >+ { >+ PaPulseAudio_Lock(stream->mainloop); >+ /* Pause stream so it stops faster */ >+@@ -510,7 +511,7 @@ PaError PaPulseAudio_CloseStreamCb( PaStream * s ) >+ } >+ >+ if( stream->inputStream != NULL >+- && pa_stream_get_state( stream->inputStream ) == PA_STREAM_READY ) >++ && PA_STREAM_IS_GOOD(pa_stream_get_state( stream->inputStream )) ) >+ { >+ PaPulseAudio_Lock( stream->mainloop ); >+ /* Pause stream so it stops so it stops faster */ >+@@ -551,19 +552,43 @@ PaError PaPulseAudio_CloseStreamCb( PaStream * s ) >+ { >+ PaPulseAudio_Lock( stream->mainloop ); >+ if( stream->inputStream != NULL >+- && pa_stream_get_state( stream->inputStream ) == PA_STREAM_TERMINATED ) >++ && !PA_STREAM_IS_GOOD(pa_stream_state = pa_stream_get_state( stream->inputStream )) ) >+ { >+ pa_stream_unref( stream->inputStream ); >+ stream->inputStream = NULL; >++ switch (pa_stream_state) { >++ case PA_STREAM_UNCONNECTED: >++PA_DEBUG(("PortAudio %s: inputStream PA_STREAM_UNCONNECTED\n", __FUNCTION__)); >++ break; >++ case PA_STREAM_FAILED: >++PA_DEBUG(("PortAudio %s: inputStream PA_STREAM_FAILED\n", __FUNCTION__)); >++ break; >++ case PA_STREAM_TERMINATED: >++PA_DEBUG(("PortAudio %s: inputStream PA_STREAM_TERMINATED\n", __FUNCTION__)); >++ break; >++ default: ; >++ } >+ } >+ PaPulseAudio_UnLock( stream->mainloop ); >+ >+ PaPulseAudio_Lock( stream->mainloop ); >+ if( stream->outputStream != NULL >+- && pa_stream_get_state(stream->outputStream) == PA_STREAM_TERMINATED ) >++ && !PA_STREAM_IS_GOOD(pa_stream_state = pa_stream_get_state( stream->outputStream )) ) >+ { >+ pa_stream_unref( stream->outputStream ); >+ stream->outputStream = NULL; >++ switch (pa_stream_state) { >++ case PA_STREAM_UNCONNECTED: >++PA_DEBUG(("PortAudio %s: outputStream PA_STREAM_UNCONNECTED\n", __FUNCTION__)); >++ break; >++ case PA_STREAM_FAILED: >++PA_DEBUG(("PortAudio %s: outputStream PA_STREAM_FAILED\n", __FUNCTION__)); >++ break; >++ case PA_STREAM_TERMINATED: >++PA_DEBUG(("PortAudio %s: outputStream PA_STREAM_TERMINATED\n", __FUNCTION__)); >++ break; >++ default: ; >++ } >+ } >+ PaPulseAudio_UnLock( stream->mainloop ); >+ >diff --git a/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c b/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c >deleted file mode 100644 >index 47bd56a7bb1..00000000000 >--- a/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c >+++ /dev/null >@@ -1,26 +0,0 @@ >-$OpenBSD: patch-src_os_unix_pa_unix_hostapis_c,v 1.2 2013/03/12 00:59:50 brad Exp $ >- >-Difference to OpenBSD patch: PA_USE_SNDIO has been moved before >-PA_USE_OSS, so that portaudio prefers the sndio output. >- >---- src/os/unix/pa_unix_hostapis.c.orig 2018-07-17 07:08:09 UTC >-+++ src/os/unix/pa_unix_hostapis.c >-@@ -44,6 +44,7 @@ >- >- PaError PaJack_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); >- PaError PaAlsa_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); >-+PaError PaSndio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); >- PaError PaOSS_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); >- /* Added for IRIX, Pieter, oct 2, 2003: */ >- PaError PaSGI_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); >-@@ -68,6 +69,10 @@ PaUtilHostApiInitializer *paHostApiInitializers[] = >- #endif >- >- #else /* __linux__ */ >-+ >-+#ifdef PA_USE_SNDIO >-+ PaSndio_Initialize, >-+#endif >- >- #if PA_USE_OSS >- PaOSS_Initialize, >diff --git a/audio/portaudio/pkg-plist b/audio/portaudio/pkg-plist >index 4d520ee9372..480763b81a6 100644 >--- a/audio/portaudio/pkg-plist >+++ b/audio/portaudio/pkg-plist >@@ -1,4 +1,16 @@ >+%%EXAMPLES%%bin/pa_devs >+%%EXAMPLES%%bin/pa_fuzz > %%PATEST%%bin/pa_minlat >+%%EXAMPLES%%bin/paex_ocean_shore >+%%EXAMPLES%%bin/paex_pink >+%%EXAMPLES%%bin/paex_read_write_wire >+%%EXAMPLES%%bin/paex_record >+%%EXAMPLES%%bin/paex_record_file >+%%EXAMPLES%%bin/paex_saw >+%%EXAMPLES%%bin/paex_sine >+%%EXAMPLES%%bin/paex_sine_c++ >+%%EXAMPLES%%bin/paex_write_sine >+%%EXAMPLES%%bin/paex_write_sine_nonint > %%PATEST%%bin/paqa_devs > %%PATEST%%bin/paqa_errs > %%PATEST%%bin/paqa_latency >@@ -6,7 +18,9 @@ > %%PATEST%%bin/patest_buffer > %%PATEST%%bin/patest_callbackstop > %%PATEST%%bin/patest_clip >+%%PATEST%%bin/patest_converters > %%PATEST%%bin/patest_dither >+%%PATEST%%bin/patest_enumerate_default_latency > %%PATEST%%bin/patest_hang > %%PATEST%%bin/patest_in_overflow > %%PATEST%%bin/patest_latency >@@ -18,6 +32,7 @@ > %%PATEST%%bin/patest_multi_sine > %%PATEST%%bin/patest_out_underflow > %%PATEST%%bin/patest_prime >+%%PATEST%%bin/patest_read_record > %%PATEST%%bin/patest_ringmix > %%PATEST%%bin/patest_sine8 > %%PATEST%%bin/patest_sine_channelmaps >@@ -27,39 +42,27 @@ > %%PATEST%%bin/patest_start_stop > %%PATEST%%bin/patest_stop > %%PATEST%%bin/patest_stop_playout >+%%PATEST%%bin/patest_suggested_vs_streaminfo_latency >+%%PATEST%%bin/patest_sync >+%%PATEST%%bin/patest_timing > %%PATEST%%bin/patest_toomanysines > %%PATEST%%bin/patest_two_rates > %%PATEST%%bin/patest_underflow >+%%PATEST%%bin/patest_unplug > %%PATEST%%bin/patest_wire >+%%PATEST%%bin/patest_write_stop >+%%PATEST%%bin/patest_write_stop_hang_illegal > %%JACK%%include/pa_jack.h >-include/pa_unix_oss.h >+%%ALSA%%include/pa_linux_alsa.h > include/portaudio.h >-include/portaudiocpp/AutoSystem.hxx >-include/portaudiocpp/BlockingStream.hxx >-include/portaudiocpp/CFunCallbackStream.hxx >-include/portaudiocpp/CallbackInterface.hxx >-include/portaudiocpp/CallbackStream.hxx >-include/portaudiocpp/CppFunCallbackStream.hxx >-include/portaudiocpp/Device.hxx >-include/portaudiocpp/DirectionSpecificStreamParameters.hxx >-include/portaudiocpp/Exception.hxx >-include/portaudiocpp/HostApi.hxx >-include/portaudiocpp/InterfaceCallbackStream.hxx >-include/portaudiocpp/MemFunCallbackStream.hxx >-include/portaudiocpp/PortAudioCpp.hxx >-include/portaudiocpp/SampleDataFormat.hxx >-include/portaudiocpp/Stream.hxx >-include/portaudiocpp/StreamParameters.hxx >-include/portaudiocpp/System.hxx >-include/portaudiocpp/SystemDeviceIterator.hxx >-include/portaudiocpp/SystemHostApiIterator.hxx >-lib/libportaudio.a >+lib/cmake/portaudio/PortAudioConfig.cmake >+lib/cmake/portaudio/PortAudioConfigVersion.cmake >+lib/cmake/portaudio/PortAudioTargets-%%CMAKE_BUILD_TYPE%%.cmake >+lib/cmake/portaudio/PortAudioTargets.cmake >+%%JACK%%lib/cmake/portaudio/modules/FindJACK.cmake >+%%PULSEAUDIO%%lib/cmake/portaudio/modules/FindPulseAudio.cmake >+%%JACK%%lib/cmake/portaudio/modules/FindRegex.cmake > lib/libportaudio.so >+lib/libportaudio.so.19.8 > lib/libportaudio.so.2 >-lib/libportaudio.so.2.0.0 >-lib/libportaudiocpp.a >-lib/libportaudiocpp.so >-lib/libportaudiocpp.so.0 >-lib/libportaudiocpp.so.0.0.12 > libdata/pkgconfig/portaudio-2.0.pc >-libdata/pkgconfig/portaudiocpp.pc
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
Flags:
tatsuki_makino
:
maintainer-approval?
Actions:
View
|
Diff
Attachments on
bug 259255
:
228816
|
228818
|
246036
|
249753
|
249829
|
249944
| 249946