class LameLibEncoder

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

Definition#include <LameLibEncoder.h>
InheritsAudioEncoder [public ], Reporter [public virtual ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods

Private Methods

Private Members


Detailed Description

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

lame_global_flags * lameGlobalFlags

lameGlobalFlags

[private]

Ref<Sink> sink

sink

[private]

int lowpass

lowpass

[private]

int highpass

highpass

[private]

inline void  init ( Sink * sink, int lowpass, int highpass )
throw ( Exception )

init

[private]

Initialize the object.

Parameters:
sinkthe sink to send mp3 output to
lowpassfrequency 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.
highpassfrequency 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.

Throws: Exception

Reimplemented from AudioEncoder.

inline void  strip ( void )
throw ( Exception )

strip

[private]

De-initialize the object.

Throws: Exception

Reimplemented from AudioEncoder.

inline  LameLibEncoder ( void )
throw ( Exception )

LameLibEncoder

[protected]

Default constructor. Always throws an Exception.

Throws: Exception

inline  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 )

LameLibEncoder

Constructor.

Parameters:
sinkthe sink to send mp3 output to
inSampleRatesample rate of the input.
inBitsPerSamplenumber of bits per sample of the input.
inChannelnumber of channels of the input.
outBitrateModethe bit rate mode of the output.
outBitratebit rate of the output (kbits/sec).
outQualitythe quality of the stream.
outSampleRatesample rate of the output. If 0, inSampleRate is used.
outChannelnumber of channels of the output. If 0, inChannel is used.
inBigEndianshows if the input is big or little endian
lowpassfrequency 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.
highpassfrequency 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.

Throws: Exception

inline  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 )

LameLibEncoder

Constructor.

Parameters:
sinkthe sink to send mp3 output to
asget input sample rate, bits per sample and channels from this AudioSource.
outBitrateModethe bit rate mode of the output.
outBitratebit rate of the output (kbits/sec).
outQualitythe quality of the stream.
outSampleRatesample rate of the output. If 0, input sample rate is used.
outChannelnumber of channels of the output. If 0, input channel is used.
lowpassfrequency 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.
highpassfrequency 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.

Throws: Exception

inline  LameLibEncoder ( const LameLibEncoder & encoder )
throw ( Exception )

LameLibEncoder

Copy constructor.

Parameters:
encoderthe LameLibEncoder to copy.

inline  ~LameLibEncoder ( void )
throw ( Exception )

~LameLibEncoder

[virtual]

Destructor.

Throws: Exception

inline LameLibEncoder &  operator= ( const LameLibEncoder & encoder )
throw ( Exception )

operator=

[virtual]

Assignment operator.

Parameters:
encoderthe LameLibEncoder to assign this to.

Returns: a reference to this LameLibEncoder.

Throws: Exception

Reimplemented from AudioEncoder.

inline const char *  getLameVersion ( void )

getLameVersion

Get the version string of the underlying lame library.

Returns: the version string of the underlying lame library.

inline bool  isRunning ( void )
throw ()

isRunning

[const virtual]

Check wether encoding is in progress.

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

Reimplemented from AudioEncoder.

inline bool  start ( void )
throw ( Exception )

start

[virtual]

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

Returns: true if encoding has started, false otherwise.

Throws: Exception

Reimplemented from AudioEncoder.

inline void  stop ( void )
throw ( Exception )

stop

[virtual]

Stop encoding. Stops the encoding running in the background.

Throws: Exception

Reimplemented from AudioEncoder.

bool  open ( void )
throw ( Exception )

open

[virtual]

Open an encoding session.

Returns: true if opening was successfull, false otherwise.

Throws: Exception

Reimplemented from Sink.

inline bool  isOpen ( void )
throw ()

isOpen

[const virtual]

Check if the encoding session is open.

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

Reimplemented from Sink.

inline bool  canWrite ( unsigned int sec, unsigned int usec )
throw ( Exception )

canWrite

[virtual]

Check if the encoder is ready to accept data.

Parameters:
secthe maximum seconds to block.
usecmicro seconds to block after the full seconds.

Returns: true if the encoder is ready to accept data, false otherwise.

Throws: Exception

Reimplemented from Sink.

unsigned int  write ( const void * buf, unsigned int len )
throw ( Exception )

write

[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:
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.

void  flush ( void )
throw ( Exception )

flush

[virtual]

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

Throws: Exception

Reimplemented from Sink.

void  close ( void )
throw ( Exception )

close

[virtual]

Close the encoding session.

Throws: Exception

Reimplemented from Sink.