Source: simpleaudioencoder.h


Annotated List
Files
Globals
Hierarchy
Index
// ##########################################################################
// ####                                                                  ####
// ####                      RTP Audio Server Project                    ####
// ####                    ============================                  ####
// ####                                                                  ####
// #### Simple Audio Encoder                                             ####
// ####                                                                  ####
// #### Version 1.00  --  February 04, 2001                              ####
// ####                                                                  ####
// #### Copyright (C) 1999  Thomas Dreibholz                             ####
// ####               2000  Universität Bonn, Abt. IV                    ####
// ####               2001  EMail: Dreibholz@bigfoot.com                 ####
// ####                     WWW:   http://www.bigfoot.com/~dreibholz     ####
// ####                                                                  ####
// ##########################################################################


#ifndef SIMPLEAUDIOENCODER_H
#define SIMPLEAUDIOENCDOER_H


#include "system.h"
#include "audioencoderinterface.h"
#include "audioreaderinterface.h"
#include "audioquality.h"
#include "transportinfo.h"
#include "audioquality.h"


namespace Coral {


/**
  * This class is an simple audio encoder. It does no error correction or
  * redundant transmission.
  *
  * @short   Simple Audio Encoder
  * @author  Thomas Dreibholz (Dreibholz@bigfoot.com)
  * @version 1.0
  */            
class SimpleAudioEncoder : public AudioEncoderInterface,
                           public AudioQuality
{
   // ====== Constructor/Destructor =========================================
   public:
   /**
     * Constructor for the audio encoder.
     *
     * @param audioReader AudioReaderInterface for the audio input.
     */
   SimpleAudioEncoder(AudioReaderInterface* audioReader);
   
   /**
     * Destructor.
     */
   ~SimpleAudioEncoder();


   // ====== EncoderInterface implementation ================================
   /**
     * getTypeID() implementation of EncoderInterface.
     *
     * @see EncoderInterface#getTypeID
     */
   const card16 getTypeID() const;
   
   /**
     * getTypeName implementation of EncoderInterface.
     *
     * @see EncoderInterface#getTypeName
     */
   const char* getTypeName() const;
   
   /**
     * activate() implementation of EncoderInterface.
     *
     * @see EncoderInterface#activate
     */
   void activate();

   /**
     * deactivate() implementation of EncoderInterface.
     *
     * @see EncoderInterface#deactivate
     */
   void deactivate();

   /**
     * reset() implementation of EncoderInterface.
     *
     * @see EncoderInterface#reset
     */
   void reset();

   /**
     * prepareNextFrame() implementation of EncoderInterface.
     *
     * @see EncoderInterface#prepareNextFrame
     */
   bool prepareNextFrame(const cardinal headerSize,
                         const cardinal maxPacketSize,
                         const cardinal flags);

   /**
     * getNextPacket() implementation of EncoderInterface.
     *
     * @see EncoderInterface#getNextPacket
     */   
   cardinal getNextPacket(EncoderPacket* encoderPacket);

   /**
     * adaptQuality() implementation of EncoderInterface.
     *
     * @see EncoderInterface#adaptQuality
     */
   void adaptQuality(const double   fractionLost,
                     const cardinal layer);


   /**
     * getTransportInfo() implementation of EncoderInterface.
     *
     * @see EncoderInterface#getTransportInfo
     */
   void getTransportInfo(TransportInfo& transportInfo,
                         const cardinal headerSize,
                         const cardinal maxPacketSize,
                         const bool     calculateLevels) const;

   /**
     * setTransportInfo() implementation of EncoderInterface.
     *
     * @see EncoderInterface#setTransportInfo
     */
   void setTransportInfo(TransportInfo& transportInfo,
                         const cardinal headerSize,
                         const cardinal maxPacketSize,
                         const bool     calculateLevels);


   // ====== Private data ===================================================
   private:
   AudioReaderInterface* Source;

   card8*       FrameBuffer;              // Current frame
   cardinal     FrameBufferPos;
   cardinal     FrameBufferSize;
   card64       FramePosition;
   card64       FrameMaxPosition;
   AudioQuality FrameQualitySetting;

   integer      MediaInfoCounter;

   card64       ByteRateLimit;
   cardinal     NetworkQualityDecrement;
   cardinal     SendError;
   card8        ErrorCode;
};


}


#endif

Generated by: viper@odin on Sun Feb 4 18:54:51 2001, using kdoc 2.0a22.