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

LameLibEncoder Class Reference

#include <LameLibEncoder.h>

Inheritance diagram for LameLibEncoder:

Inheritance graph
[legend]
Collaboration diagram for LameLibEncoder:

Collaboration graph
[legend]
List of all members.

Detailed Description

A class representing the lame encoder linked as a shared object or as a static library.

Author:
Author
darkeye
Version:
Revision
1.16

Definition at line 72 of file LameLibEncoder.h.

Public Member Functions

 LameLibEncoder (Sink *sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate=0, unsigned int outChannel=0, int lowpass=0, int highpass=0) throw ( Exception )
 Constructor.
 LameLibEncoder (Sink *sink, const AudioSource *as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate=0, unsigned int outChannel=0, int lowpass=0, int highpass=0) throw ( Exception )
 Constructor.
 LameLibEncoder (const LameLibEncoder &encoder) throw ( Exception )
 Copy constructor.
virtual ~LameLibEncoder (void) throw ( Exception )
 Destructor.
virtual LameLibEncoderoperator= (const LameLibEncoder &encoder) throw ( Exception )
 Assignment operator.
const char * getLameVersion (void)
 Get the version string of the underlying lame library.
virtual bool isRunning (void) const throw ()
 Check wether encoding is in progress.
virtual bool start (void) throw ( Exception )
 Start encoding.
virtual void stop (void) throw ( Exception )
 Stop encoding.
virtual bool open (void) throw ( Exception )
 Open an encoding session.
virtual bool isOpen (void) const throw ()
 Check if the encoding session is open.
virtual bool canWrite (unsigned int sec, unsigned int usec) throw ( Exception )
 Check if the encoder is ready to accept data.
virtual unsigned int write (const void *buf, unsigned int len) throw ( Exception )
 Write data to the encoder.
virtual void flush (void) throw ( Exception )
 Flush all data that was written to the encoder to the underlying connection.
virtual void close (void) throw ( Exception )
 Close the encoding session.

Protected Member Functions

 LameLibEncoder (void) throw ( Exception )
 Default constructor.


Constructor & Destructor Documentation

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

Default constructor.

Always throws an Exception.

Exceptions:
Exception 

Definition at line 164 of file LameLibEncoder.h.

LameLibEncoder::LameLibEncoder Sink sink,
unsigned int  inSampleRate,
unsigned int  inBitsPerSample,
unsigned int  inChannel,
bool  inBigEndian,
BitrateMode  outBitrateMode,
unsigned int  outBitrate,
double  outQuality,
unsigned int  outSampleRate = 0,
unsigned int  outChannel = 0,
int  lowpass = 0,
int  highpass = 0
throw ( Exception ) [inline]
 

Constructor.

Parameters:
sink the sink to send mp3 output to
inSampleRate sample rate of the input.
inBitsPerSample number of bits per sample of the input.
inChannel number of channels of the input.
inBigEndian shows if the input is big or little endian
outBitrateMode the bit rate mode of the output.
outBitrate bit rate of the output (kbits/sec).
outQuality the quality of the stream.
outSampleRate sample rate of the output. If 0, inSampleRate is used.
outChannel number of channels of the output. If 0, inChannel is used.
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.
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.
Exceptions:
Exception 

Definition at line 198 of file LameLibEncoder.h.

LameLibEncoder::LameLibEncoder Sink sink,
const AudioSource as,
BitrateMode  outBitrateMode,
unsigned int  outBitrate,
double  outQuality,
unsigned int  outSampleRate = 0,
unsigned int  outChannel = 0,
int  lowpass = 0,
int  highpass = 0
throw ( Exception ) [inline]
 

Constructor.

Parameters:
sink the sink to send mp3 output to
as get input sample rate, bits per sample and channels from this AudioSource.
outBitrateMode the bit rate mode of the output.
outBitrate bit rate of the output (kbits/sec).
outQuality the quality of the stream.
outSampleRate sample rate of the output. If 0, input sample rate is used.
outChannel number of channels of the output. If 0, input channel is used.
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.
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.
Exceptions:
Exception 

Definition at line 249 of file LameLibEncoder.h.

LameLibEncoder::LameLibEncoder const LameLibEncoder encoder  )  throw ( Exception ) [inline]
 

Copy constructor.

Parameters:
encoder the LameLibEncoder to copy.

Definition at line 276 of file LameLibEncoder.h.

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

Destructor.

Exceptions:
Exception 

Definition at line 290 of file LameLibEncoder.h.

References close(), and isOpen().


Member Function Documentation

virtual bool LameLibEncoder::canWrite unsigned int  sec,
unsigned int  usec
throw ( Exception ) [inline, virtual]
 

Check if the encoder is ready to accept data.

Parameters:
sec the maximum seconds to block.
usec micro seconds to block after the full seconds.
Returns:
true if the encoder is ready to accept data, false otherwise.
Exceptions:
Exception 

Implements Sink.

Definition at line 393 of file LameLibEncoder.h.

References isOpen().

virtual void LameLibEncoder::close void   )  throw ( Exception ) [virtual]
 

Close the encoding session.

Exceptions:
Exception 

Implements Sink.

Referenced by stop(), and ~LameLibEncoder().

virtual void LameLibEncoder::flush void   )  throw ( Exception ) [virtual]
 

Flush all data that was written to the encoder to the underlying connection.

Exceptions:
Exception 

Implements Sink.

const char* LameLibEncoder::getLameVersion void   )  [inline]
 

Get the version string of the underlying lame library.

Returns:
the version string of the underlying lame library.

Definition at line 323 of file LameLibEncoder.h.

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

Check if the encoding session is open.

Returns:
true if the encoding session is open, false otherwise.

Implements Sink.

Definition at line 378 of file LameLibEncoder.h.

Referenced by canWrite(), isRunning(), and ~LameLibEncoder().

virtual bool LameLibEncoder::isRunning void   )  const throw () [inline, virtual]
 

Check wether encoding is in progress.

Returns:
true if encoding is in progress, false otherwise.

Implements AudioEncoder.

Definition at line 334 of file LameLibEncoder.h.

References isOpen().

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

Open an encoding session.

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

Implements Sink.

Referenced by start().

virtual LameLibEncoder& LameLibEncoder::operator= const LameLibEncoder encoder  )  throw ( Exception ) [inline, virtual]
 

Assignment operator.

Parameters:
encoder the LameLibEncoder to assign this to.
Returns:
a reference to this LameLibEncoder.
Exceptions:
Exception 

Definition at line 306 of file LameLibEncoder.h.

References AudioEncoder::operator=().

virtual bool LameLibEncoder::start void   )  throw ( Exception ) [inline, virtual]
 

Start encoding.

This function returns as soon as possible, with encoding started in the background.

Returns:
true if encoding has started, false otherwise.
Exceptions:
Exception 

Implements AudioEncoder.

Definition at line 347 of file LameLibEncoder.h.

References open().

virtual void LameLibEncoder::stop void   )  throw ( Exception ) [inline, virtual]
 

Stop encoding.

Stops the encoding running in the background.

Exceptions:
Exception 

Implements AudioEncoder.

Definition at line 358 of file LameLibEncoder.h.

References close().

virtual unsigned int LameLibEncoder::write const void *  buf,
unsigned int  len
throw ( Exception ) [virtual]
 

Write data to the encoder.

Buf is expected to be a sequence of big-endian 16 bit values, with left and right channels interleaved. Len is the number of bytes, must be a multiple of 4.

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.


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