added kdoc-style documentation comments
This commit is contained in:
parent
456010f03f
commit
e3323d4da7
|
@ -9,26 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $AudioEncoder$
|
Location : $AudioEncoder$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
An audio encoder
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
#ifndef AUDIO_ENCODER_H
|
#ifndef AUDIO_ENCODER_H
|
||||||
|
@ -53,22 +48,57 @@
|
||||||
|
|
||||||
/* =============================================================== data types */
|
/* =============================================================== data types */
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/**
|
||||||
*
|
* An audio encoder
|
||||||
*----------------------------------------------------------------------------*/
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
class AudioEncoder : public virtual Referable
|
class AudioEncoder : public virtual Referable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sample rate of the input.
|
||||||
|
*/
|
||||||
unsigned int inSampleRate;
|
unsigned int inSampleRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of bits per sample of the input.
|
||||||
|
*/
|
||||||
unsigned int inBitsPerSample;
|
unsigned int inBitsPerSample;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of channels of the input.
|
||||||
|
*/
|
||||||
unsigned int inChannel;
|
unsigned int inChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bit rate of the output. (bits/sec)
|
||||||
|
*/
|
||||||
unsigned int outBitrate;
|
unsigned int outBitrate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sample rate of the output.
|
||||||
|
*/
|
||||||
unsigned int outSampleRate;
|
unsigned int outSampleRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of channels of the output.
|
||||||
|
*/
|
||||||
unsigned int outChannel;
|
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
|
inline void
|
||||||
init ( unsigned int inSampleRate,
|
init ( unsigned int inSampleRate,
|
||||||
unsigned int inBitsPerSample,
|
unsigned int inBitsPerSample,
|
||||||
|
@ -85,7 +115,11 @@ class AudioEncoder : public virtual Referable
|
||||||
this->outChannel = outChannel;
|
this->outChannel = outChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-iitialize the object.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline void
|
inline void
|
||||||
strip ( void ) throw ( Exception )
|
strip ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -94,13 +128,30 @@ class AudioEncoder : public virtual Referable
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor. Always throws an Exception.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
AudioEncoder ( void ) throw ( Exception )
|
AudioEncoder ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
throw Exception( __FILE__, __LINE__);
|
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
|
inline
|
||||||
AudioEncoder ( unsigned int inSampleRate,
|
AudioEncoder ( unsigned int inSampleRate,
|
||||||
unsigned int inBitsPerSample,
|
unsigned int inBitsPerSample,
|
||||||
|
@ -118,7 +169,18 @@ class AudioEncoder : public virtual Referable
|
||||||
outChannel ? outChannel : inChannel );
|
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
|
inline
|
||||||
AudioEncoder ( const AudioSource * as,
|
AudioEncoder ( const AudioSource * as,
|
||||||
unsigned int outBitrate,
|
unsigned int outBitrate,
|
||||||
|
@ -134,7 +196,11 @@ class AudioEncoder : public virtual Referable
|
||||||
outChannel ? outChannel : as->getChannel() );
|
outChannel ? outChannel : as->getChannel() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor.
|
||||||
|
*
|
||||||
|
* @param encoder the AudioEncoder to copy.
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
AudioEncoder ( const AudioEncoder & encoder ) throw ( Exception )
|
AudioEncoder ( const AudioEncoder & encoder ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -146,7 +212,13 @@ class AudioEncoder : public virtual Referable
|
||||||
encoder.outChannel );
|
encoder.outChannel );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assignment operator.
|
||||||
|
*
|
||||||
|
* @param encoder the AudioEncoder to assign this to.
|
||||||
|
* @return a reference to this AudioEncoder.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual AudioEncoder &
|
inline virtual AudioEncoder &
|
||||||
operator= ( const AudioEncoder & encoder ) throw ( Exception )
|
operator= ( const AudioEncoder & encoder ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -167,63 +239,106 @@ class AudioEncoder : public virtual Referable
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual
|
inline virtual
|
||||||
~AudioEncoder ( void ) throw ( Exception )
|
~AudioEncoder ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
strip();
|
strip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of channels of the input.
|
||||||
|
*
|
||||||
|
* @return the number of channels of the input.
|
||||||
|
*/
|
||||||
inline int
|
inline int
|
||||||
getInChannel ( void ) const throw ()
|
getInChannel ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return inChannel;
|
return inChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the sample rate of the input.
|
||||||
|
*
|
||||||
|
* @return the sample rate of the input.
|
||||||
|
*/
|
||||||
inline int
|
inline int
|
||||||
getInSampleRate ( void ) const throw ()
|
getInSampleRate ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return inSampleRate;
|
return inSampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of bits per sample of the input.
|
||||||
|
*
|
||||||
|
* @return the number of bits per sample of the input.
|
||||||
|
*/
|
||||||
inline int
|
inline int
|
||||||
getInBitsPerSample ( void ) const throw ()
|
getInBitsPerSample ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return inBitsPerSample;
|
return inBitsPerSample;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of channels of the output.
|
||||||
|
*
|
||||||
|
* @return the number of channels of the output.
|
||||||
|
*/
|
||||||
inline int
|
inline int
|
||||||
getOutChannel ( void ) const throw ()
|
getOutChannel ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return outChannel;
|
return outChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the sample rate of the output.
|
||||||
|
*
|
||||||
|
* @return the sample rate of the output.
|
||||||
|
*/
|
||||||
inline int
|
inline int
|
||||||
getOutSampleRate ( void ) const throw ()
|
getOutSampleRate ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return outSampleRate;
|
return outSampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the bit rate of the output. (bits/sec)
|
||||||
|
*
|
||||||
|
* @return the bit rate of the output.
|
||||||
|
*/
|
||||||
inline int
|
inline int
|
||||||
getOutBitrate ( void ) const throw ()
|
getOutBitrate ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return outBitrate;
|
return outBitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check wether encoding is in progress.
|
||||||
|
*
|
||||||
|
* @return true if encoding is in progress, false otherwise.
|
||||||
|
*/
|
||||||
virtual bool
|
virtual bool
|
||||||
isRunning ( void ) const throw () = 0;
|
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
|
virtual bool
|
||||||
start ( void ) throw ( Exception ) = 0;
|
start ( void ) throw ( Exception ) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop encoding. Stops the encoding running in the background.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
stop ( void ) throw ( Exception ) = 0;
|
stop ( void ) throw ( Exception ) = 0;
|
||||||
};
|
};
|
||||||
|
@ -244,8 +359,11 @@ class AudioEncoder : public virtual Referable
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 2000/11/05 10:05:47 darkeye
|
Revision 1.2 2000/11/12 14:54:50 darkeye
|
||||||
Initial revision
|
added kdoc-style documentation comments
|
||||||
|
|
||||||
|
Revision 1.1.1.1 2000/11/05 10:05:47 darkeye
|
||||||
|
initial version
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -9,26 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $Source$
|
Location : $Source$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
Data output to a ShoutCast / IceCast / etc. server
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -141,6 +136,9 @@ CastSink :: open ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.2 2000/11/10 20:14:11 darkeye
|
||||||
added support for remote dump file
|
added support for remote dump file
|
||||||
|
|
||||||
|
|
|
@ -9,26 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $Source$
|
Location : $Source$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
Data output to a ShoutCast / IceCast / etc. server
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
#ifndef CAST_SINK_H
|
#ifndef CAST_SINK_H
|
||||||
|
@ -55,28 +50,95 @@
|
||||||
|
|
||||||
/* =============================================================== data types */
|
/* =============================================================== 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
|
class CastSink : public Sink
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The socket connection to the server.
|
||||||
|
*/
|
||||||
Ref<TcpSocket> socket;
|
Ref<TcpSocket> socket;
|
||||||
Ref<BufferedSink> bufferedSink;
|
|
||||||
char * password;
|
|
||||||
char * mountPoint;
|
|
||||||
char * remoteDumpFile;
|
|
||||||
|
|
||||||
char * name;
|
/**
|
||||||
char * description;
|
* The BufferedSink encapsulating the socket connection to the server.
|
||||||
char * url;
|
*/
|
||||||
char * genre;
|
Ref<BufferedSink> bufferedSink;
|
||||||
unsigned int bitRate;
|
|
||||||
bool isPublic;
|
/**
|
||||||
|
* Duration of the BufferedSink buffer in seconds.
|
||||||
|
*/
|
||||||
unsigned int bufferDuration;
|
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
|
void
|
||||||
init ( TcpSocket * socket,
|
init ( TcpSocket * socket,
|
||||||
const char * password,
|
const char * password,
|
||||||
|
@ -91,26 +153,79 @@ class CastSink : public Sink
|
||||||
unsigned int bufferDuration )
|
unsigned int bufferDuration )
|
||||||
throw ( Exception );
|
throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-initalize the object.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
strip ( void ) throw ( Exception );
|
strip ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor. Always throws an Exception.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
CastSink ( void ) throw ( Exception )
|
CastSink ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
throw Exception( __FILE__, __LINE__);
|
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
|
virtual bool
|
||||||
sendLogin ( void ) throw ( Exception ) = 0;
|
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:
|
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
|
inline
|
||||||
CastSink ( TcpSocket * socket,
|
CastSink ( TcpSocket * socket,
|
||||||
const char * password,
|
const char * password,
|
||||||
|
@ -138,7 +253,11 @@ class CastSink : public Sink
|
||||||
bufferDuration );
|
bufferDuration );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor.
|
||||||
|
*
|
||||||
|
* @param cs the CastSink to copy.
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
CastSink( const CastSink & cs ) throw ( Exception )
|
CastSink( const CastSink & cs ) throw ( Exception )
|
||||||
: Sink( cs )
|
: Sink( cs )
|
||||||
|
@ -156,14 +275,24 @@ class CastSink : public Sink
|
||||||
cs.bufferDuration );
|
cs.bufferDuration );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual
|
inline virtual
|
||||||
~CastSink( void ) throw ( Exception )
|
~CastSink( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
strip();
|
strip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assignment operator.
|
||||||
|
*
|
||||||
|
* @param cs the CastSink to assign this to.
|
||||||
|
* @return a reference to this CastSink.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual CastSink &
|
inline virtual CastSink &
|
||||||
operator= ( const CastSink & cs ) throw ( Exception )
|
operator= ( const CastSink & cs ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -185,125 +314,185 @@ class CastSink : public Sink
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
inline Sink *
|
* Open the CastSink.
|
||||||
getSink ( void ) const throw ()
|
* Logs in to the server.
|
||||||
{
|
*
|
||||||
return bufferedSink.get();
|
* @return true if opening was successfull, false otherwise.
|
||||||
}
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
|
||||||
inline TcpSocket *
|
|
||||||
getSocket ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return socket.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
open ( void ) throw ( Exception );
|
open ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the CastSink is open.
|
||||||
|
*
|
||||||
|
* @return true if the CastSink is open, false otherwise.
|
||||||
|
*/
|
||||||
inline virtual bool
|
inline virtual bool
|
||||||
isOpen ( void ) const throw ()
|
isOpen ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return bufferedSink->isOpen();
|
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
|
inline virtual bool
|
||||||
canWrite ( unsigned int sec,
|
canWrite ( unsigned int sec,
|
||||||
unsigned int usec ) throw ( Exception )
|
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
|
inline virtual unsigned int
|
||||||
write ( const void * buf,
|
write ( const void * buf,
|
||||||
unsigned int len ) throw ( Exception )
|
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
|
inline virtual void
|
||||||
flush ( void ) throw ( Exception )
|
flush ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
return bufferedSink->flush();
|
return getSink()->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the CastSink.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual void
|
inline virtual void
|
||||||
close ( void ) throw ( Exception )
|
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 *
|
inline const char *
|
||||||
getPassword ( void ) const throw ()
|
getPassword ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return password;
|
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 *
|
inline const char *
|
||||||
getMountPoint ( void ) const throw ()
|
getMountPoint ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return mountPoint;
|
return mountPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the remote dump file if any.
|
||||||
|
*
|
||||||
|
* @return the remote dump file. May be NULL.
|
||||||
|
*/
|
||||||
inline const char *
|
inline const char *
|
||||||
getRemoteDumpFile ( void ) const throw ()
|
getRemoteDumpFile ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return remoteDumpFile;
|
return remoteDumpFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the stream.
|
||||||
|
*
|
||||||
|
* @return the name of the stream.
|
||||||
|
*/
|
||||||
inline const char *
|
inline const char *
|
||||||
getName ( void ) const throw ()
|
getName ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the description of the stream.
|
||||||
|
*
|
||||||
|
* @return the description of the stream.
|
||||||
|
*/
|
||||||
inline const char *
|
inline const char *
|
||||||
getDescription ( void ) const throw ()
|
getDescription ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the URL associated with the stream.
|
||||||
|
*
|
||||||
|
* @return the URL associated with the stream.
|
||||||
|
*/
|
||||||
inline const char *
|
inline const char *
|
||||||
getUrl ( void ) const throw ()
|
getUrl ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the genre of the stream.
|
||||||
|
*
|
||||||
|
* @return the genre of the stream.
|
||||||
|
*/
|
||||||
inline const char *
|
inline const char *
|
||||||
getGenre ( void ) const throw ()
|
getGenre ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return genre;
|
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
|
inline unsigned int
|
||||||
getBitRate ( void ) const throw ()
|
getBitRate ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return bitRate;
|
return bitRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get wether this stream is public.
|
||||||
|
*
|
||||||
|
* @return true if the stream is public, false otherwise.
|
||||||
|
*/
|
||||||
inline bool
|
inline bool
|
||||||
getIsPublic ( void ) const throw ()
|
getIsPublic ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return isPublic;
|
return isPublic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the duration of the BufferedSink buffer in seconds.
|
||||||
|
*
|
||||||
|
* @return the the duration of the BufferedSink buffer in seconds.
|
||||||
|
*/
|
||||||
inline unsigned int
|
inline unsigned int
|
||||||
getBufferDuration ( void ) const throw ()
|
getBufferDuration ( void ) const throw ()
|
||||||
{
|
{
|
||||||
|
@ -327,6 +516,9 @@ class CastSink : public Sink
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.3 2000/11/10 20:14:11 darkeye
|
||||||
added support for remote dump file
|
added support for remote dump file
|
||||||
|
|
||||||
|
|
|
@ -9,27 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $Source$
|
Location : $Source$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
A class representing an external audio encoder which is invoked
|
|
||||||
with a frok() and an exec() call
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -206,6 +200,9 @@ ExternalEncoder :: stop ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.2 2000/11/05 14:08:27 darkeye
|
||||||
changed builting to an automake / autoconf environment
|
changed builting to an automake / autoconf environment
|
||||||
|
|
||||||
|
|
|
@ -9,27 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $ExternalEncoder$
|
Location : $ExternalEncoder$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
A class representing an external audio encoder which is invoked
|
|
||||||
with a frok() and an exec() call
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
#ifndef EXTERNAL_ENCODER_H
|
#ifndef EXTERNAL_ENCODER_H
|
||||||
|
@ -65,54 +59,123 @@
|
||||||
|
|
||||||
/* =============================================================== data types */
|
/* =============================================================== 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
|
class ExternalEncoder : public AudioEncoder
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the encoder (the command to invoke the encoder with).
|
||||||
|
*/
|
||||||
char * encoderName;
|
char * encoderName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Input file parameter for the encoder.
|
||||||
|
*/
|
||||||
char * inFileName;
|
char * inFileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output file parameter for the encoder.
|
||||||
|
*/
|
||||||
char * outFileName;
|
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];
|
char * cmdArgs[numCmdArgs];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process ID of the encoder process.
|
||||||
|
*/
|
||||||
pid_t child;
|
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
|
void
|
||||||
init ( const char * encoderName,
|
init ( const char * encoderName,
|
||||||
const char * inFileName,
|
const char * inFileName,
|
||||||
const char * outFileName ) throw ( Exception );
|
const char * outFileName ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-initialize the object.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
strip ( void ) throw ( Exception );
|
strip ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor. Always throws an Exception.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
ExternalEncoder ( void ) throw ( Exception )
|
ExternalEncoder ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
throw Exception( __FILE__, __LINE__);
|
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
|
void
|
||||||
setArg ( const char * str,
|
setArg ( const char * str,
|
||||||
unsigned int index ) throw ( Exception );
|
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
|
virtual unsigned int
|
||||||
makeArgs ( void ) throw ( Exception ) = 0;
|
makeArgs ( void ) throw ( Exception ) = 0;
|
||||||
|
|
||||||
|
|
||||||
public:
|
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
|
inline
|
||||||
ExternalEncoder ( const char * encoderName,
|
ExternalEncoder ( const char * encoderName,
|
||||||
const char * inFileName,
|
const char * inFileName,
|
||||||
|
@ -135,7 +198,22 @@ class ExternalEncoder : public AudioEncoder
|
||||||
init ( encoderName, inFileName, outFileName );
|
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
|
inline
|
||||||
ExternalEncoder ( const char * encoderName,
|
ExternalEncoder ( const char * encoderName,
|
||||||
const char * inFileName,
|
const char * inFileName,
|
||||||
|
@ -154,7 +232,11 @@ class ExternalEncoder : public AudioEncoder
|
||||||
init ( encoderName, inFileName, outFileName );
|
init ( encoderName, inFileName, outFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor.
|
||||||
|
*
|
||||||
|
* @param encoder the ExternalEncoder to copy.
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
ExternalEncoder ( const ExternalEncoder & encoder )
|
ExternalEncoder ( const ExternalEncoder & encoder )
|
||||||
throw ( Exception )
|
throw ( Exception )
|
||||||
|
@ -165,14 +247,24 @@ class ExternalEncoder : public AudioEncoder
|
||||||
encoder.outFileName );
|
encoder.outFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual
|
inline virtual
|
||||||
~ExternalEncoder ( void ) throw ( Exception )
|
~ExternalEncoder ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
strip();
|
strip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assignment operator.
|
||||||
|
*
|
||||||
|
* @param encoder the ExternalEncoder to assign this to.
|
||||||
|
* @return a reference to this ExternalEncoder.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual ExternalEncoder &
|
inline virtual ExternalEncoder &
|
||||||
operator= ( const ExternalEncoder & encoder ) throw ( Exception )
|
operator= ( const ExternalEncoder & encoder ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -187,39 +279,67 @@ class ExternalEncoder : public AudioEncoder
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the encoder
|
||||||
|
* (the command to invoke the encoder with).
|
||||||
|
*
|
||||||
|
* @return the name of the encoder.
|
||||||
|
*/
|
||||||
const char *
|
const char *
|
||||||
getEncoderName ( void ) const throw ()
|
getEncoderName ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return encoderName;
|
return encoderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the input file parameter for the encoder.
|
||||||
|
*
|
||||||
|
* @return the input file parameter for the encoder.
|
||||||
|
*/
|
||||||
const char *
|
const char *
|
||||||
getInFileName ( void ) const throw ()
|
getInFileName ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return inFileName;
|
return inFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the output file parameter for the encoder.
|
||||||
|
*
|
||||||
|
* @return the output file parameter for the encoder.
|
||||||
|
*/
|
||||||
const char *
|
const char *
|
||||||
getOutFileName ( void ) const throw ()
|
getOutFileName ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return outFileName;
|
return outFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check wether encoding is in progress.
|
||||||
|
*
|
||||||
|
* @return true if encoding is in progress, false otherwise.
|
||||||
|
*/
|
||||||
inline virtual bool
|
inline virtual bool
|
||||||
isRunning ( void ) const throw ()
|
isRunning ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return child != 0;
|
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
|
virtual bool
|
||||||
start ( void ) throw ( Exception );
|
start ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop encoding. Stops the encoding running in the background.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
stop ( void ) throw ( Exception );
|
stop ( void ) throw ( Exception );
|
||||||
};
|
};
|
||||||
|
@ -240,6 +360,9 @@ class ExternalEncoder : public AudioEncoder
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.3 2000/11/05 17:37:24 darkeye
|
||||||
removed clone() functions
|
removed clone() functions
|
||||||
|
|
||||||
|
|
|
@ -9,27 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $Source$
|
Location : $Source$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
Class representing output to an IceCast server with
|
|
||||||
x-audiocast login
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -192,6 +186,9 @@ IceCast :: sendLogin ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.3 2000/11/10 20:14:11 darkeye
|
||||||
added support for remote dump file
|
added support for remote dump file
|
||||||
|
|
||||||
|
|
|
@ -9,27 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $Source$
|
Location : $Source$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
Class representing output to an IceCast server with
|
|
||||||
x-audiocast login
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
#ifndef ICE_CAST_H
|
#ifndef ICE_CAST_H
|
||||||
|
@ -55,9 +49,13 @@
|
||||||
|
|
||||||
/* =============================================================== data types */
|
/* =============================================================== data types */
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/**
|
||||||
*
|
* Class representing output to an IceCast server with
|
||||||
*----------------------------------------------------------------------------*/
|
* x-audiocast login
|
||||||
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
class IceCast : public CastSink
|
class IceCast : public CastSink
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -65,19 +63,46 @@ class IceCast : public CastSink
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor. Always throws an Exception.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
IceCast ( void ) throw ( Exception )
|
IceCast ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
throw Exception( __FILE__, __LINE__);
|
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
|
virtual bool
|
||||||
sendLogin ( void ) throw ( Exception );
|
sendLogin ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
|
||||||
public:
|
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
|
inline
|
||||||
IceCast ( TcpSocket * socket,
|
IceCast ( TcpSocket * socket,
|
||||||
const char * password,
|
const char * password,
|
||||||
|
@ -105,20 +130,34 @@ class IceCast : public CastSink
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor.
|
||||||
|
*
|
||||||
|
* @param cs the IceCast to copy.
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
IceCast( const IceCast & cs ) throw ( Exception )
|
IceCast( const IceCast & cs ) throw ( Exception )
|
||||||
: CastSink( cs )
|
: CastSink( cs )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual
|
inline virtual
|
||||||
~IceCast( void ) throw ( Exception )
|
~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 &
|
inline virtual IceCast &
|
||||||
operator= ( const IceCast & cs ) throw ( Exception )
|
operator= ( const IceCast & cs ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -145,6 +184,9 @@ class IceCast : public CastSink
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.3 2000/11/10 20:14:11 darkeye
|
||||||
added support for remote dump file
|
added support for remote dump file
|
||||||
|
|
||||||
|
|
|
@ -9,26 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $Source$
|
Location : $Source$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
A class representing the lame mp3 encoder
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -151,6 +146,9 @@ LameEncoder :: makeArgs ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.2 2000/11/05 14:08:28 darkeye
|
||||||
changed builting to an automake / autoconf environment
|
changed builting to an automake / autoconf environment
|
||||||
|
|
||||||
|
|
|
@ -53,29 +53,58 @@
|
||||||
|
|
||||||
/* =============================================================== data types */
|
/* =============================================================== data types */
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/**
|
||||||
*
|
* A class representing the lame mp3 encoder
|
||||||
*----------------------------------------------------------------------------*/
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
class LameEncoder : public ExternalEncoder
|
class LameEncoder : public ExternalEncoder
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Highpass filter. Sound frequency in Hz, from where up the
|
||||||
|
* input is cut.
|
||||||
|
*/
|
||||||
unsigned int lowpass;
|
unsigned int lowpass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lowpass filter. Sound frequency in Hz, from where down the
|
||||||
|
* input is cut.
|
||||||
|
*/
|
||||||
unsigned int highpass;
|
unsigned int highpass;
|
||||||
|
|
||||||
protected:
|
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
|
virtual unsigned int
|
||||||
makeArgs ( void ) throw ( Exception );
|
makeArgs ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor. Always throws an Exception.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
LameEncoder ( void ) throw ( Exception )
|
LameEncoder ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
throw Exception( __FILE__, __LINE__);
|
throw Exception( __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the object.
|
||||||
|
*
|
||||||
|
* @param lowpass lowpass filter range.
|
||||||
|
* @param highpass highpass filter range.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline void
|
inline void
|
||||||
init ( unsigned int lowpass,
|
init ( unsigned int lowpass,
|
||||||
unsigned int highpass ) throw ( Exception )
|
unsigned int highpass ) throw ( Exception )
|
||||||
|
@ -84,7 +113,11 @@ class LameEncoder : public ExternalEncoder
|
||||||
this->highpass = highpass;
|
this->highpass = highpass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-initialize the object.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline void
|
inline void
|
||||||
strip ( void ) throw ( Exception )
|
strip ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -93,6 +126,31 @@ class LameEncoder : public ExternalEncoder
|
||||||
|
|
||||||
public:
|
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
|
inline
|
||||||
LameEncoder ( const char * encoderName,
|
LameEncoder ( const char * encoderName,
|
||||||
const char * inFileName,
|
const char * inFileName,
|
||||||
|
@ -120,7 +178,30 @@ class LameEncoder : public ExternalEncoder
|
||||||
init( lowpass, highpass);
|
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
|
inline
|
||||||
LameEncoder ( const char * encoderName,
|
LameEncoder ( const char * encoderName,
|
||||||
const char * inFileName,
|
const char * inFileName,
|
||||||
|
@ -144,7 +225,11 @@ class LameEncoder : public ExternalEncoder
|
||||||
init( lowpass, highpass);
|
init( lowpass, highpass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor.
|
||||||
|
*
|
||||||
|
* @param encoder the LameEncoder to copy.
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
LameEncoder ( const LameEncoder & encoder ) throw ( Exception )
|
LameEncoder ( const LameEncoder & encoder ) throw ( Exception )
|
||||||
: ExternalEncoder( encoder )
|
: ExternalEncoder( encoder )
|
||||||
|
@ -152,14 +237,24 @@ class LameEncoder : public ExternalEncoder
|
||||||
init( encoder.lowpass, encoder.highpass);
|
init( encoder.lowpass, encoder.highpass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual
|
inline virtual
|
||||||
~LameEncoder ( void ) throw ( Exception )
|
~LameEncoder ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
strip();
|
strip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assignment operator.
|
||||||
|
*
|
||||||
|
* @param encoder the LameEncoder to assign this to.
|
||||||
|
* @return a reference to this LameEncoder.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual LameEncoder &
|
inline virtual LameEncoder &
|
||||||
operator= ( const LameEncoder & encoder ) throw ( Exception )
|
operator= ( const LameEncoder & encoder ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -172,14 +267,26 @@ class LameEncoder : public ExternalEncoder
|
||||||
return *this;
|
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
|
inline unsigned int
|
||||||
getLowpass ( void ) const throw ()
|
getLowpass ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return lowpass;
|
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
|
inline bool
|
||||||
setLowpass ( unsigned int lowpass ) throw ()
|
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
|
inline unsigned int
|
||||||
getHighpass ( void ) const throw ()
|
getHighpass ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return highpass;
|
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
|
inline bool
|
||||||
setHighpass ( unsigned int highpass ) throw ()
|
setHighpass ( unsigned int highpass ) throw ()
|
||||||
{
|
{
|
||||||
|
@ -229,6 +348,9 @@ class LameEncoder : public ExternalEncoder
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.2 2000/11/05 17:37:24 darkeye
|
||||||
removed clone() functions
|
removed clone() functions
|
||||||
|
|
||||||
|
|
|
@ -9,26 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $Source$
|
Location : $Source$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
A TCP network socket
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -353,6 +348,9 @@ TcpSocket :: close ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.2 2000/11/05 14:08:28 darkeye
|
||||||
changed builting to an automake / autoconf environment
|
changed builting to an automake / autoconf environment
|
||||||
|
|
||||||
|
|
|
@ -9,26 +9,21 @@
|
||||||
Author : $Author$
|
Author : $Author$
|
||||||
Location : $Source$
|
Location : $Source$
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
A TCP network socket
|
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
as published by the Free Software Foundation; either version 2
|
as published by the Free Software Foundation; either version 2
|
||||||
of the License, or (at your option) any later version.
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
#ifndef TCP_SOCKET_H
|
#ifndef TCP_SOCKET_H
|
||||||
|
@ -53,29 +48,58 @@
|
||||||
|
|
||||||
/* =============================================================== data types */
|
/* =============================================================== data types */
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/**
|
||||||
*
|
* A TCP network socket
|
||||||
*----------------------------------------------------------------------------*/
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
class TcpSocket : public Source, public Sink
|
class TcpSocket : public Source, public Sink
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the host this socket connects to.
|
||||||
|
*/
|
||||||
char * host;
|
char * host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Port to connect to.
|
||||||
|
*/
|
||||||
unsigned short port;
|
unsigned short port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Low-level socket descriptor.
|
||||||
|
*/
|
||||||
int sockfd;
|
int sockfd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the object.
|
||||||
|
*
|
||||||
|
* @param host name of the host this socket connects to.
|
||||||
|
* @param port port to connect to.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
init ( const char * host,
|
init ( const char * host,
|
||||||
unsigned short port ) throw ( Exception );
|
unsigned short port ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-initialize the object.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
strip ( void ) throw ( Exception );
|
strip ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor. Always throws an Exception.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
TcpSocket ( void ) throw ( Exception )
|
TcpSocket ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
@ -85,79 +109,160 @@ class TcpSocket : public Source, public Sink
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param host name of the host this socket connects to.
|
||||||
|
* @param port port to connect to.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline
|
inline
|
||||||
TcpSocket( const char * host,
|
TcpSocket( const char * host,
|
||||||
unsigned short port ) throw ( Exception )
|
unsigned short port ) throw ( Exception )
|
||||||
{
|
{
|
||||||
init( host, port);
|
init( host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor.
|
||||||
|
*
|
||||||
|
* @param ss the TcpSocket to copy.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
TcpSocket( const TcpSocket & ss ) throw ( Exception );
|
TcpSocket( const TcpSocket & ss ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual
|
inline virtual
|
||||||
~TcpSocket( void ) throw ( Exception )
|
~TcpSocket( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
strip();
|
strip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assignment operator.
|
||||||
|
*
|
||||||
|
* @param ss the TcpSocket to assign this to.
|
||||||
|
* @return a reference to this TcpSocket.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual TcpSocket &
|
inline virtual TcpSocket &
|
||||||
operator= ( const TcpSocket & ss ) throw ( Exception );
|
operator= ( const TcpSocket & ss ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the host this socket connects to.
|
||||||
|
*
|
||||||
|
* @return the host this socket connects to.
|
||||||
|
*/
|
||||||
inline const char *
|
inline const char *
|
||||||
getHost ( void ) const throw ()
|
getHost ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the port this socket connects to.
|
||||||
|
*
|
||||||
|
* @return the port this socket connects to.
|
||||||
|
*/
|
||||||
inline unsigned int
|
inline unsigned int
|
||||||
getPort ( void ) const throw ()
|
getPort ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the TcpSocket.
|
||||||
|
*
|
||||||
|
* @return true if opening was successfull, false otherwise.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
virtual bool
|
virtual bool
|
||||||
open ( void ) throw ( Exception );
|
open ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the TcpSocket is open.
|
||||||
|
*
|
||||||
|
* @return true if the TcpSocket is open, false otherwise.
|
||||||
|
*/
|
||||||
inline virtual bool
|
inline virtual bool
|
||||||
isOpen ( void ) const throw ()
|
isOpen ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return sockfd != 0;
|
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
|
virtual bool
|
||||||
canRead ( unsigned int sec,
|
canRead ( unsigned int sec,
|
||||||
unsigned int usec ) throw ( Exception );
|
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
|
virtual unsigned int
|
||||||
read ( void * buf,
|
read ( void * buf,
|
||||||
unsigned int len ) throw ( Exception );
|
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
|
virtual bool
|
||||||
canWrite ( unsigned int sec,
|
canWrite ( unsigned int sec,
|
||||||
unsigned int usec ) throw ( Exception );
|
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
|
virtual unsigned int
|
||||||
write ( const void * buf,
|
write ( const void * buf,
|
||||||
unsigned int len ) throw ( Exception );
|
unsigned int len ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flush all data that was written to the TcpSocket to the underlying
|
||||||
|
* connection.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
inline virtual void
|
inline virtual void
|
||||||
flush ( void ) throw ( Exception )
|
flush ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the TcpSocket.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
close ( void ) throw ( Exception );
|
close ( void ) throw ( Exception );
|
||||||
};
|
};
|
||||||
|
@ -178,6 +283,9 @@ class TcpSocket : public Source, public Sink
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.2 2000/11/05 17:37:24 darkeye
|
||||||
removed clone() functions
|
removed clone() functions
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue