created configure options to compile with or without lame / Ogg Vorbis

This commit is contained in:
darkeye 2001-10-19 12:39:42 +00:00
parent 35e0d6884b
commit 50684028b7
11 changed files with 179 additions and 41 deletions

View File

@ -4,6 +4,8 @@ DarkIce 0.7
thanks to Robin P. Blanchard, <Robin_Blanchard@gactr.uga.edu> thanks to Robin P. Blanchard, <Robin_Blanchard@gactr.uga.edu>
o added support for resampling mp3 streams o added support for resampling mp3 streams
o DarkIce config file now may contain spaces and tabs as white space o DarkIce config file now may contain spaces and tabs as white space
o configure script enables build with or without lame / Ogg Vorbis
also possibility to specify alternate locations for these
18-09-2001: DarkIce 0.6 released 18-09-2001: DarkIce 0.6 released

View File

@ -1,9 +1,12 @@
DarkIce installation notes DarkIce installation notes
========================== ==========================
DarkIce requires the following libraries (and associated header files): DarkIce uses the following libraries (and associated header files):
for capability to stream mp3 to IceCast 1.x and Shoutcast:
- libmp3lame - libmp3lame
for capability to stream Ogg Vorbis to IceCast 2:
- libogg - libogg
- libvoribs - libvoribs
- libvorbisenc - libvorbisenc

View File

@ -7,5 +7,3 @@ o libtoolize ?
o revisit real-time scheduling and one-thread-per-connection o revisit real-time scheduling and one-thread-per-connection
o look into performance o look into performance
o create proper error-reporting module o create proper error-reporting module
o configure options to enable / disable lame / ogg support and to
specify their location

View File

