// BACMPBS.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

// Started by JL, July 1996
// Base class for compressor and compressor list
//
#if !defined(__BACMPBS_H__)
#define __BACMPBS_H__

#if !defined(__E32BASE_H__)
#include <e32base.h>
#endif

#if !defined(__LIBASSOC_H__)
#include <baliba.h>
#endif

#ifdef _UNICODE
#define KSoundCompressionV1UidValue KSoundCompressionV1UidValue16
#define KSoundCompressionV1Uid KSoundCompressionV1Uid16
#else
#define KSoundCompressionV1UidValue KSoundCompressionV1UidValue8
#define KSoundCompressionV1Uid KSoundCompressionV1Uid8
#endif
const TUint KSoundCompressionV1UidValue8=268435539;
const TUid KSoundCompressionV1Uid8={KSoundCompressionV1UidValue8};
const TUint KSoundCompressionV1UidValue16=0x10003A11;
const TUid KSoundCompressionV1Uid16={KSoundCompressionV1UidValue16};

struct TCompressorCapsV01
    {
	TInt iCompressionPercentage;
	};

typedef TPckgBuf<TCompressorCapsV01> TCompressorCaps;

class CCompressorBase : public CBase
	{
protected:
	inline CCompressorBase() {}
public: // Pure Virtual
	virtual TInt Decode(TDes8& aDes8)=0;
	virtual TInt Encode(TDes8& aDes8)=0;
	virtual TPtrC Name() const=0;
	virtual TCompressorCaps Capabilities() const=0;
	};

typedef TLibAssoc<CCompressorBase> TCompressorPtr;

typedef CCompressorBase *(*TCompressorNewL)();

class TCompressorInfo
    {
public:
	TUid iUid;
	TCompressorCaps iCaps;
    TName iName;
private:
    TInt Size() const;
	friend class CCompressorList;
    };

class CCompressorList : public CArrayVarFlat<TCompressorInfo>
    {
public:
    IMPORT_C CCompressorList();
 	IMPORT_C ~CCompressorList();
//
    IMPORT_C void InsertL(TInt aIndex,const TCompressorInfo& aCompressorInfo);
    IMPORT_C void AppendL(const TCompressorInfo& aCompressorInfo);
//
 	inline const TDesC& Name(TInt aIndex) const;
 	inline const TCompressorCaps& Caps(TInt aIndex) const;
 	inline TUid Uid(TInt aIndex) const;
private:
    enum { EGranularity=8 };
    };

inline const TDesC& CCompressorList::Name(TInt aIndex) const
    {return At(aIndex).iName;}
inline const TCompressorCaps& CCompressorList::Caps(TInt aIndex) const
    {return At(aIndex).iCaps;}
inline TUid CCompressorList::Uid(TInt aIndex) const
    {return At(aIndex).iUid;}


#endif

