0
|
1 /*********************************************************************
|
|
2 *
|
|
3 * Copyright (C) 1998, 1999, Espen Skoglund
|
|
4 * Department of Computer Science, University of Tromsų
|
|
5 *
|
|
6 * Filename: id3_header.h
|
|
7 * Description: Definitions for various ID3 headers.
|
|
8 * Author: Espen Skoglund <espensk@stud.cs.uit.no>
|
|
9 * Created at: Thu Nov 5 15:55:10 1998
|
|
10 *
|
|
11 * $Id: id3_header.h,v 1.4 2004/04/13 23:53:01 descender Exp $
|
|
12 *
|
|
13 * This program is free software; you can redistribute it and/or
|
|
14 * modify it under the terms of the GNU General Public License
|
|
15 * as published by the Free Software Foundation; either version 2
|
|
16 * of the License, or (at your option) any later version.
|
|
17 *
|
|
18 * This program is distributed in the hope that it will be useful,
|
|
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21 * GNU General Public License for more details.
|
|
22 *
|
|
23 * You should have received a copy of the GNU General Public License
|
|
24 * along with this program; if not, write to the Free Software
|
|
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
26 *
|
|
27 ********************************************************************/
|
|
28 #ifndef ID3_HEADER_H
|
|
29 #define ID3_HEADER_H
|
|
30
|
|
31 #include <stdio.h>
|
|
32
|
|
33 /*
|
|
34 * Layout for the ID3 tag header.
|
|
35 */
|
|
36 #if 0
|
|
37 struct id3_taghdr {
|
|
38 guint8 th_version;
|
|
39 guint8 th_revision;
|
|
40 guint8 th_flags;
|
|
41 guint32 th_size;
|
|
42 };
|
|
43 #endif
|
|
44
|
|
45 /* Header size excluding "ID3" */
|
|
46 #define ID3_TAGHDR_SIZE 7 /* Size on disk */
|
|
47
|
|
48 #define ID3_THFLAG_USYNC 0x80000000
|
|
49 #define ID3_THFLAG_EXT 0x40000000
|
|
50 #define ID3_THFLAG_EXP 0x20000000
|
|
51
|
|
52 #if 0
|
|
53 #define ID3_SET_SIZE28(size) \
|
|
54 ( ((size << 3) & 0x7f000000) | \
|
|
55 ((size << 2) & 0x007f0000) | \
|
|
56 ((size << 1) & 0x00007f00) | \
|
|
57 ((size ) & 0x0000007f) )
|
|
58
|
|
59 #define ID3_GET_SIZE28(size) \
|
|
60 ( ((size & 0x7f000000) >> 3) | \
|
|
61 ((size & 0x007f0000) >> 2) | \
|
|
62 ((size & 0x00007f00) >> 1) | \
|
|
63 ((size & 0x0000007f) ) )
|
|
64 #endif
|
|
65
|
|
66 #define ID3_SET_SIZE28(size, a, b, c, d) \
|
|
67 do { \
|
|
68 a = (size >> (24 + 3)) & 0x7f; \
|
|
69 b = (size >> (16 + 2)) & 0x7f; \
|
|
70 c = (size >> ( 8 + 1)) & 0x7f; \
|
|
71 d = size & 0x7f; \
|
|
72 } while (0)
|
|
73
|
|
74 #define ID3_GET_SIZE28(a, b, c, d) \
|
|
75 (((a & 0x7f) << (24 - 3)) | \
|
|
76 ((b & 0x7f) << (16 - 2)) | \
|
|
77 ((c & 0x7f) << ( 8 - 1)) | \
|
|
78 ((d & 0x7f)))
|
|
79
|
|
80
|
|
81
|
|
82 /*
|
|
83 * Layout for the extended header.
|
|
84 */
|
|
85 #if 0
|
|
86 struct id3_exthdr {
|
|
87 guint32 eh_size;
|
|
88 guint16 eh_flags;
|
|
89 guint32 eh_padsize;
|
|
90 };
|
|
91 #endif
|
|
92
|
|
93 #define ID3_EXTHDR_SIZE 10
|
|
94
|
|
95 #define ID3_EHFLAG_CRC 0x80000000
|
|
96
|
|
97
|
|
98
|
|
99 /*
|
|
100 * Layout for the frame header.
|
|
101 */
|
|
102 #if 0
|
|
103 struct id3_framehdr {
|
|
104 guint32 fh_id;
|
|
105 guint32 fh_size;
|
|
106 guint16 fh_flags;
|
|
107 };
|
|
108 #endif
|
|
109
|
|
110 #define ID3_FRAMEHDR_SIZE 10
|
|
111
|
|
112
|
|
113 #define ID3_FHFLAG_TAGALT 0x8000
|
|
114 #define ID3_FHFLAG_FILEALT 0x4000
|
|
115 #define ID3_FHFLAG_RO 0x2000
|
|
116 #define ID3_FHFLAG_COMPRESS 0x0080
|
|
117 #define ID3_FHFLAG_ENCRYPT 0x0040
|
|
118 #define ID3_FHFLAG_GROUP 0x0020
|
|
119
|
|
120
|
|
121 typedef enum {
|
|
122 ID3_UNI_LATIN = 0x007f,
|
|
123 ID3_UNI_LATIN_1 = 0x00ff,
|
|
124
|
|
125 ID3_UNI_SUPPORTED = 0x00ff,
|
|
126 ID3_UNI_UNSUPPORTED = 0xffff,
|
|
127 } id3_unicode_blocks;
|
|
128
|
|
129 #define DEBUG_ID3
|
|
130 #ifdef DEBUG_ID3
|
|
131 #define id3_error(id3, error) \
|
|
132 (void) ( id3->id3_error_msg = error, \
|
|
133 printf( "Error %s, line %d: %s\n", __FILE__, __LINE__, error ) )
|
|
134
|
|
135
|
|
136 #else
|
|
137 #define id3_error(id3, error) \
|
|
138 (void) ( id3->id3_error_msg = error )
|
|
139
|
|
140 #endif
|
|
141
|
|
142 /*
|
|
143 * Version 2.2.0
|
|
144 */
|
|
145
|
|
146 /*
|
|
147 * Layout for the frame header.
|
|
148 */
|
|
149 #if 0
|
|
150 struct id3_framehdr {
|
|
151 char fh_id[3];
|
|
152 guint8 fh_size[3];
|
|
153 };
|
|
154 #endif
|
|
155
|
|
156 #define ID3_FRAMEHDR_SIZE_22 6
|
|
157
|
|
158 #endif /* ID3_HEADER_H */
|