From d6295f75fd514de487b82f06653f83fe61277b99 Mon Sep 17 00:00:00 2001 From: Roger Hardiman Date: Sun, 2 Feb 2003 21:27:00 +0000 Subject: Add fix for -current /dev/dsp entries. Reported by Lars Eggert --- net/opal3/Makefile | 1 + net/opal3/files/patch-oss | 154 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 net/opal3/files/patch-oss (limited to 'net/opal3') diff --git a/net/opal3/Makefile b/net/opal3/Makefile index fc1a7698a483..8c9fadef122a 100644 --- a/net/opal3/Makefile +++ b/net/opal3/Makefile @@ -7,6 +7,7 @@ PORTNAME= openh323 PORTVERSION= 1.11.2 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= http://www.openh323.org/bin/ \ http://www.de.openh323.org/bin/ \ diff --git a/net/opal3/files/patch-oss b/net/opal3/files/patch-oss new file mode 100644 index 000000000000..1f8720bf55c6 --- /dev/null +++ b/net/opal3/files/patch-oss @@ -0,0 +1,154 @@ +*** ../pwlib/src/ptlib/unix/oss.cxx.orig Thu Dec 12 09:03:56 2002 +--- ../pwlib/src/ptlib/unix/oss.cxx Sun Feb 2 19:22:40 2003 +*************** +*** 27,32 **** +--- 27,45 ---- + * Contributor(s): Loopback feature: Philip Edelbrock . + * + * $Log: oss.cxx,v $ ++ * Revision 1.58 2003/02/02 18:54:22 rogerh ++ * FreeBSD changes for support of dspN.M (eg dsp0.0) sound card entries. ++ * Problem reported by Lars Eggert ++ * ++ * Revision 1.57 2003/01/06 19:25:07 rogerh ++ * Add NetBSD video support. ++ * Add correct includes for OSS ioctls (note the proper way to do this now ++ * is via pwlib commands) ++ * From Andreas Wrede, taken in part from NetBSD's package system ++ * ++ * Revision 1.56 2003/01/06 19:10:22 rogerh ++ * NetBSD uses /dev/audio and not /dev/dsp ++ * + * Revision 1.55 2002/12/12 09:03:56 rogerh + * On two FreeBSD machines, Read() calls from the sound card were not blocking + * correctly and returned with less bytes than asked for. This made OpenH323 +*************** +*** 223,229 **** + + #ifdef P_LINUX + #include +- #include + #endif + + #ifdef P_FREEBSD +--- 236,241 ---- +*************** PSoundChannel::~PSoundChannel() +*** 456,468 **** + } + + static BOOL IsNumericString(PString numbers) { +! // return true if 'numbers' contains only digits 0 to 9 + for (PINDEX p = 0; p < numbers.GetLength(); p++) { +! if (!isdigit(numbers[p])) { +! return FALSE; + } + } +! return TRUE; + } + + static void CollectSoundDevices(PDirectory devdir, POrdinalToString & dsp, POrdinalToString & mixer, BOOL collect_with_names) +--- 468,485 ---- + } + + static BOOL IsNumericString(PString numbers) { +! // return true if 'numbers' contains only digits (0 to 9) +! // or if it contains digits followed by a '.' +! +! BOOL isNumber = FALSE; + for (PINDEX p = 0; p < numbers.GetLength(); p++) { +! if (isdigit(numbers[p])) { +! isNumber = TRUE; +! } else { +! return isNumber; + } + } +! return isNumber; + } + + static void CollectSoundDevices(PDirectory devdir, POrdinalToString & dsp, POrdinalToString & mixer, BOOL collect_with_names) +*************** static void CollectSoundDevices(PDirecto +*** 499,520 **** + // On Linux devfs systems, the major numbers can change dynamically. + // On FreeBSD and other OSs, the major numbes are different to Linux. + // So collect devices by looking for dsp(N) and mixer(N). +! // Notes. FreeBSD supports audio stream mixing. For /dev/dsp0 +! // there are also entries for /dev/dsp0.0 dsp0.1 dsp0.2 and dsp0.3 +! // We will ignore these N.M devices. + + // Look for dsp + if (filename == "dsp") { + dsp.SetAt(0, devname); + } +! // Look for dspN. Insert at position cardnum + 1 + if ((filename.GetLength() > 3) && (filename.Left(3) == "dsp")) { + PString numbers = filename.Mid(3); // get everything after 'dsp' + if (IsNumericString(numbers)) { + PINDEX cardnum = numbers.AsInteger(); + dsp.SetAt(cardnum+1, devname); + } + } + // Look for mixer + if (filename == "mixer") { + mixer.SetAt(0, devname); +--- 516,562 ---- + // On Linux devfs systems, the major numbers can change dynamically. + // On FreeBSD and other OSs, the major numbes are different to Linux. + // So collect devices by looking for dsp(N) and mixer(N). +! // (or /dev/audio(N) and mixer(N) on NetBSD +! // Notes. FreeBSD supports audio stream mixing. A single sound card +! // may have multiple /dev entries in the form /dev/dspN.M +! // eg /dev/dsp0.0 /dev/dsp0.1 /dev/dsp0.2 and /dev/dsp0.3 +! // When adding these to the 'dsp' string array, only the first one +! // found is used. + ++ #ifndef P_NETBSD + // Look for dsp + if (filename == "dsp") { + dsp.SetAt(0, devname); + } +! +! // Look for dspN entries. Insert at position N + 1 +! // and look for dspN.M entries. Insert at position N + 1 (ignoring M) +! + if ((filename.GetLength() > 3) && (filename.Left(3) == "dsp")) { ++ + PString numbers = filename.Mid(3); // get everything after 'dsp' + if (IsNumericString(numbers)) { ++ PINDEX cardnum = numbers.AsInteger(); //dspN.M is truncated to dspN. ++ // If we have not yet inserted something for this cardnum, insert it ++ if (dsp.GetAt(cardnum+1) == NULL) { ++ dsp.SetAt(cardnum+1, devname); ++ } ++ } ++ } ++ #else ++ // Look for audio on NetBSD ++ if (filename == "audio") { ++ dsp.SetAt(0, devname); ++ } ++ // Look for audioN. Insert at position cardnum + 1 ++ if ((filename.GetLength() > 5) && (filename.Left(5) == "audio")) { ++ PString numbers = filename.Mid(5); // get everything after 'audio' ++ if (IsNumericString(numbers)) { + PINDEX cardnum = numbers.AsInteger(); + dsp.SetAt(cardnum+1, devname); + } + } ++ #endif + // Look for mixer + if (filename == "mixer") { + mixer.SetAt(0, devname); +*************** PString PSoundChannel::GetDefaultDevice( +*** 604,611 **** +--- 646,656 ---- + { + // Normally /dev/dsp points to the default sound device. If this is not + // present, probe /dev for sound devices and return the first detected device. ++ + if (PFile::Exists("/dev/dsp")) { + return "/dev/dsp"; ++ } else if (PFile::Exists("/dev/audio")) { // the NetBSD default name ++ return "/dev/audio"; + } else { + // return the first dsp device detected + PStringArray devicenames; -- cgit v1.2.3