added kdoc-style documentation comments

This commit is contained in:
darkeye 2000-11-12 14:54:50 +00:00
parent 456010f03f
commit e3323d4da7
11 changed files with 1005 additions and 312 deletions

View File

@ -9,26 +9,21 @@
Author : $Author$
Location : $AudioEncoder$
Abstract :
An audio encoder
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
#ifndef AUDIO_ENCODER_H
@ -53,22 +48,57 @@
/* =============================================================== data types */
/*------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------*/
/**
* An audio encoder
*
* @author $Author$
* @version $Revision$
*/
class AudioEncoder : public virtual Referable
{
private:
/**
* Sample rate of the input.
*/
unsigned int inSampleRate;
/**
* Number of bits per sample of the input.
*/
unsigned int inBitsPerSample;
/**
* Number of channels of the input.
*/
unsigned int inChannel;
/**
* Bit rate of the output. (bits/sec)
*/
unsigned int outBitrate;
/**
* Sample rate of the output.
*/
unsigned int outSampleRate;
/**
* Number of channels of the output.
*/
unsigned int outChannel;
/**
* Initialize the object.
*
* @param inSampleRate sample rate of the input.
* @param inBitsPerSample number of bits per sample of the input.
* @param inChannel number of channels of the input.
* @param outBitrate bit rate of the output.
* @param outSampleRate sample rate of the output.
* @param outChannel number of channels of the output.
* @exception Exception
*/
inline void
init ( unsigned int inSampleRate,
unsigned int inBitsPerSample,
@ -85,7 +115,11 @@ class AudioEncoder : public virtual Referable
this->outChannel = outChannel;
}
/**
* De-iitialize the object.
*
* @exception Exception
*/
inline void
strip ( void ) throw ( Exception )
{
@ -94,13 +128,30 @@ class AudioEncoder : public virtual Referable
protected:
/**
* Default constructor. Always throws an Exception.
*
* @exception Exception
*/
inline
AudioEncoder ( void ) throw ( Exception )
{
throw Exception( __FILE__, __LINE__);
}
/**
* Constructor.
*
* @param inSampleRate sample rate of the input.
* @param inBitsPerSample number of bits per sample of the input.
* @param inChannel number of channels of the input.
* @param outBitrate bit rate of the output (bits/sec).
* @param outSampleRate sample rate of the output.
* If 0, inSampleRate is used.
* @param outChannel number of channels of the output.
* If 0, inChannel is used.
* @exception Exception
*/
inline
AudioEncoder ( unsigned int inSampleRate,
unsigned int inBitsPerSample,
@ -118,7 +169,18 @@ class AudioEncoder : public virtual Referable
outChannel ? outChannel : inChannel );
}
/**
* Constructor.
*
* @param as get input sample rate, bits per sample and channels
* from this AudioSource.
* @param outBitrate bit rate of the output (bits/sec).
* @param outSampleRate sample rate of the output.
* If 0, input sample rate is used.
* @param outChannel number of channels of the output.
* If 0, input channel is used.
* @exception Exception
*/
inline
AudioEncoder ( const AudioSource * as,
unsigned int outBitrate,
@ -134,7 +196,11 @@ class AudioEncoder : public virtual Referable
outChannel ? outChannel : as->getChannel() );
}
/**
* Copy constructor.
*
* @param encoder the AudioEncoder to copy.
*/
inline
AudioEncoder ( const AudioEncoder & encoder ) throw ( Exception )
{
@ -146,7 +212,13 @@ class AudioEncoder : public virtual Referable
encoder.outChannel );
}
/**
* Assignment operator.
*
* @param encoder the AudioEncoder to assign this to.
* @return a reference to this AudioEncoder.
* @exception Exception
*/
inline virtual AudioEncoder &
operator= ( const AudioEncoder & encoder ) throw ( Exception )
{
@ -167,63 +239,106 @@ class AudioEncoder : public virtual Referable
public:
/**
* Destructor.
*
* @exception Exception
*/
inline virtual
~AudioEncoder ( void ) throw ( Exception )
{
strip();
}
/**
* Get the number of channels of the input.
*
* @return the number of channels of the input.
*/
inline int
getInChannel ( void ) const throw ()
{
return inChannel;
}
/**
* Get the sample rate of the input.
*
* @return the sample rate of the input.
*/
inline int
getInSampleRate ( void ) const throw ()
{
return inSampleRate;
}
/**
* Get the number of bits per sample of the input.
*
* @return the number of bits per sample of the input.
*/
inline int
getInBitsPerSample ( void ) const throw ()
{
return inBitsPerSample;
}
/**
* Get the number of channels of the output.
*
* @return the number of channels of the output.
*/
inline int
getOutChannel ( void ) const throw ()
{
return outChannel;
}
/**
* Get the sample rate of the output.
*
* @return the sample rate of the output.
*/
inline int
getOutSampleRate ( void ) const throw ()
{
return outSampleRate;
}
/**
* Get the bit rate of the output. (bits/sec)
*
* @return the bit rate of the output.
*/
inline int
getOutBitrate ( void ) const throw ()
{
return outBitrate;
}
/**
* Check wether encoding is in progress.
*
* @return true if encoding is in progress, false otherwise.
*/
virtual bool
isRunning ( void ) const throw () = 0;
/**
* Start encoding. This function returns as soon as possible,
* with encoding started in the background.
*
* @return true if encoding has started, false otherwise.
* @exception Exception
*/
virtual bool
start ( void ) throw ( Exception ) = 0;
/**
* Stop encoding. Stops the encoding running in the background.
*
* @exception Exception
*/
virtual void
stop ( void ) throw ( Exception ) = 0;
};
@ -244,8 +359,11 @@ class AudioEncoder : public virtual Referable
$Source$
$Log$
Revision 1.1 2000/11/05 10:05:47 darkeye
Initial revision
Revision 1.2 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.1.1.1 2000/11/05 10:05:47 darkeye
initial version
------------------------------------------------------------------------------*/

