#ifndef AVIFILE_AUDIOENCODER_H
#define AVIFILE_AUDIOENCODER_H

/********************************************************
 *
 * Audio encoder interface.
 *
 ********************************************************/

#include <formats.h>
#include <infotypes.h>
/**
 *
 *  INTERFACE LIMITATIONS:
 *
 * As of 1/15/2001, the only supported format is MPEG layer-3
 * ( using Lame encoder v. 3.70 ), format id 0x55. Arguments passed
 * to Create() are not checked for correctness. Only 16-bit input
 * is supported.
 *
 */
class IAudioEncoder
{
protected:
    const CodecInfo& record;
public:
    IAudioEncoder(const CodecInfo& info):record(info) {}
    virtual ~IAudioEncoder() {}
    /**
     * Finishes conversion. May write some more data
     * ( pass buffer of 10kb size here ).
     */
    virtual int Close(void* out_data, size_t out_size, size_t* size_written) = 0;
    /**
     * Encodes data. Parameters in_size and size_read are measured
     * in samples ( not in bytes ).
     */
    virtual int Convert(const void* in_data, size_t in_size,
			void* out_data, size_t out_size,
			size_t* size_read, size_t* size_written)	= 0;
    virtual const CodecInfo& GetCodecInfo() const { return record; }
    /**
     * Queries for the size of structure describing destination
     * format.
     */
    virtual int GetFormatSize()					= 0;
    /**
     * Reads the format structure. Fails if size<GetFormatSize().
     */
    virtual int GetFormat(void* extension, size_t size)		= 0;
    /**
     * Starts conversion.
     */
    virtual int Start()						= 0;

    ///  USE ATTRIBUTES as for video - we want to support a lot of various parameters
    /**
     * Sets bitrate in bytes/second.
     */
    virtual int SetBitrate(int bitrate) {return -1;}
    /**
     * Sets encoding quality ( 1..10 ).
     */
    virtual int SetQuality(int quality) {return -1;}
};

#endif // AVIFILE_AUDIOENCODER_H
