Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

CastSink Class Reference

#include <CastSink.h>

Inheritance diagram for CastSink:

Inheritance graph
[legend]
Collaboration diagram for CastSink:

Collaboration graph
[legend]
List of all 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.

Author:
Author
darkeye
Version:
Revision
1.8

Definition at line 62 of file CastSink.h.

Public Member Functions

 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 )
 Constructor.
 CastSink (const CastSink &cs) throw ( Exception )
 Copy constructor.
virtual ~CastSink (void) throw ( Exception )
 Destructor.
virtual CastSinkoperator= (const CastSink &cs) throw ( Exception )
 Assignment operator.
virtual bool open (void) throw ( Exception )
 Open the CastSink.
virtual bool isOpen (void) const throw ()
 Check if the CastSink is open.
virtual bool canWrite (unsigned int sec, unsigned int usec) throw ( Exception )
 Check if the CastSink is ready to accept data.
virtual unsigned int write (const void *buf, unsigned int len) throw ( Exception )
 Write data to the CastSink.
virtual void flush (void) throw ( Exception )
 Flush all data that was written to the CastSink to the server.
virtual void close (void) throw ( Exception )
 Close the CastSink.
const char * getPassword (void) const throw ()
 Get the password to the server.
const char * getName (void) const throw ()
 Get the name of the stream.
const char * getUrl (void) const throw ()
 Get the URL associated with the stream.
const char * getGenre (void) const throw ()
 Get the genre of the stream.
unsigned int getBitRate (void) const throw ()
 Get the bitrate of the stream (e.g.
bool getIsPublic (void) const throw ()
 Get wether this stream is public.
unsigned int getBufferDuration (void) const throw ()
 Get the duration of the BufferedSink buffer in seconds.

Protected Member Functions

 CastSink (void) throw ( Exception )
 Default constructor.
virtual bool sendLogin (void)=0 throw ( Exception )
 Log in to the server using the socket avialable.
SinkgetSink (void) const throw ()
 Get the Sink underneath this CastSink.
TcpSocketgetSocket (void) const throw ()
 Get the TcpSocket underneath this CastSink.


Constructor & Destructor Documentation

CastSink::CastSink void   )  throw ( Exception ) [inline, protected]
 

Default constructor.

Always throws an Exception.

Exceptions:
Exception 

Definition at line 159 of file CastSink.h.

CastSink::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 ) [inline]
 

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.
Exceptions:
Exception 

Definition at line 214 of file CastSink.h.

CastSink::CastSink const CastSink cs  )  throw ( Exception ) [inline]
 

Copy constructor.

Parameters:
cs the CastSink to copy.

Definition at line 242 of file CastSink.h.

virtual CastSink::~CastSink void   )  throw ( Exception ) [inline, virtual]
 

Destructor.

Exceptions:
Exception 

Definition at line 262 of file CastSink.h.


Member Function Documentation

virtual bool CastSink::canWrite unsigned int  sec,
unsigned int  usec
throw ( Exception ) [inline, 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.
Exceptions:
Exception 

Implements Sink.

Reimplemented in FileCast.

Definition at line 325 of file CastSink.h.

References Sink::canWrite(), and getSink().

virtual void CastSink::close void   )  throw ( Exception ) [inline, virtual]
 

Close the CastSink.

Exceptions:
Exception 

Implements Sink.

Reimplemented in FileCast.

Definition at line 371 of file CastSink.h.

References Sink::close(), and getSink().

Referenced by open().

virtual void CastSink::flush void   )  throw ( Exception ) [inline, virtual]
 

Flush all data that was written to the CastSink to the server.

Exceptions:
Exception 

Implements Sink.

Reimplemented in FileCast.

Definition at line 356 of file CastSink.h.

References Sink::flush(), and getSink().

unsigned int CastSink::getBitRate void   )  const throw () [inline]
 

Get the bitrate of the stream (e.g.

mp3 bitrate).

Returns:
the bitrate of the stream (e.g. mp3 bitrate).

Definition at line 430 of file CastSink.h.

Referenced by ShoutCast::sendLogin(), IceCast2::sendLogin(), and IceCast::sendLogin().

unsigned int CastSink::getBufferDuration void   )  const throw () [inline]
 

