Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2018 02:53:35 +0000 (UTC)
From:      Tobias Kortkamp <tobik@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r474829 - in head/audio/portaudio: . files
Message-ID:  <201807180253.w6I2rZSc061195@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tobik
Date: Wed Jul 18 02:53:35 2018
New Revision: 474829
URL: https://svnweb.freebsd.org/changeset/ports/474829

Log:
  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

Added:
  head/audio/portaudio/files/pa_unix_oss.h   (contents, props changed)
  head/audio/portaudio/files/patch-src_common_pa__front.c   (contents, props changed)
  head/audio/portaudio/files/patch-src_common_pa__stream.c   (contents, props changed)
  head/audio/portaudio/files/patch-src_common_pa__stream.h   (contents, props changed)
Modified:
  head/audio/portaudio/Makefile
  head/audio/portaudio/files/patch-include_portaudio.h
  head/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c
  head/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c
  head/audio/portaudio/pkg-plist

Modified: head/audio/portaudio/Makefile
==============================================================================
--- head/audio/portaudio/Makefile	Wed Jul 18 00:20:27 2018	(r474828)
+++ head/audio/portaudio/Makefile	Wed Jul 18 02:53:35 2018	(r474829)
@@ -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
+	${INSTALL_DATA} ${FILESDIR}/pa_unix_oss.h ${STAGEDIR}${PREFIX}/include
 
-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
-
 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>

Added: head/audio/portaudio/files/pa_unix_oss.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/audio/portaudio/files/pa_unix_oss.h	Wed Jul 18 02:53:35 2018	(r474829)
@@ -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

Modified: head/audio/portaudio/files/patch-include_portaudio.h
==============================================================================
--- head/audio/portaudio/files/patch-include_portaudio.h	Wed Jul 18 00:20:27 2018	(r474828)
+++ head/audio/portaudio/files/patch-include_portaudio.h	Wed Jul 18 02:53:35 2018	(r474829)
@@ -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 0
  } 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 */

Added: head/audio/portaudio/files/patch-src_common_pa__front.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/audio/portaudio/files/patch-src_common_pa__front.c	Wed Jul 18 02:53:35 2018	(r474829)
@@ -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 )
+ {

Added: head/audio/portaudio/files/patch-src_common_pa__stream.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/audio/portaudio/files/patch-src_common_pa__stream.c	Wed Jul 18 02:53:35 2018	(r474829)
@@ -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;
+ }
+ 
+ 

Added: head/audio/portaudio/files/patch-src_common_pa__stream.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/audio/portaudio/files/patch-src_common_pa__stream.h	Wed Jul 18 02:53:35 2018	(r474829)
@@ -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;
+ 
+ 

Modified: head/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c
==============================================================================
--- head/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c	Wed Jul 18 00:20:27 2018	(r474828)
+++ head/audio/portaudio/files/patch-src_hostapi_oss_pa__unix__oss.c	Wed Jul 18 02:53:35 2018	(r474829)
@@ -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;
+ }
+ 

Modified: head/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c
==============================================================================
--- head/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c	Wed Jul 18 00:20:27 2018	(r474828)
+++ head/audio/portaudio/files/patch-src_os_unix_pa__unix__hostapis.c	Wed Jul 18 02:53:35 2018	(r474829)
@@ -3,7 +3,7 @@ $OpenBSD: patch-src_os_unix_pa_unix_hostapis_c,v 1.2 2
 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

Modified: head/audio/portaudio/pkg-plist
==============================================================================
--- head/audio/portaudio/pkg-plist	Wed Jul 18 00:20:27 2018	(r474828)
+++ head/audio/portaudio/pkg-plist	Wed Jul 18 02:53:35 2018	(r474829)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807180253.w6I2rZSc061195>