View File

@ -9,26 +9,21 @@
Author : $Author$
Location : $Source$
Abstract :
Data output to a ShoutCast / IceCast / etc. server
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
@ -141,6 +136,9 @@ CastSink :: open ( void ) throw ( Exception )
$Source$
$Log$
Revision 1.3 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/10 20:14:11 darkeye
added support for remote dump file

View File

@ -9,26 +9,21 @@
Author : $Author$
Location : $Source$
Abstract :
Data output to a ShoutCast / IceCast / etc. server
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
#ifndef CAST_SINK_H
@ -55,28 +50,95 @@
/* =============================================================== data types */
/*------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------*/
/**
* Data output to a ShoutCast / IceCast / etc. server
* This is an abstract class. A subclass should override at least
* the sendLogin() function.
*
* @author $Author$
* @version $Revision$
*/
class CastSink : public Sink
{
private:
/**
* The socket connection to the server.
*/
Ref<TcpSocket> socket;
Ref<BufferedSink> bufferedSink;
char * password;
char * mountPoint;
char * remoteDumpFile;
char * name;
char * description;
char * url;
char * genre;
unsigned int bitRate;
bool isPublic;
/**
* The BufferedSink encapsulating the socket connection to the server.
*/
Ref<BufferedSink> bufferedSink;
/**
* Duration of the BufferedSink buffer in seconds.
*/
unsigned int bufferDuration;
/**
* Password to the server.
*/
char * password;
/**
* Mount point of the stream on the server.
*/
char * mountPoint;
/**
* Remote dump file if any.
*/
char * remoteDumpFile;
/**
* Name of the stream.
*/
char * name;
/**
* Description of the stream.
*/
char * description;
/**
* URL associated with the stream.
*/
char * url;
/**
* Genre of the stream.
*/
char * genre;
/**
* Bitrate of the stream (e.g. mp3 bitrate).
*/
unsigned int bitRate;
/**
* Is the stream public?
*/
bool isPublic;
/**
* Initalize the object.
*
* @param socket socket connection to the server.
* @param password password to the server.
* @param mountPoint mount point of the stream on the server.
* @param remoteDumpFile remote dump file (may be NULL).
* @param name name of the stream.
* @param description description of the stream.
* @param url URL associated with the stream.
* @param genre genre of the stream.
* @param bitRate bitrate of the stream (e.g. mp3 bitrate).
* @param isPublic is the stream public?
* @param bufferDuration duration of the BufferedSink buffer
* in seconds.
* @exception Exception
*/
void
init ( TcpSocket * socket,
const char * password,
@ -91,26 +153,79 @@ class CastSink : public Sink
unsigned int bufferDuration )
throw ( Exception );
/**
* De-initalize the object.
*
* @exception Exception
*/
void
strip ( void ) throw ( Exception );
protected:
/**
* Default constructor. Always throws an Exception.
*
* @exception Exception
*/
inline
CastSink ( void ) throw ( Exception )
{
throw Exception( __FILE__, __LINE__);
}
/**
* Log in to the server using the socket avialable.
*
* @return true if login was successful, false otherwise.
* @exception Exception
*/
virtual bool
sendLogin ( void ) throw ( Exception ) = 0;
/**
* Get the Sink underneath this CastSink.
*
* @return pointer to the Sink underneath this CastSink.
*/
inline Sink *
getSink ( void ) const throw ()
{
return bufferedSink.get();
}
/**
* Get the TcpSocket underneath this CastSink.
*
* @return pointer to the TcpSocket underneath this CastSink.
*/
inline TcpSocket *
getSocket ( void ) const throw ()
{
return socket.get();
}
public:
/**
* Constructor.
*
* @param socket socket connection to the server.
* @param password password to the server.
* @param mountPoint mount point of the stream on the server.
* @param remoteDumpFile remote dump file (may be NULL).
* @param name name of the stream.
* @param description description of the stream.
* @param url URL associated with the stream.
* @param genre genre of the stream.
* @param bitRate bitrate of the stream (e.g. mp3 bitrate).
* @param isPublic is the stream public?
* @param bufferDuration duration of the BufferedSink buffer
* in seconds.
* @exception Exception
*/
inline
CastSink ( TcpSocket * socket,
const char * password,
@ -138,7 +253,11 @@ class CastSink : public Sink
bufferDuration );
}
/**
* Copy constructor.
*
* @param cs the CastSink to copy.
*/
inline
CastSink( const CastSink & cs ) throw ( Exception )
: Sink( cs )
@ -156,14 +275,24 @@ class CastSink : public Sink
cs.bufferDuration );
}
/**
* Destructor.
*
* @exception Exception
*/
inline virtual
~CastSink( void ) throw ( Exception )
{
strip();
}
/**
* Assignment operator.
*
* @param cs the CastSink to assign this to.
* @return a reference to this CastSink.
* @exception Exception
*/
inline virtual CastSink &
operator= ( const CastSink & cs ) throw ( Exception )
{
@ -185,125 +314,185 @@ class CastSink : public Sink
return *this;
}
inline Sink *
getSink ( void ) const throw ()
{
return bufferedSink.get();
}
inline TcpSocket *
getSocket ( void ) const throw ()
{
return socket.get();
}
/**
* Open the CastSink.
* Logs in to the server.
*
* @return true if opening was successfull, false otherwise.
* @exception Exception
*/
virtual bool
open ( void ) throw ( Exception );
/**
* Check if the CastSink is open.
*
* @return true if the CastSink is open, false otherwise.
*/
inline virtual bool
isOpen ( void ) const throw ()
{
return bufferedSink->isOpen();
}
/**
* Check if the CastSink is ready to accept data.
* Blocks until the specified time for data to be available.
*
* @param sec the maximum seconds to block.
* @param usec micro seconds to block after the full seconds.
* @return true if the CastSink is ready to accept data,
* false otherwise.
* @exception Exception
*/
inline virtual bool
canWrite ( unsigned int sec,
unsigned int usec ) throw ( Exception )
{
return bufferedSink->canWrite( sec, usec);
return getSink()->canWrite( sec, usec);
}
/**
* Write data to the CastSink.
*
* @param buf the data to write.
* @param len number of bytes to write from buf.
* @return the number of bytes written (may be less than len).
* @exception Exception
*/
inline virtual unsigned int
write ( const void * buf,
unsigned int len ) throw ( Exception )
{
return bufferedSink->write( buf, len);
return getSink()->write( buf, len);
}
/**
* Flush all data that was written to the CastSink to the server.
*
* @exception Exception
*/
inline virtual void
flush ( void ) throw ( Exception )
{
return bufferedSink->flush();
return getSink()->flush();
}
/**
* Close the CastSink.
*
* @exception Exception
*/
inline virtual void
close ( void ) throw ( Exception )
{
return bufferedSink->close();
return getSink()->close();
}
/**
* Get the password to the server.
*
* @return the password to the server.
*/
inline const char *
getPassword ( void ) const throw ()
{
return password;
}
/**
* Get the mount point of the stream on the server.
*
* @return the mount point of the stream on the server.
*/
inline const char *
getMountPoint ( void ) const throw ()
{
return mountPoint;
}
/**
* Get the remote dump file if any.
*
* @return the remote dump file. May be NULL.
*/
inline const char *
getRemoteDumpFile ( void ) const throw ()
{
return remoteDumpFile;
}
/**
* Get the name of the stream.
*
* @return the name of the stream.
*/
inline const char *
getName ( void ) const throw ()
{
return name;
}
/**
* Get the description of the stream.
*
* @return the description of the stream.
*/
inline const char *
getDescription ( void ) const throw ()
{
return description;
}
/**
* Get the URL associated with the stream.
*
* @return the URL associated with the stream.
*/
inline const char *
getUrl ( void ) const throw ()
{
return url;
}
/**
* Get the genre of the stream.
*
* @return the genre of the stream.
*/
inline const char *
getGenre ( void ) const throw ()
{
return genre;
}
/**
* Get the bitrate of the stream (e.g. mp3 bitrate).
*
* @return the bitrate of the stream (e.g. mp3 bitrate).
*/
inline unsigned int
getBitRate ( void ) const throw ()
{
return bitRate;
}
/**
* Get wether this stream is public.
*
* @return true if the stream is public, false otherwise.
*/
inline bool
getIsPublic ( void ) const throw ()
{
return isPublic;
}
/**
* Get the duration of the BufferedSink buffer in seconds.
*
* @return the the duration of the BufferedSink buffer in seconds.
*/
inline unsigned int
getBufferDuration ( void ) const throw ()
{
@ -327,6 +516,9 @@ class CastSink : public Sink
$Source$
$Log$
Revision 1.4 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.3 2000/11/10 20:14:11 darkeye
added support for remote dump file

View File

@ -9,27 +9,21 @@
Author : $Author$
Location : $Source$
Abstract :
A class representing an external audio encoder which is invoked
with a frok() and an exec() call
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
@ -206,6 +200,9 @@ ExternalEncoder :: stop ( void ) throw ( Exception )
$Source$
$Log$
Revision 1.3 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/05 14:08:27 darkeye
changed builting to an automake / autoconf environment

View File

@ -9,27 +9,21 @@
Author : $Author$
Location : $ExternalEncoder$
Abstract :
A class representing an external audio encoder which is invoked
with a frok() and an exec() call
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
#ifndef EXTERNAL_ENCODER_H
@ -65,54 +59,123 @@
/* =============================================================== data types */
/*------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------*/
/**
* A class representing an external audio encoder which is invoked
* with a frok() and an exec() call
*
* @author $Author$
* @version $Revision$
*/
class ExternalEncoder : public AudioEncoder
{
private:
/**
* Name of the encoder (the command to invoke the encoder with).
*/
char * encoderName;
/**
* Input file parameter for the encoder.
*/
char * inFileName;
/**
* Output file parameter for the encoder.
*/
char * outFileName;
static const unsigned int numCmdArgs = 32;
/**
* Maximum number of command line arguments.
*/
static const unsigned int numCmdArgs = 64;
/**
* Array of command line arguments.
*/
char * cmdArgs[numCmdArgs];
/**
* Process ID of the encoder process.
*/
pid_t child;
/**
* Initialize the object.
*
* @param encoderName name of the encoder.
* @param inFileName input file parameter for the encoder.
* @param outFileName output file parameter for the encoder.
* @exception Exception
*/
void
init ( const char * encoderName,
const char * inFileName,
const char * outFileName ) throw ( Exception );
/**
* De-initialize the object.
*
* @exception Exception
*/
void
strip ( void ) throw ( Exception );
protected:
/**
* Default constructor. Always throws an Exception.
*
* @exception Exception
*/
inline
ExternalEncoder ( void ) throw ( Exception )
{
throw Exception( __FILE__, __LINE__);
}
/**
* Set a command line argument in the argument array.
*
* @param str the argument to set.
* @param index the place in the array to set the argument.
* @exception Exception
*/
void
setArg ( const char * str,
unsigned int index ) throw ( Exception );
/**
* Fill in the list of command line arguments. Puts a 0
* as the last in the list of args.
*
* @return the number of arguments filled.
* @exception Exception
*/
virtual unsigned int
makeArgs ( void ) throw ( Exception ) = 0;
public:
/**
* Constructor.
*
* @param encoderName name of the encoder.
* (the command to invoke the encoder with)
* @param inFileName input file parameter for the encoder.
* @param inSampleRate sample rate of the input.
* @param inBitsPerSample number of bits per sample of the input.
* @param inChannel number of channels of the input.
* @param outFileName output file parameter for the encoder.
* @param outBitrate bit rate of the output (bits/sec).
* @param outSampleRate sample rate of the output.
* If 0, inSampleRate is used.
* @param outChannel number of channels of the output.
* If 0, inChannel is used.
* @exception Exception
*/
inline
ExternalEncoder ( const char * encoderName,
const char * inFileName,
@ -135,7 +198,22 @@ class ExternalEncoder : public AudioEncoder
init ( encoderName, inFileName, outFileName );
}
/**
* Constructor.
*
* @param encoderName name of the encoder.
* (the command to invoke the encoder with)
* @param inFileName input file parameter for the encoder.
* @param as get input sample rate, bits per sample and channels
* from this AudioSource.
* @param outFileName output file parameter for the encoder.
* @param outBitrate bit rate of the output (bits/sec).
* @param outSampleRate sample rate of the output.
* If 0, input sample rate is used.
* @param outChannel number of channels of the output.
* If 0, input channel is used.
* @exception Exception
*/
inline
ExternalEncoder ( const char * encoderName,
const char * inFileName,
@ -154,7 +232,11 @@ class ExternalEncoder : public AudioEncoder
init ( encoderName, inFileName, outFileName );
}
/**
* Copy constructor.
*
* @param encoder the ExternalEncoder to copy.
*/
inline
ExternalEncoder ( const ExternalEncoder & encoder )
throw ( Exception )
@ -165,14 +247,24 @@ class ExternalEncoder : public AudioEncoder
encoder.outFileName );
}
/**
* Destructor.
*
* @exception Exception
*/
inline virtual
~ExternalEncoder ( void ) throw ( Exception )
{
strip();
}
/**
* Assignment operator.
*
* @param encoder the ExternalEncoder to assign this to.
* @return a reference to this ExternalEncoder.
* @exception Exception
*/
inline virtual ExternalEncoder &
operator= ( const ExternalEncoder & encoder ) throw ( Exception )
{
@ -187,39 +279,67 @@ class ExternalEncoder : public AudioEncoder
return *this;
}
/**
* Get the name of the encoder
* (the command to invoke the encoder with).
*
* @return the name of the encoder.
*/
const char *
getEncoderName ( void ) const throw ()
{
return encoderName;
}
/**
* Get the input file parameter for the encoder.
*
* @return the input file parameter for the encoder.
*/
const char *
getInFileName ( void ) const throw ()
{
return inFileName;
}
/**
* Get the output file parameter for the encoder.
*
* @return the output file parameter for the encoder.
*/
const char *
getOutFileName ( void ) const throw ()
{
return outFileName;
}
/**
* Check wether encoding is in progress.
*
* @return true if encoding is in progress, false otherwise.
*/
inline virtual bool
isRunning ( void ) const throw ()
{
return child != 0;
}
/**
* Start encoding. This function returns as soon as possible,
* with encoding started as a separate process in the
* background.
*
* @return true if encoding has started, false otherwise.
* @exception Exception
*/
virtual bool
start ( void ) throw ( Exception );
/**
* Stop encoding. Stops the encoding running in the background.
*
* @exception Exception
*/
virtual void
stop ( void ) throw ( Exception );
};
@ -240,6 +360,9 @@ class ExternalEncoder : public AudioEncoder
$Source$
$Log$
Revision 1.4 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.3 2000/11/05 17:37:24 darkeye
removed clone() functions

