annotate win32-mingw/include/id3tag.h @ 69:7aeed7906520

Add Opus sources and macOS builds
author Chris Cannam
date Wed, 23 Jan 2019 13:48:08 +0000
parents 35e00f62c407
children
rev   line source
Chris@6 1 /*
Chris@6 2 * libid3tag - ID3 tag manipulation library
Chris@6 3 * Copyright (C) 2000-2004 Underbit Technologies, Inc.
Chris@6 4 *
Chris@6 5 * This program is free software; you can redistribute it and/or modify
Chris@6 6 * it under the terms of the GNU General Public License as published by
Chris@6 7 * the Free Software Foundation; either version 2 of the License, or
Chris@6 8 * (at your option) any later version.
Chris@6 9 *
Chris@6 10 * This program is distributed in the hope that it will be useful,
Chris@6 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@6 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@6 13 * GNU General Public License for more details.
Chris@6 14 *
Chris@6 15 * You should have received a copy of the GNU General Public License
Chris@6 16 * along with this program; if not, write to the Free Software
Chris@6 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Chris@6 18 *
Chris@6 19 * If you would like to negotiate alternate licensing terms, you may do
Chris@6 20 * so by contacting: Underbit Technologies, Inc. <info@underbit.com>
Chris@6 21 *
Chris@6 22 * $Id: id3tag.h,v 1.17 2004/01/23 23:22:46 rob Exp $
Chris@6 23 */
Chris@6 24
Chris@6 25 # ifndef LIBID3TAG_ID3TAG_H
Chris@6 26 # define LIBID3TAG_ID3TAG_H
Chris@6 27
Chris@6 28 # ifdef __cplusplus
Chris@6 29 extern "C" {
Chris@6 30 # endif
Chris@6 31
Chris@6 32 # define ID3_TAG_VERSION 0x0400
Chris@6 33 # define ID3_TAG_VERSION_MAJOR(x) (((x) >> 8) & 0xff)
Chris@6 34 # define ID3_TAG_VERSION_MINOR(x) (((x) >> 0) & 0xff)
Chris@6 35
Chris@6 36 typedef unsigned char id3_byte_t;
Chris@6 37 typedef unsigned long id3_length_t;
Chris@6 38
Chris@6 39 typedef unsigned long id3_ucs4_t;
Chris@6 40
Chris@6 41 typedef unsigned char id3_latin1_t;
Chris@6 42 typedef unsigned short id3_utf16_t;
Chris@6 43 typedef signed char id3_utf8_t;
Chris@6 44
Chris@6 45 struct id3_tag {
Chris@6 46 unsigned int refcount;
Chris@6 47 unsigned int version;
Chris@6 48 int flags;
Chris@6 49 int extendedflags;
Chris@6 50 int restrictions;
Chris@6 51 int options;
Chris@6 52 unsigned int nframes;
Chris@6 53 struct id3_frame **frames;
Chris@6 54 id3_length_t paddedsize;
Chris@6 55 };
Chris@6 56
Chris@6 57 # define ID3_TAG_QUERYSIZE 10
Chris@6 58
Chris@6 59 /* ID3v1 field frames */
Chris@6 60
Chris@6 61 # define ID3_FRAME_TITLE "TIT2"
Chris@6 62 # define ID3_FRAME_ARTIST "TPE1"
Chris@6 63 # define ID3_FRAME_ALBUM "TALB"
Chris@6 64 # define ID3_FRAME_TRACK "TRCK"
Chris@6 65 # define ID3_FRAME_YEAR "TDRC"
Chris@6 66 # define ID3_FRAME_GENRE "TCON"
Chris@6 67 # define ID3_FRAME_COMMENT "COMM"
Chris@6 68
Chris@6 69 /* special frames */
Chris@6 70
Chris@6 71 # define ID3_FRAME_OBSOLETE "ZOBS" /* with apologies to the French */
Chris@6 72
Chris@6 73 /* tag flags */
Chris@6 74
Chris@6 75 enum {
Chris@6 76 ID3_TAG_FLAG_UNSYNCHRONISATION = 0x80,
Chris@6 77 ID3_TAG_FLAG_EXTENDEDHEADER = 0x40,
Chris@6 78 ID3_TAG_FLAG_EXPERIMENTALINDICATOR = 0x20,
Chris@6 79 ID3_TAG_FLAG_FOOTERPRESENT = 0x10,
Chris@6 80
Chris@6 81 ID3_TAG_FLAG_KNOWNFLAGS = 0xf0
Chris@6 82 };
Chris@6 83
Chris@6 84 /* tag extended flags */
Chris@6 85
Chris@6 86 enum {
Chris@6 87 ID3_TAG_EXTENDEDFLAG_TAGISANUPDATE = 0x40,
Chris@6 88 ID3_TAG_EXTENDEDFLAG_CRCDATAPRESENT = 0x20,
Chris@6 89 ID3_TAG_EXTENDEDFLAG_TAGRESTRICTIONS = 0x10,
Chris@6 90
Chris@6 91 ID3_TAG_EXTENDEDFLAG_KNOWNFLAGS = 0x70
Chris@6 92 };
Chris@6 93
Chris@6 94 /* tag restrictions */
Chris@6 95
Chris@6 96 enum {
Chris@6 97 ID3_TAG_RESTRICTION_TAGSIZE_MASK = 0xc0,
Chris@6 98 ID3_TAG_RESTRICTION_TAGSIZE_128_FRAMES_1_MB = 0x00,
Chris@6 99 ID3_TAG_RESTRICTION_TAGSIZE_64_FRAMES_128_KB = 0x40,
Chris@6 100 ID3_TAG_RESTRICTION_TAGSIZE_32_FRAMES_40_KB = 0x80,
Chris@6 101 ID3_TAG_RESTRICTION_TAGSIZE_32_FRAMES_4_KB = 0xc0
Chris@6 102 };
Chris@6 103
Chris@6 104 enum {
Chris@6 105 ID3_TAG_RESTRICTION_TEXTENCODING_MASK = 0x20,
Chris@6 106 ID3_TAG_RESTRICTION_TEXTENCODING_NONE = 0x00,
Chris@6 107 ID3_TAG_RESTRICTION_TEXTENCODING_LATIN1_UTF8 = 0x20
Chris@6 108 };
Chris@6 109
Chris@6 110 enum {
Chris@6 111 ID3_TAG_RESTRICTION_TEXTSIZE_MASK = 0x18,
Chris@6 112 ID3_TAG_RESTRICTION_TEXTSIZE_NONE = 0x00,
Chris@6 113 ID3_TAG_RESTRICTION_TEXTSIZE_1024_CHARS = 0x08,
Chris@6 114 ID3_TAG_RESTRICTION_TEXTSIZE_128_CHARS = 0x10,
Chris@6 115 ID3_TAG_RESTRICTION_TEXTSIZE_30_CHARS = 0x18
Chris@6 116 };
Chris@6 117
Chris@6 118 enum {
Chris@6 119 ID3_TAG_RESTRICTION_IMAGEENCODING_MASK = 0x04,
Chris@6 120 ID3_TAG_RESTRICTION_IMAGEENCODING_NONE = 0x00,
Chris@6 121 ID3_TAG_RESTRICTION_IMAGEENCODING_PNG_JPEG = 0x04
Chris@6 122 };
Chris@6 123
Chris@6 124 enum {
Chris@6 125 ID3_TAG_RESTRICTION_IMAGESIZE_MASK = 0x03,
Chris@6 126 ID3_TAG_RESTRICTION_IMAGESIZE_NONE = 0x00,
Chris@6 127 ID3_TAG_RESTRICTION_IMAGESIZE_256_256 = 0x01,
Chris@6 128 ID3_TAG_RESTRICTION_IMAGESIZE_64_64 = 0x02,
Chris@6 129 ID3_TAG_RESTRICTION_IMAGESIZE_64_64_EXACT = 0x03
Chris@6 130 };
Chris@6 131
Chris@6 132 /* library options */
Chris@6 133
Chris@6 134 enum {
Chris@6 135 ID3_TAG_OPTION_UNSYNCHRONISATION = 0x0001, /* use unsynchronisation */
Chris@6 136 ID3_TAG_OPTION_COMPRESSION = 0x0002, /* use compression */
Chris@6 137 ID3_TAG_OPTION_CRC = 0x0004, /* use CRC */
Chris@6 138
Chris@6 139 ID3_TAG_OPTION_APPENDEDTAG = 0x0010, /* tag will be appended */
Chris@6 140 ID3_TAG_OPTION_FILEALTERED = 0x0020, /* audio data was altered */
Chris@6 141
Chris@6 142 ID3_TAG_OPTION_ID3V1 = 0x0100 /* render ID3v1/ID3v1.1 tag */
Chris@6 143 };
Chris@6 144
Chris@6 145 struct id3_frame {
Chris@6 146 char id[5];
Chris@6 147 char const *description;
Chris@6 148 unsigned int refcount;
Chris@6 149 int flags;
Chris@6 150 int group_id;
Chris@6 151 int encryption_method;
Chris@6 152 id3_byte_t *encoded;
Chris@6 153 id3_length_t encoded_length;
Chris@6 154 id3_length_t decoded_length;
Chris@6 155 unsigned int nfields;
Chris@6 156 union id3_field *fields;
Chris@6 157 };
Chris@6 158
Chris@6 159 enum {
Chris@6 160 /* frame status flags */
Chris@6 161 ID3_FRAME_FLAG_TAGALTERPRESERVATION = 0x4000,
Chris@6 162 ID3_FRAME_FLAG_FILEALTERPRESERVATION = 0x2000,
Chris@6 163 ID3_FRAME_FLAG_READONLY = 0x1000,
Chris@6 164
Chris@6 165 ID3_FRAME_FLAG_STATUSFLAGS = 0xff00,
Chris@6 166
Chris@6 167 /* frame format flags */
Chris@6 168 ID3_FRAME_FLAG_GROUPINGIDENTITY = 0x0040,
Chris@6 169 ID3_FRAME_FLAG_COMPRESSION = 0x0008,
Chris@6 170 ID3_FRAME_FLAG_ENCRYPTION = 0x0004,
Chris@6 171 ID3_FRAME_FLAG_UNSYNCHRONISATION = 0x0002,
Chris@6 172 ID3_FRAME_FLAG_DATALENGTHINDICATOR = 0x0001,
Chris@6 173
Chris@6 174 ID3_FRAME_FLAG_FORMATFLAGS = 0x00ff,
Chris@6 175
Chris@6 176 ID3_FRAME_FLAG_KNOWNFLAGS = 0x704f
Chris@6 177 };
Chris@6 178
Chris@6 179 enum id3_field_type {
Chris@6 180 ID3_FIELD_TYPE_TEXTENCODING,
Chris@6 181 ID3_FIELD_TYPE_LATIN1,
Chris@6 182 ID3_FIELD_TYPE_LATIN1FULL,
Chris@6 183 ID3_FIELD_TYPE_LATIN1LIST,
Chris@6 184 ID3_FIELD_TYPE_STRING,
Chris@6 185 ID3_FIELD_TYPE_STRINGFULL,
Chris@6 186 ID3_FIELD_TYPE_STRINGLIST,
Chris@6 187 ID3_FIELD_TYPE_LANGUAGE,
Chris@6 188 ID3_FIELD_TYPE_FRAMEID,
Chris@6 189 ID3_FIELD_TYPE_DATE,
Chris@6 190 ID3_FIELD_TYPE_INT8,
Chris@6 191 ID3_FIELD_TYPE_INT16,
Chris@6 192 ID3_FIELD_TYPE_INT24,
Chris@6 193 ID3_FIELD_TYPE_INT32,
Chris@6 194 ID3_FIELD_TYPE_INT32PLUS,
Chris@6 195 ID3_FIELD_TYPE_BINARYDATA
Chris@6 196 };
Chris@6 197
Chris@6 198 enum id3_field_textencoding {
Chris@6 199 ID3_FIELD_TEXTENCODING_ISO_8859_1 = 0x00,
Chris@6 200 ID3_FIELD_TEXTENCODING_UTF_16 = 0x01,
Chris@6 201 ID3_FIELD_TEXTENCODING_UTF_16BE = 0x02,
Chris@6 202 ID3_FIELD_TEXTENCODING_UTF_8 = 0x03
Chris@6 203 };
Chris@6 204
Chris@6 205 union id3_field {
Chris@6 206 enum id3_field_type type;
Chris@6 207 struct {
Chris@6 208 enum id3_field_type type;
Chris@6 209 signed long value;
Chris@6 210 } number;
Chris@6 211 struct {
Chris@6 212 enum id3_field_type type;
Chris@6 213 id3_latin1_t *ptr;
Chris@6 214 } latin1;
Chris@6 215 struct {
Chris@6 216 enum id3_field_type type;
Chris@6 217 unsigned int nstrings;
Chris@6 218 id3_latin1_t **strings;
Chris@6 219 } latin1list;
Chris@6 220 struct {
Chris@6 221 enum id3_field_type type;
Chris@6 222 id3_ucs4_t *ptr;
Chris@6 223 } string;
Chris@6 224 struct {
Chris@6 225 enum id3_field_type type;
Chris@6 226 unsigned int nstrings;
Chris@6 227 id3_ucs4_t **strings;
Chris@6 228 } stringlist;
Chris@6 229 struct {
Chris@6 230 enum id3_field_type type;
Chris@6 231 char value[9];
Chris@6 232 } immediate;
Chris@6 233 struct {
Chris@6 234 enum id3_field_type type;
Chris@6 235 id3_byte_t *data;
Chris@6 236 id3_length_t length;
Chris@6 237 } binary;
Chris@6 238 };
Chris@6 239
Chris@6 240 /* file interface */
Chris@6 241
Chris@6 242 enum id3_file_mode {
Chris@6 243 ID3_FILE_MODE_READONLY = 0,
Chris@6 244 ID3_FILE_MODE_READWRITE
Chris@6 245 };
Chris@6 246
Chris@6 247 struct id3_file *id3_file_open(char const *, enum id3_file_mode);
Chris@6 248 struct id3_file *id3_file_fdopen(int, enum id3_file_mode);
Chris@6 249 int id3_file_close(struct id3_file *);
Chris@6 250
Chris@6 251 struct id3_tag *id3_file_tag(struct id3_file const *);
Chris@6 252
Chris@6 253 int id3_file_update(struct id3_file *);
Chris@6 254
Chris@6 255 /* tag interface */
Chris@6 256
Chris@6 257 struct id3_tag *id3_tag_new(void);
Chris@6 258 void id3_tag_delete(struct id3_tag *);
Chris@6 259
Chris@6 260 unsigned int id3_tag_version(struct id3_tag const *);
Chris@6 261
Chris@6 262 int id3_tag_options(struct id3_tag *, int, int);
Chris@6 263 void id3_tag_setlength(struct id3_tag *, id3_length_t);
Chris@6 264
Chris@6 265 void id3_tag_clearframes(struct id3_tag *);
Chris@6 266
Chris@6 267 int id3_tag_attachframe(struct id3_tag *, struct id3_frame *);
Chris@6 268 int id3_tag_detachframe(struct id3_tag *, struct id3_frame *);
Chris@6 269
Chris@6 270 struct id3_frame *id3_tag_findframe(struct id3_tag const *,
Chris@6 271 char const *, unsigned int);
Chris@6 272
Chris@6 273 signed long id3_tag_query(id3_byte_t const *, id3_length_t);
Chris@6 274
Chris@6 275 struct id3_tag *id3_tag_parse(id3_byte_t const *, id3_length_t);
Chris@6 276 id3_length_t id3_tag_render(struct id3_tag const *, id3_byte_t *);
Chris@6 277
Chris@6 278 /* frame interface */
Chris@6 279
Chris@6 280 struct id3_frame *id3_frame_new(char const *);
Chris@6 281 void id3_frame_delete(struct id3_frame *);
Chris@6 282
Chris@6 283 union id3_field *id3_frame_field(struct id3_frame const *, unsigned int);
Chris@6 284
Chris@6 285 /* field interface */
Chris@6 286
Chris@6 287 enum id3_field_type id3_field_type(union id3_field const *);
Chris@6 288
Chris@6 289 int id3_field_setint(union id3_field *, signed long);
Chris@6 290 int id3_field_settextencoding(union id3_field *, enum id3_field_textencoding);
Chris@6 291 int id3_field_setstrings(union id3_field *, unsigned int, id3_ucs4_t **);
Chris@6 292 int id3_field_addstring(union id3_field *, id3_ucs4_t const *);
Chris@6 293 int id3_field_setlanguage(union id3_field *, char const *);
Chris@6 294 int id3_field_setlatin1(union id3_field *, id3_latin1_t const *);
Chris@6 295 int id3_field_setfulllatin1(union id3_field *, id3_latin1_t const *);
Chris@6 296 int id3_field_setstring(union id3_field *, id3_ucs4_t const *);
Chris@6 297 int id3_field_setfullstring(union id3_field *, id3_ucs4_t const *);
Chris@6 298 int id3_field_setframeid(union id3_field *, char const *);
Chris@6 299 int id3_field_setbinarydata(union id3_field *,
Chris@6 300 id3_byte_t const *, id3_length_t);
Chris@6 301
Chris@6 302 signed long id3_field_getint(union id3_field const *);
Chris@6 303 enum id3_field_textencoding id3_field_gettextencoding(union id3_field const *);
Chris@6 304 id3_latin1_t const *id3_field_getlatin1(union id3_field const *);
Chris@6 305 id3_latin1_t const *id3_field_getfulllatin1(union id3_field const *);
Chris@6 306 id3_ucs4_t const *id3_field_getstring(union id3_field const *);
Chris@6 307 id3_ucs4_t const *id3_field_getfullstring(union id3_field const *);
Chris@6 308 unsigned int id3_field_getnstrings(union id3_field const *);
Chris@6 309 id3_ucs4_t const *id3_field_getstrings(union id3_field const *,
Chris@6 310 unsigned int);
Chris@6 311 char const *id3_field_getframeid(union id3_field const *);
Chris@6 312 id3_byte_t const *id3_field_getbinarydata(union id3_field const *,
Chris@6 313 id3_length_t *);
Chris@6 314
Chris@6 315 /* genre interface */
Chris@6 316
Chris@6 317 id3_ucs4_t const *id3_genre_index(unsigned int);
Chris@6 318 id3_ucs4_t const *id3_genre_name(id3_ucs4_t const *);
Chris@6 319 int id3_genre_number(id3_ucs4_t const *);
Chris@6 320
Chris@6 321 /* ucs4 interface */
Chris@6 322
Chris@6 323 id3_latin1_t *id3_ucs4_latin1duplicate(id3_ucs4_t const *);
Chris@6 324 id3_utf16_t *id3_ucs4_utf16duplicate(id3_ucs4_t const *);
Chris@6 325 id3_utf8_t *id3_ucs4_utf8duplicate(id3_ucs4_t const *);
Chris@6 326
Chris@6 327 void id3_ucs4_putnumber(id3_ucs4_t *, unsigned long);
Chris@6 328 unsigned long id3_ucs4_getnumber(id3_ucs4_t const *);
Chris@6 329
Chris@6 330 /* latin1/utf16/utf8 interfaces */
Chris@6 331
Chris@6 332 id3_ucs4_t *id3_latin1_ucs4duplicate(id3_latin1_t const *);
Chris@6 333 id3_ucs4_t *id3_utf16_ucs4duplicate(id3_utf16_t const *);
Chris@6 334 id3_ucs4_t *id3_utf8_ucs4duplicate(id3_utf8_t const *);
Chris@6 335
Chris@6 336 /* version interface */
Chris@6 337
Chris@6 338 # define ID3_VERSION_MAJOR 0
Chris@6 339 # define ID3_VERSION_MINOR 15
Chris@6 340 # define ID3_VERSION_PATCH 1
Chris@6 341 # define ID3_VERSION_EXTRA " (beta)"
Chris@6 342
Chris@6 343 # define ID3_VERSION_STRINGIZE(str) #str
Chris@6 344 # define ID3_VERSION_STRING(num) ID3_VERSION_STRINGIZE(num)
Chris@6 345
Chris@6 346 # define ID3_VERSION ID3_VERSION_STRING(ID3_VERSION_MAJOR) "." \
Chris@6 347 ID3_VERSION_STRING(ID3_VERSION_MINOR) "." \
Chris@6 348 ID3_VERSION_STRING(ID3_VERSION_PATCH) \
Chris@6 349 ID3_VERSION_EXTRA
Chris@6 350
Chris@6 351 # define ID3_PUBLISHYEAR "2000-2004"
Chris@6 352 # define ID3_AUTHOR "Underbit Technologies, Inc."
Chris@6 353 # define ID3_EMAIL "info@underbit.com"
Chris@6 354
Chris@6 355 extern char const id3_version[];
Chris@6 356 extern char const id3_copyright[];
Chris@6 357 extern char const id3_author[];
Chris@6 358 extern char const id3_build[];
Chris@6 359
Chris@6 360 # ifdef __cplusplus
Chris@6 361 }
Chris@6 362 # endif
Chris@6 363
Chris@6 364 # endif