ported to OpenBSD (real-time scheduling not yet supported)

This commit is contained in:
darkeye 2004-02-18 21:08:11 +00:00
parent d7dce002fe
commit 0fbff7195e
6 changed files with 40 additions and 24 deletions

View File

@ -1,3 +1,7 @@
DarkIce next release
o ported to OpenBSD, though real-time scheduling not yet supported
15-02-2004: DarkIce 0.14 released 15-02-2004: DarkIce 0.14 released
o added ALSA support, thanks to Christian Forster o added ALSA support, thanks to Christian Forster

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/DarkIce.cpp) AC_INIT(src/DarkIce.cpp)
AM_INIT_AUTOMAKE(darkice, 0.14) AM_INIT_AUTOMAKE(darkice, 0.15beta)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
@ -12,7 +12,7 @@ AC_HAVE_HEADERS(errno.h fcntl.h stdio.h stdlib.h string.h unistd.h limits.h)
AC_HAVE_HEADERS(signal.h time.h sys/time.h sys/types.h sys/wait.h math.h) AC_HAVE_HEADERS(signal.h time.h sys/time.h sys/types.h sys/wait.h math.h)
AC_HAVE_HEADERS(netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/stat.h) AC_HAVE_HEADERS(netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/stat.h)
AC_HAVE_HEADERS(sched.h pthread.h) AC_HAVE_HEADERS(sched.h pthread.h)
AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h) AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h sys/audioio.h)
AC_HEADER_SYS_WAIT() AC_HEADER_SYS_WAIT()
AC_TYPE_PID_T() AC_TYPE_PID_T()

View File

@ -58,8 +58,8 @@
#define SUPPORT_OSS_DSP #define SUPPORT_OSS_DSP
#endif #endif
#if defined( HAVE_SYS_AUDIO_H ) #if defined( HAVE_SYS_AUDIO_H ) || defined( HAVE_SYS_AUDIOIO_H )
// we have a Solaris DSP sound device available // we have a Solaris DSP sound device available (same for OpenBSD)
#define SUPPORT_SOLARIS_DSP #define SUPPORT_SOLARIS_DSP
#endif #endif
@ -288,6 +288,9 @@ class AudioSource : public Source, public virtual Reporter
$Source$ $Source$
$Log$ $Log$
Revision 1.7 2004/02/18 21:08:11 darkeye
ported to OpenBSD (real-time scheduling not yet supported)
Revision 1.6 2004/02/15 12:06:29 darkeye Revision 1.6 2004/02/15 12:06:29 darkeye
added ALSA support, thanks to Christian Forster added ALSA support, thanks to Christian Forster

View File

@ -873,6 +873,10 @@ DarkIce :: configFileCast ( const Config & config )
void void
DarkIce :: setRealTimeScheduling ( void ) throw ( Exception ) DarkIce :: setRealTimeScheduling ( void ) throw ( Exception )
{ {
// don't include the following on OpenBSD, as the scheduling functions are
// not implemented.
// FIXME: using HAVE_SYS_AUDIOIO_H as a sign of being on OpenBSD is buggy
#if !defined( HAVE_SYS_AUDIOIO_H )
uid_t euid; uid_t euid;
euid = geteuid(); euid = geteuid();
@ -917,6 +921,7 @@ DarkIce :: setRealTimeScheduling ( void ) throw ( Exception )
reportEvent( 1, reportEvent( 1,
"It is recommended that you run this program as super-user"); "It is recommended that you run this program as super-user");
} }
#endif
} }
@ -928,6 +933,10 @@ DarkIce :: setRealTimeScheduling ( void ) throw ( Exception )
void void
DarkIce :: setOriginalScheduling ( void ) throw ( Exception ) DarkIce :: setOriginalScheduling ( void ) throw ( Exception )
{ {
// don't include the following on OpenBSD, as the scheduling functions are
// not implemented.
// FIXME: using HAVE_SYS_AUDIOIO_H as a sign of being on OpenBSD is buggy
#if !defined( HAVE_SYS_AUDIOIO_H )
uid_t euid; uid_t euid;
euid = geteuid(); euid = geteuid();
@ -947,6 +956,7 @@ DarkIce :: setOriginalScheduling ( void ) throw ( Exception )
reportEvent( 5, "reverted to original scheduling"); reportEvent( 5, "reverted to original scheduling");
} }
#endif
} }
@ -999,6 +1009,9 @@ DarkIce :: run ( void ) throw ( Exception )
$Source$ $Source$
$Log$ $Log$
Revision 1.38 2004/02/18 21:08:11 darkeye
ported to OpenBSD (real-time scheduling not yet supported)
Revision 1.37 2004/02/15 12:14:38 darkeye Revision 1.37 2004/02/15 12:14:38 darkeye
added patch to allow mp3 stream downsampling to mono for icecast2 as well added patch to allow mp3 stream downsampling to mono for icecast2 as well