@ -5,12 +5,13 @@ dnl
dnl DO NOT change aclocal.m4 ! dnl DO NOT change aclocal.m4 !
dnl dnl
dnl * LA_SEARCH_FILE(variable, filename, PATH) dnl-----------------------------------------------------------------------------
dnl * Search "filename" in the specified "PATH", "variable" will dnl LA_SEARCH_FILE(variable, filename, PATH)
dnl * contain the full pathname or the empty string dnl Search "filename" in the specified "PATH", "variable" will
dnl * PATH is space-separated list of directories. dnl contain the full pathname or the empty string
dnl * by Florian Bomers dnl PATH is space-separated list of directories.
dnl by Florian Bomers
dnl-----------------------------------------------------------------------------
AC_DEFUN(LA_SEARCH_FILE,[ AC_DEFUN(LA_SEARCH_FILE,[
$1= $1=
dnl hack: eliminate line feeds in $2 dnl hack: eliminate line feeds in $2
@ -24,21 +25,22 @@ AC_DEFUN(LA_SEARCH_FILE,[
done done
]) ])
dnl * LA_SEARCH_LIB(lib-variable, include-variable, lib-filename, header-filename, prefix) dnl-----------------------------------------------------------------------------
dnl * looks for "lib-filename" and "header-filename" in the area of "prefix". dnl LA_SEARCH_LIB(lib-variable, include-variable, lib-filename, header-filename, prefix)
dnl * if found, "lib-variable" and "include-variable" are set to the dnl looks for "lib-filename" and "header-filename" in the area of "prefix".
dnl * respective paths. dnl if found, "lib-variable" and "include-variable" are set to the
dnl * prefix is a single path dnl respective paths.
dnl * libs are searched in prefix, prefix/lib dnl prefix is a single path
dnl * headers are searched in prefix, prefix/include, dnl libs are searched in prefix, prefix/lib
dnl * dnl headers are searched in prefix, prefix/include,
dnl * If one of them is not found, both "lib-variable", "include-variable" are dnl
dnl * set to the empty string. dnl If one of them is not found, both "lib-variable", "include-variable" are
dnl * dnl set to the empty string.
dnl * TODO: assert function call to verify lib dnl
dnl * dnl TODO: assert function call to verify lib
dnl * by Florian Bomers dnl
dnl by Florian Bomers
dnl-----------------------------------------------------------------------------
AC_DEFUN(LA_SEARCH_LIB,[ AC_DEFUN(LA_SEARCH_LIB,[
dnl look for lib dnl look for lib
LA_SEARCH_FILE($1, $3, $5 $5/lib ) LA_SEARCH_FILE($1, $3, $5 $5/lib )

View File

@ -15,19 +15,92 @@ AC_HAVE_HEADERS(sched.h)
AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h) AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h)
AC_HEADER_SYS_WAIT() AC_HEADER_SYS_WAIT()
AC_CHECK_HEADERS(lame/lame.h)
AC_CHECK_HEADERS(vorbis/vorbisenc.h)
AC_TYPE_PID_T() AC_TYPE_PID_T()
AC_TYPE_SIZE_T() AC_TYPE_SIZE_T()
AC_CHECK_LIB( socket, socket) AC_CHECK_LIB( socket, socket)
AC_CHECK_LIB( nsl, gethostbyname) AC_CHECK_LIB( nsl, gethostbyname)
AC_CHECK_LIB( rt, sched_getscheduler) AC_CHECK_LIB( rt, sched_getscheduler)
AC_CHECK_LIB( ogg, ogg_stream_init)
AC_CHECK_LIB( vorbis, vorbis_info_init)
AC_CHECK_LIB( vorbisenc, vorbis_encode_init) dnl-----------------------------------------------------------------------------
AC_CHECK_LIB( mp3lame, lame_init) dnl link the lame library if requested
dnl-----------------------------------------------------------------------------
AC_SUBST( LAME_INCFLAGS)
AC_SUBST( LAME_LDFLAGS)
AC_ARG_WITH( lame,
[ --with-lame use lame for encoding mp3 streams [yes] ],
USE_LAME=${withval}, USE_LAME="yes" )
AC_ARG_WITH( lame-prefix,
[ --with-lame-prefix=DIR alternate location for lame [/usr]
look for libraries in LAME-PREFIX/lib,
for headers in LAME-PREFIX/include],
CONFIG_LAME_PREFIX="${withval}", CONFIG_LAME_PREFIX="/usr")
if test "x${USE_LAME}" = "xyes" ; then
AC_MSG_CHECKING( [for lame library at ${CONFIG_LAME_PREFIX}] )
LA_SEARCH_LIB( LAME_LIB_LOC, LAME_INC_LOC, libmp3lame.a, lame/lame.h,
${CONFIG_LAME_PREFIX})
if test "x${LAME_LIB_LOC}" != "x" ; then
AC_DEFINE( HAVE_LAME_LIB, 1, [build with lame library] )
LAME_INCFLAGS="-I${LAME_INC_LOC}"
LAME_LDFLAGS="-L${LAME_LIB_LOC} -lmp3lame"
AC_MSG_RESULT( [found at ${CONFIG_LAME_PREFIX}] )
else
AC_MSG_WARN( [not found, building without lame])
fi
else
AC_MSG_RESULT( [building without lame] )
fi
dnl-----------------------------------------------------------------------------
dnl link the ogg vorbis libraries if requested
dnl-----------------------------------------------------------------------------
AC_SUBST( VORBIS_INCFLAGS)
AC_SUBST( VORBIS_LDFLAGS)
AC_ARG_WITH( vorbis,
[ --with-vorbis use Ogg Vorbis for encoding vorbis streams [yes] ],
USE_VORBIS=${withval}, USE_VORBIS="yes" )
AC_ARG_WITH( vorbis-prefix,
[ --with-vorbis-prefix=DIR alternate location for vorbis [/usr]
look for libraries in VORBIS-PREFIX/lib,
for headers in VORBIS-PREFIX/include],
CONFIG_VORBIS_PREFIX="${withval}", CONFIG_VORBIS_PREFIX="/usr")
if test "x${USE_VORBIS}" = "xyes" ; then
AC_MSG_CHECKING( [for vorbis libraries at ${CONFIG_VORBIS_PREFIX}] )
LA_SEARCH_LIB( OGG_LIB_LOC, OGG_INC_LOC, libogg.a, ogg/ogg.h,
${CONFIG_VORBIS_PREFIX})
LA_SEARCH_LIB( VORBIS_LIB_LOC, VORBIS_INC_LOC, libvorbis.a, vorbis/codec.h,
${CONFIG_VORBIS_PREFIX})
LA_SEARCH_LIB( VORBISENC_LIB_LOC, VORBISENC_INC_LOC,
libvorbisenc.a, vorbis/vorbisenc.h,
${CONFIG_VORBIS_PREFIX})
if test "x${OGG_LIB_LOC}" != "x" -a \
"x${VORBIS_LIB_LOC}" != "x" -a \
"x${VORBISENC_LIB_LOC}" != "x" ; then
AC_DEFINE( HAVE_VORBIS_LIB, 1, [build with Ogg Vorbis library] )
VORBIS_INCFLAGS="-I${OGG_INC_LOC}"
VORBIS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lvorbis -lvorbisenc"
AC_MSG_RESULT( [found at ${CONFIG_VORBIS_PREFIX}] )
else
AC_MSG_WARN( [not found, building without Ogg Vorbis])
fi
else
AC_MSG_RESULT( [building without Ogg Vorbis] )
fi
dnl make sure at least one of lame and vorbis present
if test "x${LAME_INCFLAGS}" = "x" -a "x${VORBIS_INCFLAGS}" = "x" ; then
AC_MSG_ERROR( [neither lame nor Ogg Vorbis configured])
fi
AC_OUTPUT(Makefile src/Makefile man/Makefile) AC_OUTPUT(Makefile src/Makefile man/Makefile)

View File

@ -71,14 +71,21 @@
#endif #endif
#include "Util.h" #include "Util.h"
#include "IceCast.h" #include "IceCast.h"
#include "IceCast2.h" #include "IceCast2.h"
#include "ShoutCast.h" #include "ShoutCast.h"
#include "LameLibEncoder.h"
#include "VorbisLibEncoder.h"
#include "DarkIce.h" #include "DarkIce.h"
#ifdef HAVE_LAME_LIB
#include "LameLibEncoder.h"
#endif
#ifdef HAVE_VORBIS_LIB
#include "VorbisLibEncoder.h"
#endif
/* =================================================== local data structures */ /* =================================================== local data structures */
@ -174,7 +181,6 @@ DarkIce :: configIceCast ( const Config & config,
for ( u = 0; u < maxOutput; ++u ) { for ( u = 0; u < maxOutput; ++u ) {
const ConfigSection * cs; const ConfigSection * cs;
const char * str;
// ugly hack to change the section name to "stream0", "stream1", etc. // ugly hack to change the section name to "stream0", "stream1", etc.
stream[streamLen-1] = '0' + u; stream[streamLen-1] = '0' + u;
@ -183,6 +189,15 @@ DarkIce :: configIceCast ( const Config & config,
break; break;
} }
#ifndef HAVE_LAME_LIB
throw Exception( __FILE__, __LINE__,
"DarkIce not compiled with lame support, "
"thus can't connect to IceCast 1.x, stream: ",
stream);
#else
const char * str;
unsigned int sampleRate = 0; unsigned int sampleRate = 0;
unsigned int bitrate = 0; unsigned int bitrate = 0;
const char * server = 0; const char * server = 0;
@ -252,6 +267,7 @@ DarkIce :: configIceCast ( const Config & config,
highpass ); highpass );
encConnector->attach( audioOuts[u].encoder.get()); encConnector->attach( audioOuts[u].encoder.get());
#endif // HAVE_LAME_LIB
} }
noAudioOuts += u; noAudioOuts += u;
@ -274,7 +290,6 @@ DarkIce :: configIceCast2 ( const Config & config,
for ( u = 0; u < maxOutput; ++u ) { for ( u = 0; u < maxOutput; ++u ) {
const ConfigSection * cs; const ConfigSection * cs;
const char * str;
// ugly hack to change the section name to "stream0", "stream1", etc. // ugly hack to change the section name to "stream0", "stream1", etc.
stream[streamLen-1] = '0' + u; stream[streamLen-1] = '0' + u;
@ -283,6 +298,15 @@ DarkIce :: configIceCast2 ( const Config & config,
break; break;
} }
#ifndef HAVE_VORBIS_LIB
throw Exception( __FILE__, __LINE__,
"DarkIce not compiled with Ogg Vorbis support, "
"thus can't connect to IceCast 2, stream: ",
stream);
#else
const char * str;
unsigned int bitrate = 0; unsigned int bitrate = 0;
const char * server = 0; const char * server = 0;
unsigned int port = 0; unsigned int port = 0;
@ -338,6 +362,7 @@ DarkIce :: configIceCast2 ( const Config & config,
dsp->getChannel() ); dsp->getChannel() );
encConnector->attach( audioOuts[u].encoder.get()); encConnector->attach( audioOuts[u].encoder.get());
#endif // HAVE_VORBIS_LIB
} }
noAudioOuts += u; noAudioOuts += u;
@ -360,7 +385,6 @@ DarkIce :: configShoutCast ( const Config & config,
for ( u = 0; u < maxOutput; ++u ) { for ( u = 0; u < maxOutput; ++u ) {
const ConfigSection * cs; const ConfigSection * cs;
const char * str;
// ugly hack to change the section name to "stream0", "stream1", etc. // ugly hack to change the section name to "stream0", "stream1", etc.
stream[streamLen-1] = '0' + u; stream[streamLen-1] = '0' + u;
@ -369,6 +393,15 @@ DarkIce :: configShoutCast ( const Config & config,
break; break;
} }
#ifndef HAVE_LAME_LIB
throw Exception( __FILE__, __LINE__,
"DarkIce not compiled with lame support, "
"thus can't connect to ShoutCast, stream: ",
stream);
#else
const char * str;
unsigned int sampleRate = 0; unsigned int sampleRate = 0;
unsigned int bitrate = 0; unsigned int bitrate = 0;
const char * server = 0; const char * server = 0;
@ -436,6 +469,7 @@ DarkIce :: configShoutCast ( const Config & config,
highpass ); highpass );
encConnector->attach( audioOuts[u].encoder.get()); encConnector->attach( audioOuts[u].encoder.get());
#endif // HAVE_LAME_LIB
} }
noAudioOuts += u; noAudioOuts += u;
@ -574,6 +608,9 @@ DarkIce :: run ( void ) throw ( Exception )
$Source$ $Source$
$Log$ $Log$
Revision 1.21 2001/10/19 12:39:42 darkeye
created configure options to compile with or without lame / Ogg Vorbis
Revision 1.20 2001/10/19 09:03:39 darkeye Revision 1.20 2001/10/19 09:03:39 darkeye
added support for resampling mp3 streams added support for resampling mp3 streams

View File

@ -33,6 +33,9 @@
#include "config.h" #include "config.h"
#endif #endif
// compile the whole file only if lame support configured in
#ifdef HAVE_LAME_LIB
#include "Exception.h" #include "Exception.h"
#include "Util.h" #include "Util.h"
@ -408,12 +411,17 @@ LameLibEncoder :: close ( void ) throw ( Exception )
} }
#endif // HAVE_LAME_LIB
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
$Source$ $Source$
$Log$ $Log$
Revision 1.8 2001/10/19 12:39:42 darkeye
created configure options to compile with or without lame / Ogg Vorbis
Revision 1.7 2001/09/18 14:57:19 darkeye Revision 1.7 2001/09/18 14:57:19 darkeye
finalized Solaris port finalized Solaris port