Get the duration of the BufferedSink buffer in seconds.

Returns:
the the duration of the BufferedSink buffer in seconds.

Definition at line 452 of file CastSink.h.

const char* CastSink::getGenre void   )  const throw () [inline]
 

Get the genre of the stream.

Returns:
the genre of the stream.

Definition at line 419 of file CastSink.h.

Referenced by ShoutCast::sendLogin(), IceCast2::sendLogin(), and IceCast::sendLogin().

bool CastSink::getIsPublic void   )  const throw () [inline]
 

Get wether this stream is public.

Returns:
true if the stream is public, false otherwise.

Definition at line 441 of file CastSink.h.

Referenced by ShoutCast::sendLogin(), IceCast2::sendLogin(), and IceCast::sendLogin().

const char* CastSink::getName void   )  const throw () [inline]
 

Get the name of the stream.

Returns:
the name of the stream.

Definition at line 397 of file CastSink.h.

Referenced by ShoutCast::sendLogin(), IceCast2::sendLogin(), and IceCast::sendLogin().

const char* CastSink::getPassword void   )  const throw () [inline]
 

Get the password to the server.

Returns:
the password to the server.

Definition at line 386 of file CastSink.h.

Referenced by ShoutCast::sendLogin(), IceCast2::sendLogin(), and IceCast::sendLogin().

Sink* CastSink::getSink void   )  const throw () [inline, protected]
 

Get the Sink underneath this CastSink.

Returns:
pointer to the Sink underneath this CastSink.

Definition at line 179 of file CastSink.h.

References Ref< T >::get().

Referenced by canWrite(), close(), flush(), ShoutCast::sendLogin(), IceCast2::sendLogin(), IceCast::sendLogin(), and write().

TcpSocket* CastSink::getSocket void   )  const throw () [inline, protected]
 

Get the TcpSocket underneath this CastSink.

Returns:
pointer to the TcpSocket underneath this CastSink.

Definition at line 190 of file CastSink.h.

Referenced by ShoutCast::sendLogin(), IceCast2::sendLogin(), and IceCast::sendLogin().

const char* CastSink::getUrl void   )  const throw () [inline]
 

Get the URL associated with the stream.

Returns:
the URL associated with the stream.

Definition at line 408 of file CastSink.h.

Referenced by ShoutCast::sendLogin(), IceCast2::sendLogin(), and IceCast::sendLogin().

virtual bool CastSink::isOpen void   )  const throw () [inline, virtual]
 

Check if the CastSink is open.

Returns:
true if the CastSink is open, false otherwise.

Implements Sink.

Reimplemented in FileCast.

Definition at line 309 of file CastSink.h.

Referenced by open().

bool CastSink::open void   )  throw ( Exception ) [virtual]
 

Open the CastSink.

Logs in to the server.

Returns:
true if opening was successfull, false otherwise.
Exceptions:
Exception 

Implements Sink.

Reimplemented in FileCast.

Definition at line 115 of file CastSink.cpp.

References close(), isOpen(), Reporter::reportEvent(), and sendLogin().

virtual CastSink& CastSink::operator= const CastSink cs  )  throw ( Exception ) [inline, virtual]
 

Assignment operator.

Parameters:
cs the CastSink to assign this to.
Returns:
a reference to this CastSink.
Exceptions:
Exception 

Definition at line 275 of file CastSink.h.

References Sink::operator=().

Referenced by ShoutCast::operator=(), IceCast2::operator=(), and IceCast::operator=().

virtual bool CastSink::sendLogin void   )  throw ( Exception ) [protected, pure virtual]
 

Log in to the server using the socket avialable.

Returns:
true if login was successful, false otherwise.
Exceptions:
Exception 

Implemented in FileCast, IceCast, IceCast2, and ShoutCast.

Referenced by open().

virtual unsigned int CastSink::write const void *  buf,
unsigned int  len
throw ( Exception ) [inline, 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).
Exceptions:
Exception 

Implements Sink.

Reimplemented in FileCast.

Definition at line 340 of file CastSink.h.

References getSink(), and Sink::write().


The documentation for this class was generated from the following files:
Generated on Fri May 19 15:36:49 2006 for DarkIce by  doxygen 1.4.4