%{
/*
 * libid3tag - ID3 tag manipulation library
 * Copyright (C) 2000-2004 Underbit Technologies, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: frametype.gperf,v 1.7 2004/01/23 09:41:32 rob Exp $
 */

# ifdef HAVE_CONFIG_H
#  include "config.h"
# endif

# include "global.h"

# include <string.h>

# include "id3tag.h"
# include "frametype.h"

# define FIELDS(id)  static enum id3_field_type const fields_##id[]

/* frame field descriptions */

FIELDS(UFID) = {
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(TXXX) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_STRING
};

FIELDS(WXXX) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_LATIN1
};

FIELDS(MCDI) = {
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(ETCO) = {
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(MLLT) = {
  ID3_FIELD_TYPE_INT16,
  ID3_FIELD_TYPE_INT24,
  ID3_FIELD_TYPE_INT24,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(SYTC) = {
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(USLT) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_LANGUAGE,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_STRINGFULL
};

FIELDS(SYLT) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_LANGUAGE,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(COMM) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_LANGUAGE,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_STRINGFULL
};

FIELDS(RVA2) = {
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(EQU2) = {
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(RVRB) = {
  ID3_FIELD_TYPE_INT16,
  ID3_FIELD_TYPE_INT16,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT8
};

FIELDS(APIC) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(GEOB) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(PCNT) = {
  ID3_FIELD_TYPE_INT32PLUS
};

FIELDS(POPM) = {
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT32PLUS
};

FIELDS(RBUF) = {
  ID3_FIELD_TYPE_INT24,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_INT32
};

FIELDS(AENC) = {
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_INT16,
  ID3_FIELD_TYPE_INT16,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(LINK) = {
  ID3_FIELD_TYPE_FRAMEID,
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_LATIN1LIST
};

FIELDS(POSS) = {
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(USER) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_LANGUAGE,
  ID3_FIELD_TYPE_STRING
};

FIELDS(OWNE) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_DATE,
  ID3_FIELD_TYPE_STRING
};

FIELDS(COMR) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_DATE,
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_STRING,
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(ENCR) = {
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(GRID) = {
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(PRIV) = {
  ID3_FIELD_TYPE_LATIN1,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(SIGN) = {
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(SEEK) = {
  ID3_FIELD_TYPE_INT32
};

FIELDS(ASPI) = {
  ID3_FIELD_TYPE_INT32,
  ID3_FIELD_TYPE_INT32,
  ID3_FIELD_TYPE_INT16,
  ID3_FIELD_TYPE_INT8,
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(text) = {
  ID3_FIELD_TYPE_TEXTENCODING,
  ID3_FIELD_TYPE_STRINGLIST
};

FIELDS(url) = {
  ID3_FIELD_TYPE_LATIN1
};

FIELDS(unknown) = {
  ID3_FIELD_TYPE_BINARYDATA
};

FIELDS(ZOBS) = {
  ID3_FIELD_TYPE_FRAMEID,
  ID3_FIELD_TYPE_BINARYDATA
};

# define FRAME(id)  \
  sizeof(fields_##id) / sizeof(fields_##id[0]), fields_##id

# define PRESERVE  0
# define DISCARD   ID3_FRAME_FLAG_FILEALTERPRESERVATION
# define OBSOLETE  (DISCARD | ID3_FRAME_FLAG_TAGALTERPRESERVATION)

# define FRAMETYPE(type, id, flags, desc)  \
  struct id3_frametype const id3_frametype_##type = {  \
    0, FRAME(id), flags, desc  \
  }

/* static frame types */

FRAMETYPE(text,         text,    PRESERVE, "Unknown text information frame");
FRAMETYPE(url,          url,     PRESERVE, "Unknown URL link frame");
FRAMETYPE(experimental, unknown, PRESERVE, "Experimental frame");
FRAMETYPE(unknown,      unknown, PRESERVE, "Unknown frame");
FRAMETYPE(obsolete,     unknown, OBSOLETE, "Obsolete frame");
%}
struct id3_frametype;
%%
#
# ID3v2.4 frames
#
AENC, FRAME(AENC), DISCARD,  "Audio encryption"
APIC, FRAME(APIC), PRESERVE, "Attached picture"
ASPI, FRAME(ASPI), DISCARD,  "Audio seek point index"
COMM, FRAME(COMM), PRESERVE, "Comments"
COMR, FRAME(COMR), PRESERVE, "Commercial frame"
ENCR, FRAME(ENCR), PRESERVE, "Encryption method registration"
EQU2, FRAME(EQU2), DISCARD,  "Equalisation (2)"
ETCO, FRAME(ETCO), DISCARD,  "Event timing codes"
GEOB, FRAME(GEOB), PRESERVE, "General encapsulated object"
GRID, FRAME(GRID), PRESERVE, "Group identification registration"
LINK, FRAME(LINK), PRESERVE, "Linked information"
MCDI, FRAME(MCDI), PRESERVE, "Music CD identifier"
MLLT, FRAME(MLLT), DISCARD,  "MPEG location lookup table"
OWNE, FRAME(OWNE), PRESERVE, "Ownership frame"
PCNT, FRAME(PCNT), PRESERVE, "Play counter"
POPM, FRAME(POPM), PRESERVE, "Popularimeter"
POSS, FRAME(POSS), DISCARD,  "Position synchronisation frame"
PRIV, FRAME(PRIV), PRESERVE, "Private frame"
RBUF, FRAME(RBUF), PRESERVE, "Recommended buffer size"
RVA2, FRAME(RVA2), DISCARD,  "Relative volume adjustment (2)"
RVRB, FRAME(RVRB), PRESERVE, "Reverb"
SEEK, FRAME(SEEK), DISCARD,  "Seek frame"
SIGN, FRAME(SIGN), PRESERVE, "Signature frame"
SYLT, FRAME(SYLT), DISCARD,  "Synchronised lyric/text"
SYTC, FRAME(SYTC), DISCARD,  "Synchronised tempo codes"
TALB, FRAME(text), PRESERVE, "Album/movie/show title"
TBPM, FRAME(text), PRESERVE, "BPM (beats per minute)"
TCOM, FRAME(text), PRESERVE, "Composer"
TCON, FRAME(text), PRESERVE, "Content type"
TCOP, FRAME(text), PRESERVE, "Copyright message"
TDEN, FRAME(text), PRESERVE, "Encoding time"
TDLY, FRAME(text), PRESERVE, "Playlist delay"
TDOR, FRAME(text), PRESERVE, "Original release time"
TDRC, FRAME(text), PRESERVE, "Recording time"
TDRL, FRAME(text), PRESERVE, "Release time"
TDTG, FRAME(text), PRESERVE, "Tagging time"
TENC, FRAME(text), DISCARD,  "Encoded by"
TEXT, FRAME(text), PRESERVE, "Lyricist/text writer"
TFLT, FRAME(text), PRESERVE, "File type"
TIPL, FRAME(text), PRESERVE, "Involved people list"
TIT1, FRAME(text), PRESERVE, "Content group description"
TIT2, FRAME(text), PRESERVE, "Title/songname/content description"
TIT3, FRAME(text), PRESERVE, "Subtitle/description refinement"
TKEY, FRAME(text), PRESERVE, "Initial key"
TLAN, FRAME(text), PRESERVE, "Language(s)"
TLEN, FRAME(text), DISCARD,  "Length"
TMCL, FRAME(text), PRESERVE, "Musician credits list"
TMED, FRAME(text), PRESERVE, "Media type"
TMOO, FRAME(text), PRESERVE, "Mood"
TOAL, FRAME(text), PRESERVE, "Original album/movie/show title"
TOFN, FRAME(text), PRESERVE, "Original filename"
TOLY, FRAME(text), PRESERVE, "Original lyricist(s)/text writer(s)"
TOPE, FRAME(text), PRESERVE, "Original artist(s)/performer(s)"
TOWN, FRAME(text), PRESERVE, "File owner/licensee"
TPE1, FRAME(text), PRESERVE, "Lead performer(s)/soloist(s)"
TPE2, FRAME(text), PRESERVE, "Band/orchestra/accompaniment"
TPE3, FRAME(text), PRESERVE, "Conductor/performer refinement"
TPE4, FRAME(text), PRESERVE, "Interpreted, remixed, or otherwise modified by"
TPOS, FRAME(text), PRESERVE, "Part of a set"
TPRO, FRAME(text), PRESERVE, "Produced notice"
TPUB, FRAME(text), PRESERVE, "Publisher"
TRCK, FRAME(text), PRESERVE, "Track number/position in set"
TRSN, FRAME(text), PRESERVE, "Internet radio station name"
TRSO, FRAME(text), PRESERVE, "Internet radio station owner"
TSOA, FRAME(text), PRESERVE, "Album sort order"
TSOP, FRAME(text), PRESERVE, "Performer sort order"
TSOT, FRAME(text), PRESERVE, "Title sort order"
TSRC, FRAME(text), PRESERVE, "ISRC (international standard recording code)"
TSSE, FRAME(text), PRESERVE, "Software/hardware and settings used for encoding"
TSST, FRAME(text), PRESERVE, "Set subtitle"
TXXX, FRAME(TXXX), PRESERVE, "User defined text information frame"
UFID, FRAME(UFID), PRESERVE, "Unique file identifier"
USER, FRAME(USER), PRESERVE, "Terms of use"
USLT, FRAME(USLT), PRESERVE, "Unsynchronised lyric/text transcription"
WCOM, FRAME(url),  PRESERVE, "Commercial information"
WCOP, FRAME(url),  PRESERVE, "Copyright/legal information"
WOAF, FRAME(url),  PRESERVE, "Official audio file webpage"
WOAR, FRAME(url),  PRESERVE, "Official artist/performer webpage"
WOAS, FRAME(url),  PRESERVE, "Official audio source webpage"
WORS, FRAME(url),  PRESERVE, "Official Internet radio station homepage"
WPAY, FRAME(url),  PRESERVE, "Payment"
WPUB, FRAME(url),  PRESERVE, "Publishers official webpage"
WXXX, FRAME(WXXX), PRESERVE, "User defined URL link frame"
#
# Special frames
#
ZOBS, FRAME(ZOBS), OBSOLETE, "Obsolete frame"
