| 1 |
/* |
| 2 |
* Copyright 2008-2011 Various Authors |
| 3 |
* Copyright 2007 Johannes Weißl |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU General Public License as |
| 7 |
* published by the Free Software Foundation; either version 2 of the |
| 8 |
* License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifndef _APE_H |
| 20 |
#define _APE_H |
| 21 |
|
| 22 |
#include <stdint.h> |
| 23 |
#include <stdlib.h> |
| 24 |
|
| 25 |
struct ape_header { |
| 26 |
/* 1000 or 2000 (1.0, 2.0) */ |
| 27 |
uint32_t version; |
| 28 |
|
| 29 |
/* tag size (header + tags, excluding footer) */ |
| 30 |
uint32_t size; |
| 31 |
|
| 32 |
/* number of items */ |
| 33 |
uint32_t count; |
| 34 |
|
| 35 |
/* global flags for each tag |
| 36 |
* there are also private flags for every tag |
| 37 |
* NOTE: 0 for version 1.0 (1000) |
| 38 |
*/ |
| 39 |
uint32_t flags; |
| 40 |
}; |
| 41 |
|
| 42 |
/* ape flags */ |
| 43 |
#define AF_IS_UTF8(f) (((f) & 6) == 0) |
| 44 |
#define AF_IS_FOOTER(f) (((f) & (1 << 29)) == 0) |
| 45 |
|
| 46 |
struct apetag { |
| 47 |
char *buf; |
| 48 |
int pos; |
| 49 |
struct ape_header header; |
| 50 |
}; |
| 51 |
|
| 52 |
#define APETAG(name) struct apetag name = { .buf = NULL, .pos = 0, } |
| 53 |
|
| 54 |
int ape_read_tags(struct apetag *ape, int fd, int slow); |
| 55 |
char *ape_get_comment(struct apetag *ape, char **val); |
| 56 |
|
| 57 |
static inline void ape_free(struct apetag *ape) |
| 58 |
{ |
| 59 |
free(ape->buf); |
| 60 |
} |
| 61 |
|
| 62 |
#endif |