View File

@ -80,10 +80,12 @@
#error need sys/ioctl.h #error need sys/ioctl.h
#endif #endif
#ifdef HAVE_SYS_AUDIO_H #if defined( HAVE_SYS_AUDIO_H )
#include <sys/audio.h> #include <sys/audio.h>
#elif defined( HAVE_SYS_AUDIOIO_H )
#include <sys/audioio.h>
#else #else
#error need sys/audio.h #error need sys/audio.h or sys/audioio.h
#endif #endif
@ -116,7 +118,6 @@ SolarisDspSource :: init ( const char * name ) throw ( Exception )
{ {
fileName = Util::strDup( name); fileName = Util::strDup( name);
fileDescriptor = 0; fileDescriptor = 0;
running = false;
} }
@ -157,6 +158,9 @@ SolarisDspSource :: open ( void ) throw ( Exception )
audioInfo.record.channels = getChannel(); audioInfo.record.channels = getChannel();
audioInfo.record.precision = getBitsPerSample(); audioInfo.record.precision = getBitsPerSample();
audioInfo.record.encoding = AUDIO_ENCODING_LINEAR; audioInfo.record.encoding = AUDIO_ENCODING_LINEAR;
// for stupid OpenBSD we need to add the following, as it masks
// read/write calls when using -pthread
audioInfo.record.pause = 0;
if ( ioctl( fileDescriptor, AUDIO_SETINFO, &audioInfo) == -1 ) { if ( ioctl( fileDescriptor, AUDIO_SETINFO, &audioInfo) == -1 ) {
@ -185,6 +189,7 @@ SolarisDspSource :: open ( void ) throw ( Exception )
"drift in the sound card driver"); "drift in the sound card driver");
} }
return true; return true;
} }
@ -204,13 +209,6 @@ SolarisDspSource :: canRead ( unsigned int sec,
return false; return false;
} }
if ( !running ) {
/* ugly workaround to get the dsp into recording state */
unsigned char b[getChannel()*getBitsPerSample()/8];
read( b, getChannel()*getBitsPerSample()/8);
}
FD_ZERO( &fdset); FD_ZERO( &fdset);
FD_SET( fileDescriptor, &fdset); FD_SET( fileDescriptor, &fdset);
tv.tv_sec = sec; tv.tv_sec = sec;
@ -245,7 +243,6 @@ SolarisDspSource :: read ( void * buf,
throw Exception( __FILE__, __LINE__, "read error"); throw Exception( __FILE__, __LINE__, "read error");
} }
running = true;
return ret; return ret;
} }
@ -262,7 +259,6 @@ SolarisDspSource :: close ( void ) throw ( Exception )
::close( fileDescriptor); ::close( fileDescriptor);
fileDescriptor = 0; fileDescriptor = 0;
running = false;
} }
#endif // SUPPORT_SOLARIS_DSP #endif // SUPPORT_SOLARIS_DSP
@ -273,6 +269,9 @@ SolarisDspSource :: close ( void ) throw ( Exception )
$Source$ $Source$
$Log$ $Log$
Revision 1.2 2004/02/18 21:08:11 darkeye
ported to OpenBSD (real-time scheduling not yet supported)
Revision 1.1 2001/09/11 15:05:21 darkeye Revision 1.1 2001/09/11 15:05:21 darkeye
added Solaris support added Solaris support

View File

@ -68,12 +68,6 @@ class SolarisDspSource : public AudioSource, public virtual Reporter
*/ */
int fileDescriptor; int fileDescriptor;
/**
* Indicates wether the low-level Solaris DSP device is in a recording
* state.
*/
bool running;
protected: protected:
@ -263,6 +257,9 @@ class SolarisDspSource : public AudioSource, public virtual Reporter
$Source$ $Source$
$Log$ $Log$
Revision 1.3 2004/02/18 21:08:11 darkeye
ported to OpenBSD (real-time scheduling not yet supported)
Revision 1.2 2001/09/18 14:57:19 darkeye Revision 1.2 2001/09/18 14:57:19 darkeye
finalized Solaris port finalized Solaris port