#ifndef LIBRARIES_ID3TAG_H
#define LIBRARIES_ID3TAG_H


#include <exec/libraries.h>
#include <exec/types.h>
  
#define ID3TAGNAME "id3tag.library"
#define ID3TAGVERSION 5
#define ID3TAGREVISION 6

												
  
/* structure for the language id's */ 
struct ID3Tag_Language
{
	STRPTR id; /* 3 small letters */
	STRPTR fullname;
};

 
/* This structure is read only */
struct ID3TagBase
{
	struct Library base;
	STRPTR *genre; /* defined in id3tag v1 */
	/*
	Blues
	Classic Rock
	  ****
	Euro-House
	Dance Hall
	0
	*/
/* id3tag.library v2.4 */
	ULONG buffer; /* id3tag_lib/buffer (default 128k) */
/* 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; /* id3tag_lib/identificationlevel (default 2)*/									 
/* id3tag.library v4.2 */
	struct ID3Tag_Language *language; /* ISO/FDIS 639-2, TC 37 / SC 2  */
	/*
	{"aar","Afar"},
		****
	{"eng","English"}, default
		****
	{"zun","Zuni"},
	{0,0}
	*/
	LONG languagecount; /* count language in ID3TagBase->language */
/* id3tag.library v5.2 */
	LONG maxpadding; /* id3tag_lib/maxpadding (default 0) */
};


/* Type for ID3Tag_RemoveType() */
 
#define ID3Tag_Remove_T1 0 /* agree with ID3Tag_Remove() */
#define ID3Tag_Remove_T2 1 /* overwrite v1 with space, v2 with NULL */
/* id3tag.libbrary v3.0 */
#define ID3Tag_Remove_T3 2 /* 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 */
	

/* structure for the image */
struct ID3Tag_Image
{
	STRPTR description; /* max 64 characters, can be NULL */
	STRPTR mime;
	/*
		'-->' data is a link to the file
		'image/jpeg' data is binary
		'image/png' data is binary
	*/
	LONG size; /* size of data >0 */
	APTR data; /* pointer to the data (binary or URL) */
};
 
/* 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 (multiline) */
#define ID3Tag_Track2   (ID3Tag_Dummy+9) /* LONG */
/* id3tag.library v3.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 v4.1 */
#define ID3Tag_LyricsText              (ID3Tag_Dummy+31) /* STRPTR (multiline) */
#define ID3Tag_LyricsDescriptor        (ID3Tag_Dummy+32) /* STRPTR */
/* id3tag.library v4.2 */
#define ID3Tag_LyricsLanguage          (ID3Tag_Dummy+33) /* STRPTR (language id) */
#define ID3Tag_CommentLanguage         (ID3Tag_Dummy+34) /* STRPTR (language id) */
/* id3tag.library v5.0 */
#define ID3Tag_ImageOther             (ID3Tag_Dummy+35) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageCoverFront        (ID3Tag_Dummy+36) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageCoverBack         (ID3Tag_Dummy+37) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageLeaflet	        (ID3Tag_Dummy+38) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageMedia             (ID3Tag_Dummy+39) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageLeadArtist        (ID3Tag_Dummy+40) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageArtist            (ID3Tag_Dummy+41) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageConductor         (ID3Tag_Dummy+42) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageBand		        (ID3Tag_Dummy+43) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageComposer          (ID3Tag_Dummy+44) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageTextWriter        (ID3Tag_Dummy+45) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageRecordingLoaction (ID3Tag_Dummy+46) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageDuringRecording   (ID3Tag_Dummy+47) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageDuringPerformance (ID3Tag_Dummy+48) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageMovie             (ID3Tag_Dummy+49) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageIllustration      (ID3Tag_Dummy+50) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImageLogo              (ID3Tag_Dummy+51) /* pointer to ID3Tag_Image or NULL */
#define ID3Tag_ImagePublisher         (ID3Tag_Dummy+52) /* pointer to ID3Tag_Image or NULL */

  
/* This structure is read only */ 
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;     /* ID3TagMPEGA_EMPHASIS_xxx */
	LONG filesize;     /* in Byte */
								
/* id3tag.library v2.1 */
  
	LONG id3tagv2size;  /* Size of ID3Tag Version 2 */
	LONG header;    /* >= id3tagv2size first MPEGAFrame found*/
/* id3tag.library v5.2 */
 
	LONG padding; /* use padding size */
};


#define ID3TagMPEGA_VERSION_1 1
#define ID3TagMPEGA_VERSION_1_STR "1.0"
#define ID3TagMPEGA_VERSION_2 2
#define ID3TagMPEGA_VERSION_2_STR "2.0"
#define ID3TagMPEGA_VERSION_2_5 4
#define ID3TagMPEGA_VERSION_2_5_STR "2.5"

#define ID3TagMPEGA_MODE_STEREO 0
#define ID3TagMPEGA_MODE_STEREO_STR "Stereo"
#define ID3TagMPEGA_MODE_JOINSTEREO 1
#define ID3TagMPEGA_MODE_JOINSTEREO_STR "Joint stereo"
#define ID3TagMPEGA_MODE_DUALCHANNEL 2
#define ID3TagMPEGA_MODE_DUALCHANNEL_STR "Dual channel"
#define ID3TagMPEGA_MODE_SINGLECHANNEL 3
#define ID3TagMPEGA_MODE_SINGLECHANNEL_STR "Mono"

#define ID3TagMPEGA_EMPHASIS_NONE 0
#define ID3TagMPEGA_EMPHASIS_NONE_STR "None"
#define ID3TagMPEGA_EMPHASIS_50_15ms 1
#define ID3TagMPEGA_EMPHASIS_50_15ms_STR "50/15ms"
#define ID3TagMPEGA_EMPHASIS_CITTJ_17 3
#define ID3TagMPEGA_EMPHASIS_CITTJ_17_STR "CITTj.17"




/*
	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
/* id3tag.library v3.0 */
#define ID3TagErr_UnknownVersion 14
/* id3tag.library v4.0 */
#define ID3TagErr_BufferToSmall  15
#define ID3TagErr_InvalidHeader  16

			
/*
	tags for ID3Tag_LaunchPrefs()
*/

#define ID3TagPrefs_Dummy (TAG_USER)
 
#define ID3TagPrefs_PubScreen (ID3TagPrefs_Dummy+1) /* STRPTR */
/* id3tag.library v5.6 */
#define ID3TagPrefs_Synch (ID3TagPrefs_Dummy+2) /* BOOL ( default: FALSE )*/

 
#endif /* LIBRARIES_ID3TAG_H */

