Main Page | Namespace List | Class Hierarchy | Class List | Directories | Namespace Members | Class Members

MP3FILE Class Reference

Interface for mp3 decoders and encoders that support input/output using standard streams. More...

Inheritance diagram for MP3FILE:

AUDIO_IO_BUFFERED AUDIO_IO_FORKED_STREAM AUDIO_IO DYNAMIC_OBJECT< string > ECA_AUDIO_FORMAT ECA_AUDIO_POSITION DYNAMIC_PARAMETERS< string > ECA_OBJECT ECA_SAMPLERATE_AWARE ECA_SAMPLERATE_AWARE List of all members.

Public Member Functions

 MP3FILE (const std::string &name="")
virtual MP3FILEclone (void) const
 Virtual method that clones the current object and returns a pointer to it.
virtual MP3FILEnew_expr (void) const
 Virtual method that creates a new object of current type.
virtual std::string name (void) const
 Object name used to identify the object type.
virtual std::string description (void) const
 Object description.
virtual std::string parameter_names (void) const
 A comma-separated list of parameters names.
virtual bool locked_audio_format (void) const
 Whether audio format is locked.
virtual int supported_io_modes (void) const
 Returns info about supported I/O modes (bitwise-OR).
virtual bool supports_seeking (void) const
 Whether device supports non-blocking I/O mode.
virtual void open (void) throw (AUDIO_IO::SETUP_ERROR &)
 Opens the audio object (possibly in exclusive mode).
virtual void close (void)
 Closes audio object.
virtual long int read_samples (void *target_buffer, long int samples)
 Low-level routine for reading samples.
virtual void write_samples (void *target_buffer, long int samples)
 Low-level routine for writing samples.
virtual bool finished (void) const
 Whether all data has been processed? If opened in mode 'io_read', this means that end of stream has been reached.
virtual void seek_position (void)
virtual void set_parameter (int param, std::string value)
virtual std::string get_parameter (int param) const
 Get parameter value.

Static Public Member Functions

static void set_input_cmd (const std::string &value)
static void set_output_cmd (const std::string &value)

Static Public Attributes

static long int default_output_default_bitrate = 128000

Detailed Description

Interface for mp3 decoders and encoders that support input/output using standard streams.

Defaults to mpg123 and lame.

Author:
Kai Vehmanen


Member Function Documentation

virtual MP3FILE* MP3FILE::clone void   )  const [inline, virtual]
 

Virtual method that clones the current object and returns a pointer to it.

This must be implemented by all subclasses!

Implements AUDIO_IO.

void MP3FILE::close void   )  [virtual]
 

Closes audio object.

After calling this routine, all resources (for instance files and devices) must be freed so that they can be used by other processes.

Precondition:
is_open() == true
Postcondition:
readable() != true

writable() != true

Reimplemented from AUDIO_IO.

virtual std::string MP3FILE::description void   )  const [inline, virtual]
 

Object description.

Description should be short, informative and unformatted.

Reimplemented from ECA_OBJECT.

virtual bool MP3FILE::finished void   )  const [inline, virtual]
 

Whether all data has been processed? If opened in mode 'io_read', this means that end of stream has been reached.

If opened in 'io_write' or 'io_readwrite' modes, finished status usually means that an error has occured (no space left, etc). After finished() has returned 'true', further calls to read_buffer() and/or write_buffer() won't process any data.

For output for which 'finite_length_stream()' is true, when 'finished()' returns true, that means an error has occured. Otherwise 'finished()' just tells that further attempts to do i/o will fail.

Implements AUDIO_IO.

std::string MP3FILE::get_parameter int  param  )  const [virtual]
 

Get parameter value.

Parameters:
param parameter id, require: param > 0

Reimplemented from AUDIO_IO.

virtual bool MP3FILE::locked_audio_format void   )  const [inline, virtual]
 

Whether audio format is locked.

If this is true, audio object has a known audio format, and doesn't allow overriding it.

By default, audio format is not locked.

Reimplemented from AUDIO_IO.

virtual std::string MP3FILE::name void   )  const [inline, virtual]
 

Object name used to identify the object type.

In most cases, object name is same for all class instances. Must be implemented in all subclasses.

Implements ECA_OBJECT.

virtual MP3FILE* MP3FILE::new_expr void   )  const [inline, virtual]
 

Virtual method that creates a new object of current type.

This must be implemented by all subclasses!

Implements AUDIO_IO.

void MP3FILE::open void   )  throw (AUDIO_IO::SETUP_ERROR &) [virtual]
 

Opens the audio object (possibly in exclusive mode).

This routine is used for initializing external connections (opening files or devices, loading shared libraries, opening IPC connections). As it's impossible to know in advance what might happen, open() may throw an exception. This way it becomes possible to provide more verbose information about the problem that caused open() to fail.

At this point the various audio parameters are used for the first time. Unless locked_audio_format() is 'true', object tries to use the audio format parameters set prior to this call. If object doesn't support the given parameter combination, it can either try adjust them to closest matching, or in the worst case, throw an SETUP_ERROR exception (see above).

Precondition:
is_open() != true
Postcondition:
readable() == true || writable() == true || is_open() != true

Reimplemented from AUDIO_IO.

virtual std::string MP3FILE::parameter_names void   )  const [inline, virtual]
 

A comma-separated list of parameters names.

Derived classes must implement this.

Reimplemented from AUDIO_IO.

long int MP3FILE::read_samples void *  target_buffer,
long int  samples
[virtual]
 

Low-level routine for reading samples.

Number of read sample frames is returned. This must be implemented by all subclasses.

Implements AUDIO_IO_BUFFERED.

virtual int MP3FILE::supported_io_modes void   )  const [inline, virtual]
 

Returns info about supported I/O modes (bitwise-OR).

By default, all I/O modes are supported.

Reimplemented from AUDIO_IO.

virtual bool MP3FILE::supports_seeking void   )  const [inline, virtual]
 

Whether device supports non-blocking I/O mode.

By default, seeking is supported.

Reimplemented from AUDIO_IO.

void MP3FILE::write_samples void *  target_buffer,
long int  samples
[virtual]
 

Low-level routine for writing samples.

This must be implemented by all subclasses.

Implements AUDIO_IO_BUFFERED.


The documentation for this class was generated from the following files:
Generated on Fri Apr 8 01:38:03 2005 for libecasound by  doxygen 1.4.1