Man Linux: Main Page and Category List

NAME

       ost::AudioCodec - The codec class is a virtual used for transcoding
       audio samples between linear frames (or other known format) and an
       encoded ’sample’ buffer.

SYNOPSIS

       #include <audio2.h>

       Inherits ost::Audio.

   Public Member Functions
       AudioCodec (const char *name, Encoding encoding)
           Base for codecs, create a named coded of a specific encoding.
       virtual ~AudioCodec ()
       virtual Level getImpulse (void *buffer, unsigned number=0)
           Get the impulse energy level of a frame of X samples in the
           specified codec format.
       virtual Level getPeak (void *buffer, unsigned number=0)
           Get the peak energy level within the frame of X samples.
       virtual bool isSilent (Level threashold, void *buffer, unsigned
           number=0)
           Signal if the current audio frame is silent.
       virtual unsigned encode (Linear buffer, void *dest, unsigned
           number=0)=0
           Encode a linear sample frame into the codec sample buffer.
       virtual unsigned encodeBuffered (Linear Buffer, Encoded dest, unsigned
           number)
           Encode linear samples buffered into the coded.
       virtual unsigned decode (Linear buffer, void *source, unsigned
           number=0)=0
           Decode the sample frame into linear samples.
       virtual unsigned decodeBuffered (Linear buffer, Encoded source,
           unsigned len)
           Buffer and decode data into linear samples.
       virtual unsigned getEstimated (void)
           Get estimated data required for buffered operations.
       virtual unsigned getRequired (void)
           get required samples for encoding.
       virtual unsigned getPacket (Encoded destination, Encoded data, unsigned
           size)
           Get a packet of data rather than decode.
       Info getInfo (void)
           Get an info description for this codec.

   Static Public Member Functions
       static void endCodec (AudioCodec *codec)
           End use of a requested codec.
       static AudioCodec * getCodec (Encoding encoding, const char
           *format=NULL, bool loaded=false)
           Get the codec base class for accessing a specific derived codec
           identified by encoding type and optional spd info.
       static AudioCodec * getCodec (Info &info, bool loaded=false)
           Get the codec base class for accessing a specific derived codec
           identified by audio source descriptor.
       static bool load (const char *name)
           Load a named codec set into process memory.
       static bool load (Encoding encoding)
           Find and load a codec file by its encoding type.

   Protected Member Functions
       AudioCodec ()
       virtual AudioCodec * getByFormat (const char *format)
           often used to create a new codec of a subtype based on encoding
           format, default returns the current codec entity.
       virtual AudioCodec * getByInfo (Info &info)
           get a codec by audio source info descriptor.

   Protected Attributes
       AudioCodec * next
       Encoding encoding
       const char * name
       Info info

   Static Protected Attributes
       static AudioCodec * first

Detailed Description

       The codec class is a virtual used for transcoding audio samples between
       linear frames (or other known format) and an encoded ’sample’ buffer.

       This class is only abstract and describes the core interface for
       loadable codec modules. This class is normally merged with AudioSample.
       A derived AudioCodecXXX will typically include a AudioRegisterXXX
       static class to automatically initialize and register the codec with
       the codec registry.

       Author:
           David Sugar <dyfet@ostel.com> process codec interface.

Constructor & Destructor Documentation

   ost::AudioCodec::AudioCodec () [protected]
   ost::AudioCodec::AudioCodec (const char * name, Encoding encoding)
       Base for codecs, create a named coded of a specific encoding.

       Parameters:
           name of codec.
           encoding type of codec.

   virtual ost::AudioCodec::~AudioCodec () [inline, virtual]

