- add sndio backend

- remove OSS and esd support
ok ajacoutot@ (MAINTAINER)
This commit is contained in:
jakemsr 2009-01-17 12:30:08 +00:00
parent 38f3ac6915
commit 06dd44f100
13 changed files with 682 additions and 136 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.15 2008/09/08 17:17:10 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.16 2009/01/17 12:30:08 jakemsr Exp $
SHARED_ONLY= Yes
@ -6,7 +6,7 @@ COMMENT= portable Windows library
V= 1_12_0
DISTNAME= ptlib-v${V}
PKGNAME= pwlib-${V:S/_/./g}p6
PKGNAME= pwlib-${V:S/_/./g}p7
CATEGORIES= devel
EXTRACT_SUFX= -src.tar.gz
@ -25,11 +25,10 @@ PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=h323plus/}
WANTLIB= crypto expat ossaudio sasl2 ssl
WANTLIB= crypto expat sndio sasl2 ssl
BUILD_DEPENDS= ::devel/bison
LIB_DEPENDS= esd.>=2::audio/esound \
lber.>=9,ldap,ldap_r::databases/openldap \
LIB_DEPENDS= lber.>=9,ldap,ldap_r::databases/openldap \
SDL.>=8::devel/sdl
WRKDIST= ${WRKDIR}/${DISTNAME:S/-/_/}
@ -47,19 +46,23 @@ CONFIGURE_STYLE=gnu
CONFIGURE_ENV= CPPFLAGS="-I${X11BASE}/include -I${LOCALBASE}/include" \
LDFLAGS="-L${X11BASE}/lib -L${LOCALBASE}/lib"
CONFIGURE_ARGS= --enable-plugins \
--enable-oss \
--enable-esd \
--enable-v4l2 \
--enable-bsdvideo \
--enable-openldap \
--enable-sasl \
--enable-sdl \
--disable-oss \
--disable-esd \
--disable-sunaudio \
--disable-alsa \
--disable-avc \
--disable-dc \
--disable-odbc
post-patch:
@mkdir ${WRKSRC}/plugins/sound_libsndio
@cp ${FILESDIR}/{Makefile,sound_libsndio.*} ${WRKSRC}/plugins/sound_libsndio
pre-configure:
@perl -pi -e 's,!!PREFIX!!,${PREFIX},g' \
${WRKSRC}/src/ptlib/common/pluginmgr.cxx \

View File

@ -0,0 +1,10 @@
ifndef PWLIBDIR
PWLIBDIR = $(HOME)/pwlib
endif
PLUGIN_NAME = libsndio
PLUGIN_FAMILY = device/sound
PLUGIN_LIBS = -lsndio
PLUGIN_SOURCES = sound_libsndio.cxx
include ../../make/plugins.mak

View File

