finalized Solaris port
This commit is contained in:
parent
89d82d4477
commit
fe9fdd0e3d
|
@ -13,9 +13,11 @@ AC_HAVE_HEADERS(signal.h time.h sys/time.h sys/types.h sys/wait.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)
|
AC_HAVE_HEADERS(sched.h)
|
||||||
AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h)
|
AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h)
|
||||||
AC_HAVE_HEADERS(lame/lame.h vorbis/vorbisenc.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()
|
||||||
|
|
||||||
|
@ -24,6 +26,7 @@ AC_SUBST(LINK_STATIC)
|
||||||
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( vorbis, vorbis_info_init)
|
||||||
AC_CHECK_LIB( vorbisenc, vorbis_encode_init)
|
AC_CHECK_LIB( vorbisenc, vorbis_encode_init)
|
||||||
AC_CHECK_LIB( mp3lame, lame_init)
|
AC_CHECK_LIB( mp3lame, lame_init)
|
||||||
|
|
|
@ -74,6 +74,11 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
*/
|
*/
|
||||||
unsigned int inChannel;
|
unsigned int inChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the input big endian or little endian?
|
||||||
|
*/
|
||||||
|
bool inBigEndian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bit rate of the output. (bits/sec)
|
* Bit rate of the output. (bits/sec)
|
||||||
*/
|
*/
|
||||||
|
@ -95,6 +100,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
* @param inSampleRate sample rate of the input.
|
* @param inSampleRate sample rate of the input.
|
||||||
* @param inBitsPerSample number of bits per sample of the input.
|
* @param inBitsPerSample number of bits per sample of the input.
|
||||||
* @param inChannel number of channels of the input.
|
* @param inChannel number of channels of the input.
|
||||||
|
* @param inBigEndian shows if the input is big or little endian
|
||||||
* @param outBitrate bit rate of the output.
|
* @param outBitrate bit rate of the output.
|
||||||
* @param outSampleRate sample rate of the output.
|
* @param outSampleRate sample rate of the output.
|
||||||
* @param outChannel number of channels of the output.
|
* @param outChannel number of channels of the output.
|
||||||
|
@ -104,6 +110,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
init ( unsigned int inSampleRate,
|
init ( unsigned int inSampleRate,
|
||||||
unsigned int inBitsPerSample,
|
unsigned int inBitsPerSample,
|
||||||
unsigned int inChannel,
|
unsigned int inChannel,
|
||||||
|
bool inBigEndian,
|
||||||
unsigned int outBitrate,
|
unsigned int outBitrate,
|
||||||
unsigned int outSampleRate,
|
unsigned int outSampleRate,
|
||||||
unsigned int outChannel ) throw ( Exception )
|
unsigned int outChannel ) throw ( Exception )
|
||||||
|
@ -111,6 +118,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
this->inSampleRate = inSampleRate;
|
this->inSampleRate = inSampleRate;
|
||||||
this->inBitsPerSample = inBitsPerSample;
|
this->inBitsPerSample = inBitsPerSample;
|
||||||
this->inChannel = inChannel;
|
this->inChannel = inChannel;
|
||||||
|
this->inBigEndian = inBigEndian;
|
||||||
this->outBitrate = outBitrate;
|
this->outBitrate = outBitrate;
|
||||||
this->outSampleRate = outSampleRate;
|
this->outSampleRate = outSampleRate;
|
||||||
this->outChannel = outChannel;
|
this->outChannel = outChannel;
|
||||||
|
@ -146,6 +154,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
* @param inSampleRate sample rate of the input.
|
* @param inSampleRate sample rate of the input.
|
||||||
* @param inBitsPerSample number of bits per sample of the input.
|
* @param inBitsPerSample number of bits per sample of the input.
|
||||||
* @param inChannel number of channels of the input.
|
* @param inChannel number of channels of the input.
|
||||||
|
* @param inBigEndian shows if the input is big or little endian
|
||||||
* @param outBitrate bit rate of the output (bits/sec).
|
* @param outBitrate bit rate of the output (bits/sec).
|
||||||
* @param outSampleRate sample rate of the output.
|
* @param outSampleRate sample rate of the output.
|
||||||
* If 0, inSampleRate is used.
|
* If 0, inSampleRate is used.
|
||||||
|
@ -157,6 +166,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
AudioEncoder ( unsigned int inSampleRate,
|
AudioEncoder ( unsigned int inSampleRate,
|
||||||
unsigned int inBitsPerSample,
|
unsigned int inBitsPerSample,
|
||||||
unsigned int inChannel,
|
unsigned int inChannel,
|
||||||
|
bool inBigEndian,
|
||||||
unsigned int outBitrate,
|
unsigned int outBitrate,
|
||||||
unsigned int outSampleRate = 0,
|
unsigned int outSampleRate = 0,
|
||||||
unsigned int outChannel = 0 )
|
unsigned int outChannel = 0 )
|
||||||
|
@ -165,6 +175,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
init ( inSampleRate,
|
init ( inSampleRate,
|
||||||
inBitsPerSample,
|
inBitsPerSample,
|
||||||
inChannel,
|
inChannel,
|
||||||
|
inBigEndian,
|
||||||
outBitrate,
|
outBitrate,
|
||||||
outSampleRate ? outSampleRate : inSampleRate,
|
outSampleRate ? outSampleRate : inSampleRate,
|
||||||
outChannel ? outChannel : inChannel );
|
outChannel ? outChannel : inChannel );
|
||||||
|
@ -192,6 +203,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
init( as->getSampleRate(),
|
init( as->getSampleRate(),
|
||||||
as->getBitsPerSample(),
|
as->getBitsPerSample(),
|
||||||
as->getChannel(),
|
as->getChannel(),
|
||||||
|
as->isBigEndian(),
|
||||||
outBitrate,
|
outBitrate,
|
||||||
outSampleRate ? outSampleRate : as->getSampleRate(),
|
outSampleRate ? outSampleRate : as->getSampleRate(),
|
||||||
outChannel ? outChannel : as->getChannel() );
|
outChannel ? outChannel : as->getChannel() );
|
||||||
|
@ -208,6 +220,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
init ( encoder.inSampleRate,
|
init ( encoder.inSampleRate,
|
||||||
encoder.inBitsPerSample,
|
encoder.inBitsPerSample,
|
||||||
encoder.inChannel,
|
encoder.inChannel,
|
||||||
|
encoder.inBigEndian,
|
||||||
encoder.outBitrate,
|
encoder.outBitrate,
|
||||||
encoder.outSampleRate,
|
encoder.outSampleRate,
|
||||||
encoder.outChannel );
|
encoder.outChannel );
|
||||||
|
@ -229,6 +242,7 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
init ( encoder.inSampleRate,
|
init ( encoder.inSampleRate,
|
||||||
encoder.inBitsPerSample,
|
encoder.inBitsPerSample,
|
||||||
encoder.inChannel,
|
encoder.inChannel,
|
||||||
|
encoder.inBigEndian,
|
||||||
encoder.outBitrate,
|
encoder.outBitrate,
|
||||||
encoder.outSampleRate,
|
encoder.outSampleRate,
|
||||||
encoder.outChannel );
|
encoder.outChannel );
|
||||||
|
@ -262,6 +276,17 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
return inChannel;
|
return inChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tell if the input is big or little endian.
|
||||||
|
*
|
||||||
|
* @return true if the input is big endian, false if little endian.
|
||||||
|
*/
|
||||||
|
inline bool
|
||||||
|
isInBigEndian ( void ) const throw ()
|
||||||
|
{
|
||||||
|
return inBigEndian;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the sample rate of the input.
|
* Get the sample rate of the input.
|
||||||
*
|
*
|
||||||
|
@ -360,6 +385,9 @@ class AudioEncoder : public Sink, public virtual Referable
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.4 2001/09/18 14:57:19 darkeye
|
||||||
|
finalized Solaris port
|
||||||
|
|
||||||
Revision 1.3 2001/09/14 19:31:06 darkeye
|
Revision 1.3 2001/09/14 19:31:06 darkeye
|
||||||
added IceCast2 / vorbis support
|
added IceCast2 / vorbis support
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,14 @@ class AudioSource : public Source
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tell if the data from this source comes in big or little endian.
|
||||||
|
*
|
||||||
|
* @return true if the data is big endian, false if little endian
|
||||||
|
*/
|
||||||
|
virtual bool
|
||||||
|
isBigEndian ( void ) const throw () = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the sample rate per seconds for this AudioSource.
|
* Get the sample rate per seconds for this AudioSource.
|
||||||
*
|
*
|
||||||
|
@ -244,6 +252,9 @@ typedef class SolarisDspSource DspSource;
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.5 2001/09/18 14:57:19 darkeye
|
||||||
|
finalized Solaris port
|
||||||
|
|
||||||
Revision 1.4 2001/09/11 15:05:21 darkeye
|
Revision 1.4 2001/09/11 15:05:21 darkeye
|
||||||
added Solaris support
|
added Solaris support
|
||||||
|
|
||||||
|
|
|
@ -240,6 +240,34 @@ LameLibEncoder :: conv16 ( unsigned char * pcmBuffer,
|
||||||
short int * rightBuffer,
|
short int * rightBuffer,
|
||||||
unsigned int channels )
|
unsigned int channels )
|
||||||
{
|
{
|
||||||
|
if ( isInBigEndian() ) {
|
||||||
|
if ( channels == 1 ) {
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for ( i = 0, j = 0; i < lenPcmBuffer; ) {
|
||||||
|
unsigned short int value;
|
||||||
|
|
||||||
|
value = pcmBuffer[i++] << 8;
|
||||||
|
value |= pcmBuffer[i++];
|
||||||
|
leftBuffer[j] = (short int) value;
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for ( i = 0, j = 0; i < lenPcmBuffer; ) {
|
||||||
|
unsigned short int value;
|
||||||
|
|
||||||
|
value = pcmBuffer[i++] << 8;
|
||||||
|
value |= pcmBuffer[i++];
|
||||||
|
leftBuffer[j] = (short int) value;
|
||||||
|
value = pcmBuffer[i++] << 8;
|
||||||
|
value |= pcmBuffer[i++];
|
||||||
|
rightBuffer[j] = (short int) value;
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if ( channels == 1 ) {
|
if ( channels == 1 ) {
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
|
@ -267,6 +295,7 @@ LameLibEncoder :: conv16 ( unsigned char * pcmBuffer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
@ -385,6 +414,9 @@ LameLibEncoder :: close ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.7 2001/09/18 14:57:19 darkeye
|
||||||
|
finalized Solaris port
|
||||||
|
|
||||||
Revision 1.6 2001/09/15 11:35:08 darkeye
|
Revision 1.6 2001/09/15 11:35:08 darkeye
|
||||||
minor fixes
|
minor fixes
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,17 @@ class OssDspSource : public AudioSource, public virtual Reporter
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tell if the data from this source comes in big or little endian.
|
||||||
|
*
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
virtual inline bool
|
||||||
|
isBigEndian ( void ) const throw ()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the OssDspSource.
|
* Open the OssDspSource.
|
||||||
* This does not put the OSS DSP device into recording mode.
|
* This does not put the OSS DSP device into recording mode.
|
||||||
|
@ -251,6 +262,9 @@ class OssDspSource : public AudioSource, public virtual Reporter
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.5 2001/09/18 14:57:19 darkeye
|
||||||
|
finalized Solaris port
|
||||||
|
|
||||||
Revision 1.4 2001/09/02 14:08:40 darkeye
|
Revision 1.4 2001/09/02 14:08:40 darkeye
|
||||||
setting the sound card recording sample rate is now more relaxed
|
setting the sound card recording sample rate is now more relaxed
|
||||||
there is no error reported if the sample rate is not exactly the same
|
there is no error reported if the sample rate is not exactly the same
|
||||||
|
|
|
@ -174,6 +174,17 @@ class SolarisDspSource : public AudioSource, public virtual Reporter
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tell if the data from this source comes in big or little endian.
|
||||||
|
*
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
virtual inline bool
|
||||||
|
isBigEndian ( void ) const throw ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the SolarisDspSource.
|
* Open the SolarisDspSource.
|
||||||
* This does not put the Solaris DSP device into recording mode.
|
* This does not put the Solaris DSP device into recording mode.
|
||||||
|
@ -252,6 +263,9 @@ class SolarisDspSource : public AudioSource, public virtual Reporter
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.2 2001/09/18 14:57:19 darkeye
|
||||||
|
finalized Solaris port
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
|
@ -179,6 +179,34 @@ VorbisLibEncoder :: conv16 ( unsigned char * pcmBuffer,
|
||||||
float * rightBuffer,
|
float * rightBuffer,
|
||||||
unsigned int channels )
|
unsigned int channels )
|
||||||
{
|
{
|
||||||
|
if ( isInBigEndian() ) {
|
||||||
|
if ( channels == 1 ) {
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for ( i = 0, j = 0; i < lenPcmBuffer; ) {
|
||||||
|
short int value;
|
||||||
|
|
||||||
|
value = pcmBuffer[i++] << 8;
|
||||||
|
value |= pcmBuffer[i++];
|
||||||
|
leftBuffer[j] = ((float) value) / 32768.f;
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for ( i = 0, j = 0; i < lenPcmBuffer; ) {
|
||||||
|
short int value;
|
||||||
|
|
||||||
|
value = pcmBuffer[i++] << 8;
|
||||||
|
value |= pcmBuffer[i++];
|
||||||
|
leftBuffer[j] = ((float) value) / 32768.f;
|
||||||
|
value = pcmBuffer[i++] << 8;
|
||||||
|
value |= pcmBuffer[i++];
|
||||||
|
rightBuffer[j] = ((float) value) / 32768.f;
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if ( channels == 1 ) {
|
if ( channels == 1 ) {
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
|
@ -206,6 +234,7 @@ VorbisLibEncoder :: conv16 ( unsigned char * pcmBuffer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
|
@ -325,6 +354,9 @@ VorbisLibEncoder :: close ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.3 2001/09/18 14:57:19 darkeye
|
||||||
|
finalized Solaris port
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue