annotate win64-msvc/include/id3tag.h @ 45:d530e058a1c1

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