@ -0,0 +1,501 @@
/*
* sound_libsndio.cxx
*
* Sound driver implementation.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* $Log: sound_libsndio.cxx,v $
* Revision 1.1 2009/01/17 12:30:08 jakemsr
* - add sndio backend
* - remove OSS and esd support
* ok ajacoutot@ (MAINTAINER)
*
*/
#pragma implementation "sound_libsndio.h"
#include "sound_libsndio.h"
#include <sys/poll.h>
PCREATE_SOUND_PLUGIN(LIBSNDIO, PSoundChannelLIBSNDIO);
PSoundChannelLIBSNDIO::PSoundChannelLIBSNDIO()
{
PSoundChannelLIBSNDIO::Construct();
}
PSoundChannelLIBSNDIO::PSoundChannelLIBSNDIO(const PString & device,
Directions dir,
unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample)
{
Construct();
Open(device, dir, numChannels, sampleRate, bitsPerSample);
}
void PSoundChannelLIBSNDIO::Construct()
{
os_handle = -1;
hdl = NULL;
}
PSoundChannelLIBSNDIO::~PSoundChannelLIBSNDIO()
{
Close();
}
PStringArray PSoundChannelLIBSNDIO::GetDeviceNames(Directions)
{
static const char * const devices[] = {
"default",
"/tmp/aucat.sock",
"/dev/audio0",
"/dev/audio1",
"/dev/audio2"
};
return PStringArray(PARRAYSIZE(devices), devices);
}
PString PSoundChannelLIBSNDIO::GetDefaultDevice(Directions dir)
{
return "default";
}
BOOL PSoundChannelLIBSNDIO::Open(const PString & device,
Directions dir,
unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample)
{
uint mode;
char sio_device[32];
Close();
if (dir == Recorder)
mode = SIO_REC;
else
mode = SIO_PLAY;
snprintf(sio_device, 32, "%s", (const char *)device);
if (strncmp(sio_device, "default", 7) == 0)
hdl = sio_open(NULL, mode, 0);
else
hdl = sio_open(sio_device, mode, 0);
if (hdl == NULL) {
printf("sio_open failed\n");
return FALSE;
}
mDirection = dir;
mDevice = device;
mSampleRate = sampleRate;
mNumChannels = numChannels;
mBitsPerSample = bitsPerSample;
mBytesPerFrame = (bitsPerSample / 8) * numChannels;
isInitialised = FALSE;
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::Setup()
{
if (!hdl) {
PTRACE(6, "LIBSNDIO\tSkipping setup of " << mDevice << " as not open");
return FALSE;
}
if (isInitialised) {
PTRACE(6, "LIBSNDIO\tSkipping setup of " << mDevice << " as instance already initialised");
return TRUE;
}
PTRACE(6, "LIBSNDIO\tInitialising " << mDevice);
sio_initpar(&par);
int framesPerFrag = mFragSize / mBytesPerFrame;
par.bufsz = mFragCount * framesPerFrag;
par.round = framesPerFrag;
par.bits = mBitsPerSample;
par.sig = 1;
#if PBYTE_ORDER == PLITTLE_ENDIAN
par.le = 1;
#else
par.le = 0;
#endif
if (mDirection == Recorder)
par.rchan = mNumChannels;
else
par.pchan = mNumChannels;
par.rate = mSampleRate;
if (!sio_setpar(hdl, &par)) {
printf("sio_setpar failed\n");
return FALSE;
}
if (!sio_getpar(hdl, &par)) {
printf("sio_getpar failed\n");
return FALSE;
}
mFragSize = par.round * mBytesPerFrame;
mFragCount = par.bufsz / par.round;
if (!sio_start(hdl)) {
printf("sio_start failed\n");
return FALSE;
}
isInitialised = TRUE;
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::Close()
{
if (!hdl)
return TRUE;
sio_close(hdl);
hdl = NULL;
return PChannel::Close();
}
BOOL PSoundChannelLIBSNDIO::IsOpen() const
{
return (hdl != NULL);
}
BOOL PSoundChannelLIBSNDIO::Write(const void * buf, PINDEX len)
{
lastWriteCount = 0;
if (!Setup() || !hdl)
return FALSE;
int did, tot = 0;
while (len > 0) {
did = sio_write(hdl, (void *)buf, len);
if (did == 0) {
printf("sio_write failed\n");
return FALSE;
}
len -= did;
(char *)buf += did;
tot += did;
}
lastWriteCount += tot;
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::Read(void * buf, PINDEX len)
{
lastReadCount = 0;
if (!Setup() || !hdl)
return FALSE;
int did, tot = 0;
while (len > 0) {
did = sio_read(hdl, buf, len);
if (did == 0) {
printf("sio_read failed\n");
return FALSE;
}
len -= did;
(char *)buf += did;
tot += did;
}
lastReadCount += tot;
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::SetFormat(unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample)
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
PAssert((bitsPerSample == 8) || (bitsPerSample == 16), PInvalidParameter);
PAssert(numChannels >= 1 && numChannels <= 2, PInvalidParameter);
if (isInitialised) {
if ((numChannels != mNumChannels) ||
(sampleRate != mSampleRate) ||
(bitsPerSample != mBitsPerSample)) {
PTRACE(6, "LIBSNDIO\tTried to change read/write format without stopping");
return FALSE;
}
return TRUE;
}
mNumChannels = numChannels;
mSampleRate = sampleRate;
mBitsPerSample = bitsPerSample;
isInitialised = FALSE;
return TRUE;
}
unsigned PSoundChannelLIBSNDIO::GetChannels() const
{
return mNumChannels;
}
unsigned PSoundChannelLIBSNDIO::GetSampleRate() const
{
return mSampleRate;
}
unsigned PSoundChannelLIBSNDIO::GetSampleSize() const
{
return mBitsPerSample;
}
BOOL PSoundChannelLIBSNDIO::SetBuffers(PINDEX size, PINDEX count)
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
PAssert(size > 0 && count > 0 && count < 65536, PInvalidParameter);
if (isInitialised) {
if (mFragSize != (unsigned)size || mFragCount != (unsigned)count) {
PTRACE(6, "LIBSNDIO\tTried to change buffers without stopping");
return FALSE;
}
return TRUE;
}
mFragSize = size;
mFragCount = count;
isInitialised = FALSE;
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::GetBuffers(PINDEX & size, PINDEX & count)
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
count = mFragCount;
size = mFragSize;
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::PlaySound(const PSound & sound, BOOL wait)
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
if (!Write((const BYTE *)sound, sound.GetSize()))
return FALSE;
if (wait)
return WaitForPlayCompletion();
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::PlayFile(const PFilePath & filename, BOOL wait)
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
PFile file(filename, PFile::ReadOnly);
if (!file.IsOpen())
return FALSE;
for (;;) {
BYTE buffer[256];
if (!file.Read(buffer, 256))
break;
PINDEX len = file.GetLastReadCount();
if (len == 0)
break;
if (!Write(buffer, len))
break;
}
file.Close();
if (wait)
return WaitForPlayCompletion();
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::HasPlayCompleted()
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::WaitForPlayCompletion()
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::RecordSound(PSound & sound)
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
return FALSE;
}
BOOL PSoundChannelLIBSNDIO::RecordFile(const PFilePath & filename)
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
return FALSE;
}
BOOL PSoundChannelLIBSNDIO::StartRecording()
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::IsRecordBufferFull()
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
struct pollfd pfd;
int events = POLLIN;
sio_pollfd(hdl, &pfd, events);
return ConvertOSError(::poll(&pfd, 1, 0));
}
BOOL PSoundChannelLIBSNDIO::AreAllRecordBuffersFull()
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
struct pollfd pfd;
int events = POLLIN;
sio_pollfd(hdl, &pfd, events);
return ConvertOSError(::poll(&pfd, 1, 0));
}
BOOL PSoundChannelLIBSNDIO::WaitForRecordBufferFull()
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
// return PXSetIOBlock(PXReadBlock, readTimeout);
struct pollfd pfd;
int events = POLLIN;
sio_pollfd(hdl, &pfd, events);
return ConvertOSError(::poll(&pfd, 1, 1000));
}
BOOL PSoundChannelLIBSNDIO::WaitForAllRecordBuffersFull()
{
if (!hdl)
return SetErrorValues(NotOpen, EBADF);
struct pollfd pfd;
int events = POLLIN;
sio_pollfd(hdl, &pfd, events);
return ConvertOSError(::poll(&pfd, 1, 1000));
}
BOOL PSoundChannelLIBSNDIO::Abort()
{
return TRUE;
}
BOOL PSoundChannelLIBSNDIO::SetVolume(unsigned newVal)
{
if (!hdl)
return FALSE;
return FALSE;
}
BOOL PSoundChannelLIBSNDIO::GetVolume(unsigned &devVol)
{
if (!hdl)
return FALSE;
devVol = 0;
return FALSE;
}
// End of file