View File

@ -9,27 +9,21 @@
Author : $Author$
Location : $Source$
Abstract :
Class representing output to an IceCast server with
x-audiocast login
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
@ -192,6 +186,9 @@ IceCast :: sendLogin ( void ) throw ( Exception )
$Source$
$Log$
Revision 1.4 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.3 2000/11/10 20:14:11 darkeye
added support for remote dump file

View File

@ -9,27 +9,21 @@
Author : $Author$
Location : $Source$
Abstract :
Class representing output to an IceCast server with
x-audiocast login
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
#ifndef ICE_CAST_H
@ -55,9 +49,13 @@
/* =============================================================== data types */
/*------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------*/
/**
* Class representing output to an IceCast server with
* x-audiocast login
*
* @author $Author$
* @version $Revision$
*/
class IceCast : public CastSink
{
private:
@ -65,19 +63,46 @@ class IceCast : public CastSink
protected:
/**
* Default constructor. Always throws an Exception.
*
* @exception Exception
*/
inline
IceCast ( void ) throw ( Exception )
{
throw Exception( __FILE__, __LINE__);
}
/**
* Log in to the server using the socket avialable.
*
* @return true if login was successful, false otherwise.
* @exception Exception
*/
virtual bool
sendLogin ( void ) throw ( Exception );
public:
/**
* Constructor.
*
* @param socket socket connection to the server.
* @param password password to the server.
* @param mountPoint mount point of the stream on the server.
* @param remoteDumpFile remote dump file (may be NULL).
* @param name name of the stream.
* @param description description of the stream.
* @param url URL associated with the stream.
* @param genre genre of the stream.
* @param bitRate bitrate of the stream (e.g. mp3 bitrate).
* @param isPublic is the stream public?
* @param bufferDuration duration of the BufferedSink buffer
* in seconds.
* @exception Exception
*/
inline
IceCast ( TcpSocket * socket,
const char * password,
@ -105,20 +130,34 @@ class IceCast : public CastSink
{
}
/**
* Copy constructor.
*
* @param cs the IceCast to copy.
*/
inline
IceCast( const IceCast & cs ) throw ( Exception )
: CastSink( cs )
{
}
/**
* Destructor.
*
* @exception Exception
*/
inline virtual
~IceCast( void ) throw ( Exception )
{
}
/**
* Assignment operator.
*
* @param cs the IceCast to assign this to.
* @return a reference to this IceCast.
* @exception Exception
*/
inline virtual IceCast &
operator= ( const IceCast & cs ) throw ( Exception )
{
@ -145,6 +184,9 @@ class IceCast : public CastSink
$Source$
$Log$
Revision 1.4 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.3 2000/11/10 20:14:11 darkeye
added support for remote dump file

View File

@ -9,26 +9,21 @@
Author : $Author$
Location : $Source$
Abstract :
A class representing the lame mp3 encoder
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
@ -151,6 +146,9 @@ LameEncoder :: makeArgs ( void ) throw ( Exception )
$Source$
$Log$
Revision 1.3 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/05 14:08:28 darkeye
changed builting to an automake / autoconf environment

View File

@ -53,29 +53,58 @@
/* =============================================================== data types */
/*------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------*/
/**
* A class representing the lame mp3 encoder
*
* @author $Author$
* @version $Revision$
*/
class LameEncoder : public ExternalEncoder
{
private:
/**
* Highpass filter. Sound frequency in Hz, from where up the
* input is cut.
*/
unsigned int lowpass;
/**
* Lowpass filter. Sound frequency in Hz, from where down the
* input is cut.
*/
unsigned int highpass;
protected:
/**
* Fill in the list of command line arguments. Puts a 0
* as the last in the list of args.
*
* @return the number of arguments filled.
* @exception Exception
*/
virtual unsigned int
makeArgs ( void ) throw ( Exception );
/**
* Default constructor. Always throws an Exception.
*
* @exception Exception
*/
inline
LameEncoder ( void ) throw ( Exception )
{
throw Exception( __FILE__, __LINE__);
}
/**
* Initialize the object.
*
* @param lowpass lowpass filter range.
* @param highpass highpass filter range.
* @exception Exception
*/
inline void
init ( unsigned int lowpass,
unsigned int highpass ) throw ( Exception )
@ -84,7 +113,11 @@ class LameEncoder : public ExternalEncoder
this->highpass = highpass;
}
/**
* De-initialize the object.
*
* @exception Exception
*/
inline void
strip ( void ) throw ( Exception )
{
@ -93,6 +126,31 @@ class LameEncoder : public ExternalEncoder
public:
/**
* Constructor.
*
* @param encoderName name of the encoder.
* (the command to invoke the encoder with)
* @param inFileName input file parameter for the encoder.
* @param inSampleRate sample rate of the input.
* @param inBitsPerSample number of bits per sample of the input.
* @param inChannel number of channels of the input.
* @param outFileName output file parameter for the encoder.
* @param outBitrate bit rate of the output (bits/sec).
* @param outSampleRate sample rate of the output.
* If 0, inSampleRate is used.
* @param outChannel number of channels of the output.
* If 0, inChannel is used.
* @param lowpass frequency threshold for the lowpass filter.
* Input above this frequency is cut.
* If 0, lame's default values are used,
* which depends on the out sample rate.
* @param highpass frequency threshold for the highpass filter.
* Input below this frequency is cut.
* If 0, lame's default values are used,
* which depends on the out sample rate.
* @exception Exception
*/
inline
LameEncoder ( const char * encoderName,
const char * inFileName,
@ -120,7 +178,30 @@ class LameEncoder : public ExternalEncoder
init( lowpass, highpass);
}
/**
* Constructor.
*
* @param encoderName name of the encoder.
* (the command to invoke the encoder with)
* @param inFileName input file parameter for the encoder.
* @param as get input sample rate, bits per sample and channels
* from this AudioSource.
* @param outFileName output file parameter for the encoder.
* @param outBitrate bit rate of the output (bits/sec).
* @param outSampleRate sample rate of the output.
* If 0, inSampleRate is used.
* @param outChannel number of channels of the output.
* If 0, inChannel is used.
* @param lowpass frequency threshold for the lowpass filter.
* Input above this frequency is cut.
* If 0, lame's default values are used,
* which depends on the out sample rate.
* @param highpass frequency threshold for the highpass filter.
* Input below this frequency is cut.
* If 0, lame's default values are used,
* which depends on the out sample rate.
* @exception Exception
*/
inline
LameEncoder ( const char * encoderName,
const char * inFileName,
@ -144,7 +225,11 @@ class LameEncoder : public ExternalEncoder
init( lowpass, highpass);
}
/**
* Copy constructor.
*
* @param encoder the LameEncoder to copy.
*/
inline
LameEncoder ( const LameEncoder & encoder ) throw ( Exception )
: ExternalEncoder( encoder )
@ -152,14 +237,24 @@ class LameEncoder : public ExternalEncoder
init( encoder.lowpass, encoder.highpass);
}
/**
* Destructor.
*
* @exception Exception
*/
inline virtual
~LameEncoder ( void ) throw ( Exception )
{
strip();
}
/**
* Assignment operator.
*
* @param encoder the LameEncoder to assign this to.
* @return a reference to this LameEncoder.
* @exception Exception
*/
inline virtual LameEncoder &
operator= ( const LameEncoder & encoder ) throw ( Exception )
{
@ -172,14 +267,26 @@ class LameEncoder : public ExternalEncoder
return *this;
}
/**
* Get the lowpass filter threshold. Sound frequency in Hz,
* from where up the input is cut.
*
* @return the lowpass filter threshold.
*/
inline unsigned int
getLowpass ( void ) const throw ()
{
return lowpass;
}
/**
* Set the lowpass filter threshold. Sound frequency in Hz,
* from where up the input is cut.
* Can be only set if encoding is not in progress.
*
* @param lowpass the lowpass filter threshold.
* @return if setting is successful.
*/
inline bool
setLowpass ( unsigned int lowpass ) throw ()
{
@ -191,14 +298,26 @@ class LameEncoder : public ExternalEncoder
}
}
/**
* Get the highpass filter threshold. Sound frequency in Hz,
* from where down the input is cut.
*
* @return the highpass filter threshold.
*/
inline unsigned int
getHighpass ( void ) const throw ()
{
return highpass;
}
/**
* Set the highpass filter threshold. Sound frequency in Hz,
* from where down the input is cut.
* Can be only set if encoding is not in progress.
*
* @param highpass the highpass filter threshold.
* @return if setting is successful.
*/
inline bool
setHighpass ( unsigned int highpass ) throw ()
{
@ -229,6 +348,9 @@ class LameEncoder : public ExternalEncoder
$Source$
$Log$
Revision 1.3 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/05 17:37:24 darkeye
removed clone() functions

View File

@ -9,26 +9,21 @@
Author : $Author$
Location : $Source$
Abstract :
A TCP network socket
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
@ -353,6 +348,9 @@ TcpSocket :: close ( void ) throw ( Exception )
$Source$
$Log$
Revision 1.3 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/05 14:08:28 darkeye
changed builting to an automake / autoconf environment

View File

@ -9,26 +9,21 @@
Author : $Author$
Location : $Source$
Abstract :
A TCP network socket
Copyright notice:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------*/
#ifndef TCP_SOCKET_H
@ -53,29 +48,58 @@
/* =============================================================== data types */
/*------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------*/
/**
* A TCP network socket
*
* @author $Author$
* @version $Revision$
*/
class TcpSocket : public Source, public Sink
{
private:
/**
* Name of the host this socket connects to.
*/
char * host;
/**
* Port to connect to.
*/
unsigned short port;
/**
* Low-level socket descriptor.
*/
int sockfd;
/**
* Initialize the object.
*
* @param host name of the host this socket connects to.
* @param port port to connect to.
* @exception Exception
*/
void
init ( const char * host,
unsigned short port ) throw ( Exception );
/**
* De-initialize the object.
*
* @exception Exception
*/
void
strip ( void ) throw ( Exception );
protected:
/**
* Default constructor. Always throws an Exception.
*
* @exception Exception
*/
inline
TcpSocket ( void ) throw ( Exception )
{
@ -85,79 +109,160 @@ class TcpSocket : public Source, public Sink
public:
/**
* Constructor.
*
* @param host name of the host this socket connects to.
* @param port port to connect to.
* @exception Exception
*/
inline
TcpSocket( const char * host,
unsigned short port ) throw ( Exception )
unsigned short port ) throw ( Exception )
{
init( host, port);
}
/**
* Copy constructor.
*
* @param ss the TcpSocket to copy.
* @exception Exception
*/
TcpSocket( const TcpSocket & ss ) throw ( Exception );
/**
* Destructor.
*
* @exception Exception
*/
inline virtual
~TcpSocket( void ) throw ( Exception )
{
strip();
}
/**
* Assignment operator.
*
* @param ss the TcpSocket to assign this to.
* @return a reference to this TcpSocket.
* @exception Exception
*/
inline virtual TcpSocket &
operator= ( const TcpSocket & ss ) throw ( Exception );
/**
* Get the host this socket connects to.
*
* @return the host this socket connects to.
*/
inline const char *
getHost ( void ) const throw ()
{
return host;
}
/**
* Get the port this socket connects to.
*
* @return the port this socket connects to.
*/
inline unsigned int
getPort ( void ) const throw ()
{
return port;
}
/**
* Open the TcpSocket.
*
* @return true if opening was successfull, false otherwise.
* @exception Exception
*/
virtual bool
open ( void ) throw ( Exception );
/**
* Check if the TcpSocket is open.
*
* @return true if the TcpSocket is open, false otherwise.
*/
inline virtual bool
isOpen ( void ) const throw ()
{
return sockfd != 0;
}
/**
* Check if the TcpScoket can be read from.
* Blocks until the specified time for data to be available.
*
* @param sec the maximum seconds to block.
* @param usec micro seconds to block after the full seconds.
* @return true if the TcpSocket is ready to be read from,
* false otherwise.
* @exception Exception
*/
virtual bool
canRead ( unsigned int sec,
unsigned int usec ) throw ( Exception );
/**
* Read from the TcpSocket.
*
* @param buf the buffer to read into.
* @param len the number of bytes to read into buf
* @return the number of bytes read (may be less than len).
* @exception Exception
*/
virtual unsigned int
read ( void * buf,
unsigned int len ) throw ( Exception );
/**
* Check if the TcpSocket is ready to accept data.
* Blocks until the specified time for data to be available.
*
* @param sec the maximum seconds to block.
* @param usec micro seconds to block after the full seconds.
* @return true if the TcpSocket is ready to accept data,
* false otherwise.
* @exception Exception
*/
virtual bool
canWrite ( unsigned int sec,
unsigned int usec ) throw ( Exception );
/**
* Write data to the TcpSocket.
*
* @param buf the data to write.
* @param len number of bytes to write from buf.
* @return the number of bytes written (may be less than len).
* @exception Exception
*/
virtual unsigned int
write ( const void * buf,
unsigned int len ) throw ( Exception );
/**
* Flush all data that was written to the TcpSocket to the underlying
* connection.
*
* @exception Exception
*/
inline virtual void
flush ( void ) throw ( Exception )
{
}
/**
* Close the TcpSocket.
*
* @exception Exception
*/
virtual void
close ( void ) throw ( Exception );
};
@ -178,6 +283,9 @@ class TcpSocket : public Source, public Sink
$Source$
$Log$
Revision 1.3 2000/11/12 14:54:50 darkeye
added kdoc-style documentation comments
Revision 1.2 2000/11/05 17:37:24 darkeye
removed clone() functions