aboutsummaryrefslogtreecommitdiff
path: root/audio/portaudio
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2018-07-18 02:53:35 +0000
committerTobias Kortkamp <tobik@FreeBSD.org>2018-07-18 02:53:35 +0000
commit1f33b362e2d9956918259d4929975868f7d467ee (patch)
tree1e96f37da23f64ed2c028de0b1ef2d585ffaca8e /audio/portaudio
parent3b61536f7c0e2b5f0031913e10f09182a635b932 (diff)
downloadports-1f33b362e2d9956918259d4929975868f7d467ee.tar.gz
ports-1f33b362e2d9956918259d4929975868f7d467ee.zip
audio/portaudio: Add three new functions* required by Audacity
* Pa_GetStreamHostApiType, PaOSS_GetStream{In,Out}putDevice This will allow us to change audio/audacity to use audio/portaudio instead of the bundled version. End goal is sndio support in Audacity without having to duplicate existing patches. While here - Remove unnecessary patches - Cleanup DOCS and PATEST install - Take maintainership Obtained from: Audacity 2.2.2's portaudio.patch
Notes
Notes: svn path=/head/; revision=474829
Diffstat (limited to 'audio/portaudio')
-rw-r--r--audio/portaudio/Makefile51
-rw-r--r--audio/portaudio/files/pa_unix_oss.h52
-rw-r--r--audio/portaudio/files/patch-include_portaudio.h18
-rw-r--r--audio/portaudio/files/patch-src_common_pa__front.c47
-rw-r--r--audio/portaudio/files/patch-src_common_pa__stream.c11
-rw-r--r--audio/portaudio/files/patch-src_common_pa__stream.h10
-rw-r--r--audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c41
-rw-r--r--audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c10
-rw-r--r--audio/portaudio/pkg-plist1
9 files changed, 200 insertions, 41 deletions
diff --git a/audio/portaudio/Makefile b/audio/portaudio/Makefile
index 436cefb23f76..c171911b95a1 100644
--- a/audio/portaudio/Makefile
+++ b/audio/portaudio/Makefile
@@ -3,12 +3,12 @@
PORTNAME= portaudio
DISTVERSION= 19_20140130
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= audio
MASTER_SITES= http://www.portaudio.com/archives/
DISTNAME= pa_stable_v${DISTVERSION}
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= tobik@FreeBSD.org
COMMENT= Portable cross-platform Audio API
LICENSE= MIT
@@ -16,66 +16,57 @@ LICENSE_FILE= ${WRKSRC}/LICENSE.txt
USES= autoreconf dos2unix gmake localbase:ldflags libtool pathfix \
pkgconfig tar:tgz
-GNU_CONFIGURE= yes
-CONFIGURE_ARGS= PKG_CONFIG_LIBDIR=${PREFIX}/libdata/pkgconfig \
- --without-alsa
USE_LDCONFIG= yes
+GNU_CONFIGURE= yes
+CONFIGURE_ARGS= --without-alsa
WRKSRC= ${WRKDIR}/${PORTNAME}
-PORTDOCS= *
-PORTEXAMPLES= *
-
-DOCSRCDIR1= ${WRKSRC}
-DOC_FILES1= README.txt index.html
-
OPTIONS_DEFINE= DOCS DOXYGEN EXAMPLES JACK PATEST SNDIO
+OPTIONS_SUB= yes
PATEST_DESC= PortAudio Test Programs
-DOXYGEN_DESC= Install API documentation (requires DOCS)
-OPTIONS_SUB= yes
+PORTDOCS= *
+
+DOXYGEN_IMPLIES= DOCS
+DOXYGEN_BUILD_DEPENDS= doxygen:devel/doxygen
+
+PORTEXAMPLES= *
JACK_LIB_DEPENDS= libjack.so:audio/jack
JACK_CONFIGURE_WITH= jack
-PATEST_BIN= pa_m* paqa_* patest*
-
SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio
SNDIO_CONFIGURE_WITH= sndio
-DOXYGEN_IMPLIES= DOCS
-DOXYGEN_BUILD_DEPENDS= doxygen:devel/doxygen
-
post-extract:
@${MKDIR} ${WRKSRC}/src/hostapi/sndio
@${CP} ${FILESDIR}/pa_sndio.c ${WRKSRC}/src/hostapi/sndio
post-patch:
- @${REINPLACE_CMD} -e 's|machine/soundcard.h|sys/soundcard.h|' ${WRKSRC}/configure.in \
- ${WRKSRC}/src/hostapi/oss/pa_unix_oss.c ${WRKSRC}/src/SConscript
- @${REINPLACE_CMD} -e 's|PACKAGE_NAME=|PACKAGE_NAME=portaudio2|' ${WRKSRC}/configure
@${REINPLACE_CMD} -i '' '/EXAMPLES =/,/bin\/paex_write_sine_nonint/s/^/#/' \
${WRKSRC}/Makefile.in
post-install:
@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libportaudio.so
-
-post-install-PATEST-on:
-.for f in ${PATEST_BIN}
- ${STRIP_CMD} ${WRKSRC}/bin/.libs/${f}
- ${INSTALL_PROGRAM} ${WRKSRC}/bin/.libs/${f} ${STAGEDIR}${PREFIX}/bin/
-.endfor
+ ${INSTALL_DATA} ${FILESDIR}/pa_unix_oss.h ${STAGEDIR}${PREFIX}/include
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
- ${INSTALL_DATA} ${DOC_FILES1:S|^|${DOCSRCDIR1}/|} ${STAGEDIR}${DOCSDIR}
+ cd ${WRKSRC} && ${INSTALL_DATA} README.txt index.html ${STAGEDIR}${DOCSDIR}
post-install-DOXYGEN-on:
@cd ${WRKSRC} && doxygen
- @(cd ${WRKSRC}/doc && ${COPYTREE_SHARE} html ${STAGEDIR}${DOCSDIR})
+ @cd ${WRKSRC}/doc && ${COPYTREE_SHARE} html ${STAGEDIR}${DOCSDIR}
post-install-EXAMPLES-on:
- (cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
+ @cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${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
.include <bsd.port.mk>
diff --git a/audio/portaudio/files/pa_unix_oss.h b/audio/portaudio/files/pa_unix_oss.h
new file mode 100644
index 000000000000..2351e6468c59
--- /dev/null
+++ b/audio/portaudio/files/pa_unix_oss.h
@@ -0,0 +1,52 @@
+#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-include_portaudio.h b/audio/portaudio/files/patch-include_portaudio.h
index 8c2aad7da5c2..03f8a427de6f 100644
--- a/audio/portaudio/files/patch-include_portaudio.h
+++ b/audio/portaudio/files/patch-include_portaudio.h
@@ -1,5 +1,5 @@
$OpenBSD: patch-include_portaudio_h,v 1.2 2013/03/12 00:59:50 brad Exp $
---- include/portaudio.h.orig 2016-06-22 08:28:31 UTC
+--- include/portaudio.h.orig 2018-07-17 06:55:08 UTC
+++ include/portaudio.h
@@ -236,7 +236,8 @@ typedef enum PaHostApiTypeId
paWDMKS=11,
@@ -11,3 +11,19 @@ $OpenBSD: patch-include_portaudio_h,v 1.2 2013/03/12 00:59:50 brad Exp $
} 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
new file mode 100644
index 000000000000..a480e9cbc7a9
--- /dev/null
+++ b/audio/portaudio/files/patch-src_common_pa__front.c
@@ -0,0 +1,47 @@
+--- 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
new file mode 100644
index 000000000000..1e6b3d362572
--- /dev/null
+++ b/audio/portaudio/files/patch-src_common_pa__stream.c
@@ -0,0 +1,11 @@
+--- 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
new file mode 100644
index 000000000000..957cd4f989e3
--- /dev/null
+++ b/audio/portaudio/files/patch-src_common_pa__stream.h
@@ -0,0 +1,10 @@
+--- 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_oss_pa__unix__oss.c b/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c
index 7bc4cc1d15df..95629e9a9d66 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,4 +1,4 @@
---- src/hostapi/oss/pa_unix_oss.c.orig 2013-06-08 19:30:41 UTC
+--- src/hostapi/oss/pa_unix_oss.c.orig 2018-07-17 07:24:21 UTC
+++ src/hostapi/oss/pa_unix_oss.c
@@ -62,6 +62,9 @@
#include <sys/poll.h>
@@ -10,21 +10,22 @@
#ifdef HAVE_SYS_SOUNDCARD_H
# include <sys/soundcard.h>
-@@ -525,6 +528,13 @@ static PaError BuildDeviceList( PaOSSHos
+@@ -525,7 +528,14 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta
int i;
int numDevices = 0, maxDeviceInfos = 1;
PaDeviceInfo **deviceInfos = NULL;
+ int defaultDevice = 0;
-+
+
+#ifdef __FreeBSD__
+ size_t len = sizeof(defaultDevice);
+ if (sysctlbyname("hw.snd.default_unit", &defaultDevice, &len, NULL, 0) == -1 || len != 4)
+ defaultDevice = 0;
+#endif
-
++
/* These two will be set to the first working input and output device, respectively */
commonApi->info.defaultInputDevice = paNoDevice;
-@@ -541,7 +551,7 @@ static PaError BuildDeviceList( PaOSSHos
+ commonApi->info.defaultOutputDevice = paNoDevice;
+@@ -541,7 +551,7 @@ static PaError BuildDeviceList( PaOSSHostApiRepresenta
PaDeviceInfo *deviceInfo;
int testResult;
@@ -33,3 +34,33 @@
snprintf(deviceName, sizeof (deviceName), "%s", DEVICE_NAME_BASE);
else
snprintf(deviceName, sizeof (deviceName), "%s%d", DEVICE_NAME_BASE, i);
+@@ -2041,5 +2051,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;
+ }
+
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
index 09d9aebcdd76..47bd56a7bb11 100644
--- a/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c
+++ b/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c
@@ -3,7 +3,7 @@ $OpenBSD: patch-src_os_unix_pa_unix_hostapis_c,v 1.2 2013/03/12 00:59:50 brad Ex
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 2016-06-22 08:28:31 UTC
+--- 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 @@
@@ -13,14 +13,14 @@ PA_USE_OSS, so that portaudio prefers the sndio output.
PaError PaOSS_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
/* Added for IRIX, Pieter, oct 2, 2003: */
PaError PaSGI_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
-@@ -69,6 +70,10 @@ PaUtilHostApiInitializer *paHostApiIniti
+@@ -68,6 +69,10 @@ PaUtilHostApiInitializer *paHostApiInitializers[] =
+ #endif
#else /* __linux__ */
-
++
+#ifdef PA_USE_SNDIO
+ PaSndio_Initialize,
+#endif
-+
+
#if PA_USE_OSS
PaOSS_Initialize,
- #endif
diff --git a/audio/portaudio/pkg-plist b/audio/portaudio/pkg-plist
index 20e42314d139..270f3a088933 100644
--- a/audio/portaudio/pkg-plist
+++ b/audio/portaudio/pkg-plist
@@ -32,6 +32,7 @@
%%PATEST%%bin/patest_underflow
%%PATEST%%bin/patest_wire
%%JACK%%include/pa_jack.h
+include/pa_unix_oss.h
include/portaudio.h
lib/libportaudio.a
lib/libportaudio.so