View File

@ -0,0 +1,66 @@
#include <ptlib.h>
#include <ptlib/sound.h>
#include <ptlib/socket.h>
#include <sndio.h>
class PSoundChannelLIBSNDIO: public PSoundChannel
{
public:
PSoundChannelLIBSNDIO();
void Construct();
PSoundChannelLIBSNDIO(const PString &device,
PSoundChannel::Directions dir,
unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample);
~PSoundChannelLIBSNDIO();
static PStringArray GetDeviceNames(PSoundChannel::Directions = Player);
static PString GetDefaultDevice(PSoundChannel::Directions);
BOOL Open(const PString & _device,
Directions _dir,
unsigned _numChannels,
unsigned _sampleRate,
unsigned _bitsPerSample);
BOOL Setup();
BOOL Close();
BOOL IsOpen() const;
BOOL Write(const void * buf, PINDEX len);
BOOL Read(void * buf, PINDEX len);
BOOL SetFormat(unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample);
unsigned GetChannels() const;
unsigned GetSampleRate() const;
unsigned GetSampleSize() const;
BOOL SetBuffers(PINDEX size, PINDEX count);
BOOL GetBuffers(PINDEX & size, PINDEX & count);
BOOL PlaySound(const PSound & sound, BOOL wait);
BOOL PlayFile(const PFilePath & filename, BOOL wait);
BOOL HasPlayCompleted();
BOOL WaitForPlayCompletion();
BOOL RecordSound(PSound & sound);
BOOL RecordFile(const PFilePath & filename);
BOOL StartRecording();
BOOL IsRecordBufferFull();
BOOL AreAllRecordBuffersFull();
BOOL WaitForRecordBufferFull();
BOOL WaitForAllRecordBuffersFull();
BOOL Abort();
BOOL SetVolume(unsigned newVal);
BOOL GetVolume(unsigned &devVol);
protected:
struct sio_hdl *hdl;
struct sio_par par;
unsigned mNumChannels;
unsigned mSampleRate;
unsigned mBitsPerSample;
unsigned mFragCount;
unsigned mFragSize;
unsigned mBytesPerFrame;
Directions mDirection;
PString mDevice;
BOOL isInitialised;
};