View File

@ -40,10 +40,10 @@
#include "config.h" #include "config.h"
#endif #endif
#ifdef HAVE_LAME_LAME_H #ifdef HAVE_LAME_LIB
#include <lame/lame.h> #include <lame/lame.h>
#else #else
#error need lame/lame.h #error configure with lame
#endif #endif
@ -448,7 +448,6 @@ class LameLibEncoder : public AudioEncoder, public virtual Reporter
/* ====================================================== function prototypes */ /* ====================================================== function prototypes */
#endif /* LAME_LIB_ENCODER_H */ #endif /* LAME_LIB_ENCODER_H */
@ -457,6 +456,9 @@ class LameLibEncoder : public AudioEncoder, public virtual Reporter
$Source$ $Source$
$Log$ $Log$
Revision 1.9 2001/10/19 12:39:42 darkeye
created configure options to compile with or without lame / Ogg Vorbis
Revision 1.8 2001/10/19 09:03:39 darkeye Revision 1.8 2001/10/19 09:03:39 darkeye
added support for resampling mp3 streams added support for resampling mp3 streams

View File

@ -1,5 +1,7 @@
bin_PROGRAMS = darkice bin_PROGRAMS = darkice
CXXFLAGS = -O2 -Wall CXXFLAGS = -O2 -Wall
INCLUDES = @LAME_INCFLAGS@ @VORBIS_INCFLAGS@
LDADD = @LAME_LDFLAGS@ @VORBIS_LDFLAGS@
darkice_SOURCES = AudioEncoder.h\ darkice_SOURCES = AudioEncoder.h\
AudioSource.h\ AudioSource.h\

