#ifndef LIBRARIES_ID3TAG_H
#define LIBRARIES_ID3TAG_H


#include <exec/libraries.h>
#include <exec/types.h>


  
#define ID3TAGNAME "id3tag.library"

/* Version 4.1 */
 
/*
	Diese  Struktur ist nur lesbar
    
	This structure is read only
*/
struct ID3TagBase
{
	struct Library base;
	STRPTR *genre;
/*
	Blues
	Classic Rock
	
   ****
	
	Euro-House
	Dance Hall
	0
*/

/* id3tag.library v2.4 */

	ULONG buffer;
/*
	Buffer für Schreiben und Entfernen (default 128k)
	Umgebungsvariable id3tag_lib/buffer
	
	buffer for write and remove (default 128k)
	environment variable id3tag_lib/buffer
*/

/* id3tag.library v4.0 */
 
	LONG genrecount; /* count genre in ID3TagBase->genre */
	UWORD revisionv2; /* id3tag_lib/revisionv2 (default 3)*/	  
	LONG padding; /* id3tag_lib/padding (default 128) */

/* id3tag .library v4.1 */
	
   WORD identificationlevel;
};


/* Type for ID3Tag_RemoveType() */
 
#define ID3Tag_Remove_T1 0
/*
	entspricht ID3Tag_Remove()
	agree with ID3Tag_Remove()
*/
#define ID3Tag_Remove_T2 1
/*
	V1 wird mir Leerzeichen überschrieben
	V2 wird mit NullBytes überschrieben
	
	V1 overwrite with space
	V2 overwrite with NULL
*/
#define ID3Tag_Remove_T3 2
/*
	wie ID3Tag_Remove_T1 + die Bytes bis zum ersten mp3frameheader
	like ID3Tag_Remove_t1 + the byte to the first mp3frameheader
*/
#define ID3Tag_Remove_T4 3
/* remove bytes of id3tag v1 */
#define ID3Tag_Remove_T5 4
/* id3tag V1 overwrite with Space */
#define ID3Tag_Remove_T6 5
/* remove bytes of id3tag v2 */
#define ID3Tag_Remove_T7 6
/* id3tag v2 overwrite with NULL */
 
 
/*
tag values, used by ID3Tag_GetAttrs() and ID3Tag_SetAttrs()
*/
	
#define ID3Tag_Dummy (TAG_USER)
  
#define ID3Tag_Title    (ID3Tag_Dummy+1)
/* STRPTR */
#define ID3Tag_Artist   (ID3Tag_Dummy+2)
/* STRPTR */
#define ID3Tag_Album    (ID3Tag_Dummy+3)
/* STRPTR */
#define ID3Tag_Year     (ID3Tag_Dummy+4)
/* STRPTR */
#define ID3Tag_Comment  (ID3Tag_Dummy+5)
/* STRPTR */
#define ID3Tag_Genre    (ID3Tag_Dummy+6)
/* STRPTR */
#define ID3Tag_Track    (ID3Tag_Dummy+7)
/* LONG */
#define ID3Tag_Comment2 (ID3Tag_Dummy+8)
/* STRPTR  (mehrzeilig) (multiline) */
#define ID3Tag_Track2   (ID3Tag_Dummy+9)
/* LONG */

/* id3tag.library Version 3.0 */