Member Function Documentation

   virtual unsigned ost::AudioCodec::decode (Linear buffer, void * source,
       unsigned number = 0) [pure virtual]
       Decode the sample frame into linear samples.

       Returns:
           number of bytes scanned or returned

       Parameters:
           buffer sample buffer to save linear samples into.
           source for encoded data.
           number of samples to extract.

   virtual unsigned ost::AudioCodec::decodeBuffered (Linear buffer, Encoded
       source, unsigned len) [virtual]
       Buffer and decode data into linear samples.

       This is needed for audio formats that have irregular packet sizes.

       Returns:
           number of samples actually decoded.

       Parameters:
           destination for decoded data.
           source for encoded data.
           number of bytes being sent.

   virtual unsigned ost::AudioCodec::encode (Linear buffer, void * dest,
       unsigned number = 0) [pure virtual]
       Encode a linear sample frame into the codec sample buffer.

       Returns:
           number of bytes written.

       Parameters:
           buffer linear sample buffer to use.
           dest buffer to store encoded results.
           number of samples.

   virtual unsigned ost::AudioCodec::encodeBuffered (Linear Buffer, Encoded
       dest, unsigned number) [virtual]
       Encode linear samples buffered into the coded.

       Returns:
           number of bytes written or 0 if incomplete.

       Parameters:
           buffer linear samples to post.
           destination of encoded audio.
           number of samples being buffered.

   static void ost::AudioCodec::endCodec (AudioCodec * codec) [static]
       End use of a requested codec.

       If constructed then will be deleted.

       Parameters:
           codec pointer to getCodec returned coded pointer.

   virtual AudioCodec* ost::AudioCodec::getByFormat (const char * format)
       [inline, protected, virtual]
       often used to create a ’new’ codec of a subtype based on encoding
       format, default returns the current codec entity.

       Returns:
           pointer to an active codec or NULL if not found.

       Parameters:
           format name from spd.

   virtual AudioCodec* ost::AudioCodec::getByInfo (Info & info) [inline,
       protected, virtual]
       get a codec by audio source info descriptor.

       Returns:
           pointer to an active codec or NULL if not found.

       Parameters:
           info audio source descriptor.

   static AudioCodec* ost::AudioCodec::getCodec (Info & info, bool loaded =
       false) [static]
       Get the codec base class for accessing a specific derived codec
       identified by audio source descriptor.

       Returns:
           pointer to codec for processing.

       Parameters:
           info source descriptor for codec being requested.
           loaded true to load codec if not already in memory.

   static AudioCodec* ost::AudioCodec::getCodec (Encoding encoding, const char
       * format = NULL, bool loaded = false) [static]
       Get the codec base class for accessing a specific derived codec
       identified by encoding type and optional spd info.

       Returns:
           pointer to codec for processing.

       Parameters:
           encoding format requested.
           format spd options to pass to codec being created.
           loaded true to load if not already in memory.

   virtual unsigned ost::AudioCodec::getEstimated (void) [virtual]
       Get estimated data required for buffered operations.

       Returns:
           estimated number of bytes required for decode.

   virtual Level ost::AudioCodec::getImpulse (void * buffer, unsigned number =
       0) [virtual]
       Get the impulse energy level of a frame of X samples in the specified
       codec format.

       Returns:
           average impulse energy of frame (sumnation).

       Parameters:
           buffer of encoded samples.
           number of encoded samples.

   Info ost::AudioCodec::getInfo (void) [inline]
       Get an info description for this codec.

       Returns:
           info.

   virtual unsigned ost::AudioCodec::getPacket (Encoded destination, Encoded
       data, unsigned size) [virtual]
       Get a packet of data rather than decode.

       This is tied with getEstimated.

       Returns:
           size of data packet or 0 if not complete.

       Parameters:
           destination to save.
           data to push into buffer.
           number of bytes to push.

   virtual Level ost::AudioCodec::getPeak (void * buffer, unsigned number = 0)
       [virtual]
       Get the peak energy level within the frame of X samples.

       Returns:
           peak energy impulse in frame (largest).

       Parameters:
           buffer of encoded samples.
           number of encoded samples.

   virtual unsigned ost::AudioCodec::getRequired (void) [virtual]
       get required samples for encoding.

       Returns:
           required number of samples for encoder buffer.

   virtual bool ost::AudioCodec::isSilent (Level threashold, void * buffer,
       unsigned number = 0) [virtual]
       Signal if the current audio frame is silent.

       This can be deterimed either by an impulse computation, or, in some
       cases, some codecs may signal and flag silent packets.

       Returns:
           true if silent

       Parameters:
           threashold to use if not signaled.
           buffer of encoded samples.
           number of encoded samples.

   static bool ost::AudioCodec::load (Encoding encoding) [static]
       Find and load a codec file by it’s encoding type.

       Converts the type into a codec name and invokes the other loader...

       Returns:
           true if successful.

       Parameters:
           encoding type for file.

   static bool ost::AudioCodec::load (const char * name) [static]
       Load a named codec set into process memory.

       Returns:
           true if successful.

       Parameters:
           name of codec set to load.

Member Data Documentation

   Encoding ost::AudioCodec::encoding [protected]
   AudioCodec* ost::AudioCodec::first [static, protected]
   Info ost::AudioCodec::info [protected]
   const char* ost::AudioCodec::name [protected]
   AudioCodec* ost::AudioCodec::next [protected]

Author

       Generated automatically by Doxygen for ccAudio from the source code.