View File

@ -33,6 +33,9 @@
#include "config.h" #include "config.h"
#endif #endif
// compile only if configured for Ogg Vorbis
#ifdef HAVE_VORBIS_LIB
#include "Exception.h" #include "Exception.h"
#include "Util.h" #include "Util.h"
@ -348,12 +351,17 @@ VorbisLibEncoder :: close ( void ) throw ( Exception )
} }
#endif // HAVE_VORBIS_LIB
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
$Source$ $Source$
$Log$ $Log$
Revision 1.4 2001/10/19 12:39:42 darkeye
created configure options to compile with or without lame / Ogg Vorbis
Revision 1.3 2001/09/18 14:57:19 darkeye Revision 1.3 2001/09/18 14:57:19 darkeye
finalized Solaris port finalized Solaris port

View File

@ -40,10 +40,10 @@
#include "config.h" #include "config.h"
#endif #endif
#ifdef HAVE_VORBIS_VORBISENC_H #ifdef HAVE_VORBIS_LIB
#include <vorbis/vorbisenc.h> #include <vorbis/vorbisenc.h>
#else #else
#error need vorbis/vorbisenc.h #error configure for Ogg Vorbis
#endif #endif
@ -442,6 +442,9 @@ class VorbisLibEncoder : public AudioEncoder, public virtual Reporter
$Source$ $Source$
$Log$ $Log$
Revision 1.3 2001/10/19 12:39:42 darkeye
created configure options to compile with or without lame / Ogg Vorbis
Revision 1.2 2001/09/15 11:36:22 darkeye Revision 1.2 2001/09/15 11:36:22 darkeye
added function vorbisBlocksOut(), finalized vorbis support added function vorbisBlocksOut(), finalized vorbis support