#define ID3Tag_TextWriter (ID3Tag_Dummy+10)
/* STRPTR */
#define ID3Tag_EncodedBy  (ID3Tag_Dummy+11)
/* STRPTR */
#define ID3Tag_Publisher  (ID3Tag_Dummy+12)
/* STRPTR */
#define ID3Tag_OriginalYear (ID3Tag_Dummy+13)
/* STRPTR */
#define ID3Tag_OriginalArtist (ID3Tag_Dummy+14)
/* STRPTR */
#define ID3Tag_OriginalTextWriter (ID3Tag_Dummy+15)
/* STRPTR */
#define ID3Tag_OriginalAlbum (ID3Tag_Dummy+16)
/* STRPTR */
#define ID3Tag_OriginalFileName (ID3Tag_Dummy+17)
/* STRPTR */
#define ID3Tag_URLArtist (ID3Tag_Dummy+18)
/* STRPTR */
#define ID3Tag_URLPublisher (ID3Tag_Dummy+19)
/* STRPTR */
#define ID3Tag_URLAudiofile (ID3Tag_Dummy+20)
/* STRPTR */
#define ID3Tag_URLUser (ID3Tag_Dummy+21)
/* STRPTR */
#define ID3Tag_URLUserDescription (ID3Tag_Dummy+22)
/* STRPTR */
#define ID3Tag_Composer (ID3Tag_Dummy+23)
/* STRPTR */
#define ID3Tag_BPM (ID3Tag_Dummy+24)
/* LONG */
#define ID3Tag_Copyright (ID3Tag_Dummy+25)
/* STRPTR */
#define ID3Tag_URLCopyright (ID3Tag_Dummy+26)
/* STRPTR */
#define ID3Tag_Subtitle (ID3Tag_Dummy+27)
/* STRPTR */
#define ID3Tag_Conductor (ID3Tag_Dummy+28)
/* STRPTR */
#define ID3Tag_ContentGroupDescription (ID3Tag_Dummy+29)
/* STRPTR */
#define ID3Tag_Accompaniment (ID3Tag_Dummy+30)
/* STRPTR */

/* id3tag.library Version 4.1 */

#define ID3Tag_LyricsText (ID3Tag_Dummy+31)
/* STRPTR (multiline) */
#define ID3Tag_LyricsDescriptor (ID3Tag_Dummy+32)
/* STRPTR */

 
#define ID3TagMPEGA_VERSION_1 1
#define ID3TagMPEGA_VERSION_2 2
#define ID3TagMPEGA_VERSION_2_5 4

#define ID3TagMPEGA_MODE_STEREO 0
#define ID3TagMPEGA_MODE_JOINSTEREO 1
#define ID3TagMPEGA_MODE_DUALCHANNEL 2
#define ID3TagMPEGA_MODE_SINGLECHANNEL 3

 
struct ID3Tag
{
/* ID3Tag */
	UWORD version;
	UWORD revision;
	UWORD revision2;
	
   void *tagdata;

/* Mpeg Audio Info */
	WORD norm;         /* ID3TagMPEGA_VERSION_xxx */
	WORD layer;        /* 1..3 */
	WORD mode;         /* ID3TagMPEGA_MODE_xxx */
	LONG bitrate;      /* in bps */
	WORD vbr;          /* 0 or 1 */
	LONG frequency;    /* in Hz */
	ULONG ms_duration; /* stream duration in second */
	WORD crc;          /* 0 or 1 */
	WORD copyright;    /* 0 or 1 */
	WORD original;     /* 0 or 1 */
	WORD private_bit;  /* 0 or 1 */
	WORD emphasis;     /* 0..3 */
	LONG filesize;     /* in Byte */
								
/* id3tag.library Version 2.1 */
  
	LONG id3tagv2size;  /* Size of ID3Tag Version 2 */
	LONG header;    /* >= id3tagv2size first MPEGAFrame found*/
};

/*
	ErrorID's
*/

 
#define ID3TagErr_NoMpegaFile    1
#define ID3TagErr_NoMemory       2
#define ID3TagErr_ObjectNotFound 3
#define ID3TagErr_ObjectInUse    4
#define ID3TagErr_ReadWrite      5
#define ID3TagErr_WriteProtected 6
#define ID3TagErr_ReadProtected  7
#define ID3TagErr_UnknownTagArg  8
#define ID3TagErr_UnknownRemType 9

#define ID3TagErr_DiskFull           10
#define ID3TagErr_DiskNotValidated   11
#define ID3TagErr_DiskWriteProtected 12
#define ID3TagErr_DeleteProtected    13

#define ID3TagErr_UnknownVersion 14
#define ID3TagErr_BufferToSmall  15
#define ID3TagErr_InvalidHeader  16


 
#endif /* LIBRARIES_ID3TAG_H */