View File

@ -1,7 +1,15 @@
$OpenBSD: patch-configure,v 1.4 2008/06/17 13:54:09 ajacoutot Exp $
--- configure.orig Fri Oct 19 08:22:39 2007
+++ configure Tue Jun 17 15:52:24 2008
@@ -2163,7 +2163,7 @@ case "$target_cpu" in
$OpenBSD: patch-configure,v 1.5 2009/01/17 12:30:08 jakemsr Exp $
--- configure.orig Thu Oct 18 23:22:39 2007
+++ configure Sat Jan 17 04:00:57 2009
@@ -2102,7 +2102,6 @@ case "$target_os" in
openbsd* ) OSTYPE=OpenBSD ;
OS_TAG="P_OPENBSD" ;
OSRELEASE="`sysctl -n kern.osrevision`" ;
- ENDLDLIBS="-lossaudio" ;
need_pragma=yes ;
;;
@@ -2163,7 +2162,7 @@ case "$target_cpu" in
x86 | i686 | i586 | i486 | i386 ) MACHTYPE=x86
;;
@ -10,7 +18,7 @@ $OpenBSD: patch-configure,v 1.4 2008/06/17 13:54:09 ajacoutot Exp $
P_64BIT=1 ;
LIB64=1 ;
;;
@@ -2175,6 +2175,11 @@ case "$target_cpu" in
@@ -2175,6 +2174,11 @@ case "$target_cpu" in
sparc ) MACHTYPE=sparc ;
;;
@ -22,7 +30,7 @@ $OpenBSD: patch-configure,v 1.4 2008/06/17 13:54:09 ajacoutot Exp $
powerpc ) MACHTYPE=ppc ;
;;
@@ -4683,13 +4688,13 @@ fi
@@ -4683,13 +4687,13 @@ fi
@ -39,7 +47,7 @@ $OpenBSD: patch-configure,v 1.4 2008/06/17 13:54:09 ajacoutot Exp $
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -4754,8 +4759,12 @@ else
@@ -4754,8 +4758,12 @@ else
fi
if test ${HAS_PTHREADS} = yes ; then
@ -54,7 +62,7 @@ $OpenBSD: patch-configure,v 1.4 2008/06/17 13:54:09 ajacoutot Exp $
else
if test ${OSTYPE} = FreeBSD ; then
HAS_PTHREADS=yes
@@ -4837,13 +4846,13 @@ _ACEOF
@@ -4837,13 +4845,13 @@ _ACEOF
echo "${ECHO_T}no" >&6
fi
@ -71,7 +79,7 @@ $OpenBSD: patch-configure,v 1.4 2008/06/17 13:54:09 ajacoutot Exp $
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -5691,22 +5700,12 @@ fi
@@ -5691,22 +5699,12 @@ fi
@ -94,7 +102,7 @@ $OpenBSD: patch-configure,v 1.4 2008/06/17 13:54:09 ajacoutot Exp $
# Check whether --enable-resolver or --disable-resolver was given.
if test "${enable_resolver+set}" = set; then
enableval="$enable_resolver"
@@ -8189,7 +8188,7 @@ if test "${ac_cv_lib_SDL_SDL_CreateYUVOverlay+set}" =
@@ -8189,7 +8187,7 @@ if test "${ac_cv_lib_SDL_SDL_CreateYUVOverlay+set}" =
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-make_ptlib-config_in,v 1.1.1.1 2007/04/25 11:12:27 ajacoutot Exp $
--- make/ptlib-config.in.orig Sun Sep 18 13:05:36 2005
+++ make/ptlib-config.in Wed Apr 11 18:13:29 2007
$OpenBSD: patch-make_ptlib-config_in,v 1.2 2009/01/17 12:30:08 jakemsr Exp $
--- make/ptlib-config.in.orig Thu Oct 18 23:22:33 2007
+++ make/ptlib-config.in Sat Jan 17 03:54:23 2009
@@ -5,10 +5,10 @@
#
@ -10,7 +10,7 @@ $OpenBSD: patch-make_ptlib-config_in,v 1.1.1.1 2007/04/25 11:12:27 ajacoutot Exp
LDFLAGS="@LDFLAGS@"
LIBS="@ENDLDLIBS@ -lpt"
-LIBDIR="@LIBDIR@"
+LIBDIR="!!PREFIX!!/lib"
+LIBDIR="/usr/local/lib"
PWINSTDIR="@INSTALLPREFIX@/share/pwlib"
MACHTYPE="@MACHTYPE@"
OSTYPE="@OSTYPE@"

