|
|
Data output to a ShoutCast / IceCast / etc. server This is an abstract class. A subclass should override at least the sendLogin() function.
Ref<TcpSocket> socket | socket |
[private]
Ref<BufferedSink> bufferedSink | bufferedSink |
[private]
Ref<Sink> streamDump | streamDump |
[private]
unsigned int bufferDuration | bufferDuration |
[private]
char * password | password |
[private]
char * name | name |
[private]
char * url | url |
[private]
char * genre | genre |
[private]
unsigned int bitRate | bitRate |
[private]
bool isPublic | isPublic |
[private]
void
init ( TcpSocket * socket,
Sink * streamDump,
const char * password,
unsigned int bitRate,
const char * name,
const char * url,
const char * genre,
bool isPublic,
unsigned int bufferDuration )
throw ( Exception ) | init |
[private]
Initalize the object.
Parameters:
socket | socket connection to the server. |
password | password to the server. |
name | name of the stream. |
url | URL associated with the stream. |
genre | genre of the stream. |
bitRate | bitrate of the stream (e.g. mp3 bitrate). |
isPublic | is the stream public? |
bufferDuration | duration of the BufferedSink buffer in seconds. |
Throws: Exception
void
strip ( void )
throw ( Exception ) | strip |
[private]
De-initalize the object.
Throws: Exception
inline
CastSink ( void )
throw ( Exception ) | CastSink |
[protected]
Default constructor. Always throws an Exception.
Throws: Exception
bool
sendLogin ( void )
throw ( Exception ) | sendLogin |
[protected pure virtual]
Log in to the server using the socket avialable.
Returns: true if login was successful, false otherwise.
Throws: Exception
inline Sink *
getSink ( void )
throw () | getSink |
[protected const]
Get the Sink underneath this CastSink.
Returns: pointer to the Sink underneath this CastSink.
inline TcpSocket *
getSocket ( void )
throw () | getSocket |
[protected const]
Get the TcpSocket underneath this CastSink.
Returns: pointer to the TcpSocket underneath this CastSink.
inline
CastSink ( TcpSocket * socket,
const char * password,
unsigned int bitRate,
const char * name = 0,
const char * url = 0,
const char * genre = 0,
bool isPublic = false,
Sink * streamDump = 0,
unsigned int bufferDuration = 10 )
throw ( Exception ) | CastSink |
Constructor.
Parameters:
socket | socket connection to the server. |
password | password to the server. |
name | name of the stream. |
url | URL associated with the stream. |
genre | genre of the stream. |
bitRate | bitrate of the stream (e.g. mp3 bitrate). |
isPublic | is the stream public? |
streamDump | a Sink to dump the streamed binary data to |
bufferDuration | duration of the BufferedSink buffer in seconds. |
Throws: Exception
inline
CastSink ( const CastSink & cs )
throw ( Exception ) | CastSink |
Copy constructor.
Parameters:
cs | the CastSink to copy. |
inline
~CastSink ( void )
throw ( Exception ) | ~CastSink |
[virtual]
Destructor.
Throws: Exception
inline CastSink &
operator= ( const CastSink & cs )
throw ( Exception ) | operator= |
[virtual]
Assignment operator.
Parameters:
cs | the CastSink to assign this to. |
Returns: a reference to this CastSink.
Throws: Exception
Reimplemented from Sink.
bool
open ( void )
throw ( Exception ) | open |
[virtual]
Open the CastSink. Logs in to the server.
Returns: true if opening was successfull, false otherwise.
Throws: Exception
Reimplemented from Sink.
inline bool
isOpen ( void )
throw () | isOpen |
[const virtual]
Check if the CastSink is open.
Returns: true if the CastSink is open, false otherwise.
Reimplemented from Sink.
inline bool
canWrite ( unsigned int sec,
unsigned int usec )
throw ( Exception ) | canWrite |
[virtual]
Check if the CastSink is ready to accept data. Blocks until the specified time for data to be available.
Parameters:
sec | the maximum seconds to block. |
usec | micro seconds to block after the full seconds. |
Returns: true if the CastSink is ready to accept data, false otherwise.
Throws: Exception
Reimplemented from Sink.
inline unsigned int
write ( const void * buf,
unsigned int len )
throw ( Exception ) | write |
[virtual]
Write data to the CastSink.
Parameters:
buf | the data to write. |
len | number of bytes to write from buf. |
Returns: the number of bytes written (may be less than len).
Throws: Exception
Reimplemented from Sink.
inline void
flush ( void )
throw ( Exception ) | flush |
[virtual]
Flush all data that was written to the CastSink to the server.
Throws: Exception
Reimplemented from Sink.
inline void
close ( void )
throw ( Exception ) | close |
[virtual]
Close the CastSink.
Throws: Exception
Reimplemented from Sink.
inline const char *
getPassword ( void )
throw () | getPassword |
[const]
Get the password to the server.
Returns: the password to the server.
inline const char *
getName ( void )
throw () | getName |
[const]
Get the name of the stream.
Returns: the name of the stream.
inline const char *
getUrl ( void )
throw () | getUrl |
[const]
Get the URL associated with the stream.
Returns: the URL associated with the stream.
inline const char *
getGenre ( void )
throw () | getGenre |
[const]
Get the genre of the stream.
Returns: the genre of the stream.
inline unsigned int
getBitRate ( void )
throw () | getBitRate |
[const]
Get the bitrate of the stream (e.g. mp3 bitrate).
Returns: the bitrate of the stream (e.g. mp3 bitrate).
inline bool
getIsPublic ( void )
throw () | getIsPublic |
[const]
Get wether this stream is public.
Returns: true if the stream is public, false otherwise.
inline unsigned int
getBufferDuration ( void )
throw () | getBufferDuration |
[const]
Get the duration of the BufferedSink buffer in seconds.
Returns: the the duration of the BufferedSink buffer in seconds.