class CastSink

Data output to a ShoutCast / IceCast / etc. More...

Contains pure virtuals
Definition#include <CastSink.h>
InheritsReporter [public virtual ], Sink [public ]
Inherited byFileCast, IceCast, IceCast2, ShoutCast
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods

Private Methods

Private Members


Detailed Description

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:
socketsocket connection to the server.
passwordpassword to the server.
namename of the stream.
urlURL associated with the stream.
genregenre of the stream.
bitRatebitrate of the stream (e.g. mp3 bitrate).
isPublicis the stream public?
bufferDurationduration 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:
socketsocket connection to the server.
passwordpassword to the server.
namename of the stream.
urlURL associated with the stream.
genregenre of the stream.
bitRatebitrate of the stream (e.g. mp3 bitrate).
isPublicis the stream public?
streamDumpa Sink to dump the streamed binary data to
bufferDurationduration of the BufferedSink buffer in seconds.

Throws: Exception

inline  CastSink ( const CastSink & cs )
throw ( Exception )

CastSink

Copy constructor.

Parameters:
csthe 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:
csthe 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:
secthe maximum seconds to block.
usecmicro 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:
bufthe data to write.
lennumber 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.