View File

@ -1,16 +1,16 @@
$OpenBSD: patch-make_unix_mak,v 1.3 2008/09/08 17:17:10 ajacoutot Exp $
--- make/unix.mak.orig Fri Oct 19 08:22:33 2007
+++ make/unix.mak Mon Sep 8 18:05:20 2008
$OpenBSD: patch-make_unix_mak,v 1.4 2009/01/17 12:30:08 jakemsr Exp $
--- make/unix.mak.orig Thu Oct 18 23:22:33 2007
+++ make/unix.mak Sat Jan 17 03:54:23 2009
@@ -454,7 +454,7 @@ endif # P_SHAREDLIB
STATIC_LIBS := libstdc++.a libg++.a libm.a libc.a
-SYSLIBDIR := $(shell $(PWLIBDIR)/make/ptlib-config --libdir)
+SYSLIBDIR := $(shell !!PREFIX!!/bin/ptlib-config --libdir)
+SYSLIBDIR := $(shell /usr/local/bin/ptlib-config --libdir)
endif # linux
@@ -481,7 +481,7 @@ endif # FreeBSD
@@ -481,14 +481,13 @@ endif # FreeBSD
ifeq ($(OSTYPE),OpenBSD)
ifeq ($(MACHTYPE),x86)
@ -18,8 +18,8 @@ $OpenBSD: patch-make_unix_mak,v 1.3 2008/09/08 17:17:10 ajacoutot Exp $
+#STDCCFLAGS += -m486
endif
LDLIBS += -lossaudio
@@ -489,6 +489,7 @@ LDLIBS += -lossaudio
-LDLIBS += -lossaudio
-
P_USE_RANLIB := 1
#STDCCFLAGS += -DP_USE_PRAGMA # migrated to configure
@ -27,7 +27,7 @@ $OpenBSD: patch-make_unix_mak,v 1.3 2008/09/08 17:17:10 ajacoutot Exp $
endif # OpenBSD
@@ -503,7 +504,7 @@ endif
@@ -503,7 +502,7 @@ endif
LDLIBS += -lossaudio
@ -36,7 +36,7 @@ $OpenBSD: patch-make_unix_mak,v 1.3 2008/09/08 17:17:10 ajacoutot Exp $
# enable the USE_PTH line to compile using pth
# enable the USE_NATIVE_THREADS line to compile using native threads
@@ -908,11 +909,11 @@ LIB_SUFFIX = $(SHAREDLIBEXT)
@@ -908,11 +907,11 @@ LIB_SUFFIX = $(SHAREDLIBEXT)
LIB_TYPE =
else
LIB_SUFFIX = a
@ -50,7 +50,7 @@ $OpenBSD: patch-make_unix_mak,v 1.3 2008/09/08 17:17:10 ajacoutot Exp $
endif
ifndef INSTALLBIN_DIR
@@ -950,8 +951,10 @@ endif
@@ -950,8 +949,10 @@ endif
PW_LIBDIR = $(PWLIBDIR)/lib
# set name of the PT library
@ -62,7 +62,7 @@ $OpenBSD: patch-make_unix_mak,v 1.3 2008/09/08 17:17:10 ajacoutot Exp $
PT_OBJBASE = obj_$(PLATFORM_TYPE)_$(OBJDIR_SUFFIX)
PT_OBJDIR = $(PW_LIBDIR)/$(PT_OBJBASE)
@@ -983,7 +986,7 @@ ifneq ($(OSTYPE),Darwin)
@@ -983,7 +984,7 @@ ifneq ($(OSTYPE),Darwin)
ifeq ($(OSTYPE),solaris)
OPTCCFLAGS += -O3
else

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-plugins_Makefile_in,v 1.1 2009/01/17 12:30:08 jakemsr Exp $
--- plugins/Makefile.in.orig Sat Oct 18 23:00:39 2008
+++ plugins/Makefile.in Sat Oct 18 23:02:10 2008
@@ -31,6 +31,15 @@ DEFAULT_SOUND = sound_esd
endif
endif
+HAS_LIBSNDIO = @HAS_LIBSNDIO@
+
+ifeq (1,$(HAS_LIBSNDIO))
+SUBDIRS += sound_libsndio
+ifeq (,$(DEFAULT_SOUND))
+DEFAULT_SOUND = sound_libsndio
+endif
+endif
+
HAS_SUNAUDIO = @HAS_SUNAUDIO@
ifeq (1,$(HAS_SUNAUDIO))

View File

@ -1,7 +1,27 @@
$OpenBSD: patch-plugins_configure,v 1.3 2008/04/29 11:42:45 ajacoutot Exp $
--- plugins/configure.orig Fri Oct 19 08:22:33 2007
+++ plugins/configure Tue Apr 29 09:49:24 2008
@@ -3479,7 +3479,7 @@ echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6
$OpenBSD: patch-plugins_configure,v 1.4 2009/01/17 12:30:08 jakemsr Exp $
--- plugins/configure.orig Thu Oct 18 23:22:33 2007
+++ plugins/configure Sat Oct 18 23:11:09 2008
@@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT PWLIBDIR PWINSTDIR INSTALLPREFIX LIBDIR CC CFLAGS ac_ct_CC CPP EGREP HAS_ALSA HAS_ESD HAS_OSS HAS_SUNAUDIO HAS_V4L HAS_V4L2 HAS_BSDVIDEOCAP HAS_AVC1394 HAS_DC1394 DC_CFLAGS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT PWLIBDIR PWINSTDIR INSTALLPREFIX LIBDIR CC CFLAGS ac_ct_CC CPP EGREP HAS_ALSA HAS_ESD HAS_LIBSNDIO HAS_OSS HAS_SUNAUDIO HAS_V4L HAS_V4L2 HAS_BSDVIDEOCAP HAS_AVC1394 HAS_DC1394 DC_CFLAGS LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -3459,6 +3459,10 @@ echo "${ECHO_T}no" >&6
fi
+# for now ...
+HAS_LIBSNDIO=1
+
+
# Check whether --enable-oss or --disable-oss was given.
if test "${enable_oss+set}" = set; then
enableval="$enable_oss"
@@ -3479,7 +3483,7 @@ echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking sys/soundcard.h usability" >&5
@ -10,7 +30,7 @@ $OpenBSD: patch-plugins_configure,v 1.3 2008/04/29 11:42:45 ajacoutot Exp $
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -3487,7 +3487,7 @@ cat confdefs.h >>conftest.$ac_ext
@@ -3487,7 +3491,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
@ -19,7 +39,7 @@ $OpenBSD: patch-plugins_configure,v 1.3 2008/04/29 11:42:45 ajacoutot Exp $
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -3523,18 +3523,18 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
@@ -3523,18 +3527,18 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
@ -43,7 +63,7 @@ $OpenBSD: patch-plugins_configure,v 1.3 2008/04/29 11:42:45 ajacoutot Exp $
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -3595,7 +3595,7 @@ _ASBOX
@@ -3595,7 +3599,7 @@ _ASBOX
;;
esac
echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
@ -52,7 +72,7 @@ $OpenBSD: patch-plugins_configure,v 1.3 2008/04/29 11:42:45 ajacoutot Exp $
if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3979,7 +3979,7 @@ if test "${enable_v4l2}z" = "yesz" ; then
@@ -3979,7 +3983,7 @@ if test "${enable_v4l2}z" = "yesz" ; then
if test "${OSTYPE}z" = "solaris2.11z"; then
VIDEODEV="sys/videodev2.h"
else
@ -61,7 +81,7 @@ $OpenBSD: patch-plugins_configure,v 1.3 2008/04/29 11:42:45 ajacoutot Exp $
fi
as_ac_Header=`echo "ac_cv_header_$VIDEODEV" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $VIDEODEV" >&5
@@ -4485,8 +4485,8 @@ cat >>conftest.$ac_ext <<_ACEOF
@@ -4485,8 +4489,8 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <dev/ic/bt8xx.h>
_ACEOF
@ -72,3 +92,11 @@ $OpenBSD: patch-plugins_configure,v 1.3 2008/04/29 11:42:45 ajacoutot Exp $
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -6059,6 +6063,7 @@ s,@CPP@,$CPP,;t t
s,@EGREP@,$EGREP,;t t
s,@HAS_ALSA@,$HAS_ALSA,;t t
s,@HAS_ESD@,$HAS_ESD,;t t
+s,@HAS_LIBSNDIO@,$HAS_LIBSNDIO,;t t
s,@HAS_OSS@,$HAS_OSS,;t t
s,@HAS_SUNAUDIO@,$HAS_SUNAUDIO,;t t
s,@HAS_V4L@,$HAS_V4L,;t t

View File

@ -1,76 +0,0 @@
$OpenBSD: patch-plugins_sound_oss_sound_oss_cxx,v 1.5 2008/08/20 01:57:31 jakemsr Exp $
--- plugins/sound_oss/sound_oss.cxx.orig Thu Oct 18 23:22:33 2007
+++ plugins/sound_oss/sound_oss.cxx Sat Aug 9 17:44:37 2008
@@ -384,7 +384,7 @@ static void CollectSoundDevices(PDirectory devdir, POr
// When adding these to the 'dsp' string array, only the first one
// found is used.
-#if !defined P_NETBSD || !defined P_OPENBSD
+#if !defined P_NETBSD && !defined P_OPENBSD
// Look for dsp
if (filename == "dsp") {
dsp.SetAt(0, devname);
@@ -519,6 +519,7 @@ BOOL PSoundChannelOSS::Open(const PString & _device,
Close();
+ resampleRate = 0;
// lock the dictionary
PWaitAndSignal mutex(dictMutex);
@@ -554,6 +555,14 @@ BOOL PSoundChannelOSS::Open(const PString & _device,
DWORD cmd = 0;
::ioctl(os_handle, FIONBIO, &cmd);
+#ifdef P_OPENBSD
+ // full-duplex must be set explicitly. don't worry if it fails because
+ // we might not really want full-duplex, even though we always open the
+ // device read-write.
+ cmd = 1;
+ ::ioctl(os_handle, SNDCTL_DSP_SETDUPLEX, &cmd);
+#endif
+
// add the device to the dictionary
SoundHandleEntry * entry = PNEW SoundHandleEntry;
handleDict().SetAt(_device, entry);
@@ -645,7 +654,9 @@ BOOL PSoundChannelOSS::Setup()
mSampleRate = entry.sampleRate;
arg = val = entry.sampleRate;
- if (ConvertOSError(::ioctl(os_handle, SNDCTL_DSP_SPEED, &arg))) {
+ // don't error out if this gives us an error, simply resample
+ // based on the returned rate.
+ ConvertOSError(::ioctl(os_handle, SNDCTL_DSP_SPEED, &arg));
stat = TRUE;
// detect cases where the hardware can't do the actual rate we need, but can do a simple multiple
@@ -658,7 +669,6 @@ BOOL PSoundChannelOSS::Setup()
actualSampleRate = arg;
}
}
- }
}
}
@@ -819,6 +829,7 @@ BOOL PSoundChannelOSS::Read(void * buf, PINDEX len)
// use an average, not just a single sample
const BYTE * src = resampleBuffer;
while ( ((src - resampleBuffer) < bytes) && (dst < dstEnd)) {
+#if 0
int sample = 0;
unsigned j;
for (j = 0; j < resampleRate; ++j) {
@@ -828,6 +839,13 @@ BOOL PSoundChannelOSS::Read(void * buf, PINDEX len)
*(PUInt16l *)dst = sample / resampleRate;
dst +=2 ;
lastReadCount += 2;
+#else
+ // don't average, just use 1/resampleRate bytes
+ *(PUInt16l *)dst = *(PUInt16l *)src;
+ src += 2 * resampleRate;
+ dst +=2 ;
+ lastReadCount += 2;
+#endif
}
}
}

View File

@ -1,12 +1,12 @@
$OpenBSD: patch-src_ptlib_common_pluginmgr_cxx,v 1.2 2008/03/15 17:38:07 ajacoutot Exp $
--- src/ptlib/common/pluginmgr.cxx.orig Fri Oct 19 08:22:32 2007
+++ src/ptlib/common/pluginmgr.cxx Fri Jan 4 14:04:45 2008
$OpenBSD: patch-src_ptlib_common_pluginmgr_cxx,v 1.3 2009/01/17 12:30:08 jakemsr Exp $
--- src/ptlib/common/pluginmgr.cxx.orig Thu Oct 18 23:22:32 2007
+++ src/ptlib/common/pluginmgr.cxx Sat Jan 17 03:54:23 2009
@@ -168,7 +168,7 @@
# ifdef _WIN32
# define P_DEFAULT_PLUGIN_DIR ".;C:\\PWLIB_PLUGINS"
# else
-# define P_DEFAULT_PLUGIN_DIR ".:/usr/lib/pwlib"
+# define P_DEFAULT_PLUGIN_DIR ".:!!PREFIX!!/lib/pwlib"
+# define P_DEFAULT_PLUGIN_DIR ".:/usr/local/lib/pwlib"
# endif
#endif

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-src_ptlib_unix_ossaix_cxx,v 1.1.1.1 2007/04/25 11:12:27 ajacoutot Exp $
--- src/ptlib/unix/ossaix.cxx.orig Mon Apr 16 20:37:38 2007
+++ src/ptlib/unix/ossaix.cxx Mon Apr 16 20:38:01 2007
@@ -281,7 +281,7 @@ PStringArray PSoundChannel::GetDeviceNames(Directions
PString PSoundChannel::GetDefaultDevice(Directions /*dir*/)
{
- return "/dev/dsp";
+ return "/dev/audio";
}

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.5 2008/05/22 19:25:32 ajacoutot Exp $
@comment $OpenBSD: PLIST,v 1.6 2009/01/17 12:30:08 jakemsr Exp $
@pkgpath ${BASE_PKGPATH},ldap
@pkgpath ${BASE_PKGPATH},ldap,sasl
@pkgpath ${BASE_PKGPATH},ldap,sasl,sdl
@ -174,8 +174,7 @@ include/ptlib/videoio1394dc.h
lib/pwlib/
lib/pwlib/devices/
lib/pwlib/devices/sound/
lib/pwlib/devices/sound/esd_pwplugin.so
lib/pwlib/devices/sound/oss_pwplugin.so
lib/pwlib/devices/sound/libsndio_pwplugin.so
lib/pwlib/devices/videoinput/
lib/pwlib/devices/videoinput/bsdvideo_pwplugin.so
lib/pwlib/devices/videoinput/v4l2_pwplugin.so