-
Notifications
You must be signed in to change notification settings - Fork 0
/
ID3Frame.h
executable file
·113 lines (86 loc) · 2.59 KB
/
ID3Frame.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//
// ID3Frame.h
//
//#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import "ID3Parser.h"
//Boilerplate for ID3 FRAME header
#ifndef ID3_FRAMEHDR
#define ID3_FRAMEHDR
/*-------------- Frame Header -----------------*/
//id3v2.4
#define V4_FRAMEHDR_LENGTH 10
#define V4_FRAMEHDR_SIZE_OFFSET 4
#define V4_FRAMEHDR_FLAGS_OFFSET 8
#define V4_FRAMEHDR_FLAGS_SIZE 2
#define V4_FRAMEHDR_ID_SIZE 4
//id3v2.3
#define V3_FRAMEHDR_LENGTH 10
#define V3_FRAMEHDR_SIZE_OFFSET 4
#define V3_FRAMEHDR_FLAGS_OFFSET 8
#define V3_FRAMEHDR_FLAGS_SIZE 2
#define V3_FRAMEHDR_ID_SIZE 4
//id3v2.2
#define V2_FRAMEHDR_LENGTH 6
#define V2_FRAMEHDR_SIZE_OFFSET 3
#define V2_FRAMEHDR_ID_SIZE 3
/*--------------- Frame Flags -------------------*/
//id3v2.4
#define V4_FRAMEHDR_FLAG_TAGALTER 64
#define V4_FRAMEHDR_FLAG_FILEALTER 32
#define V4_FRAMEHDR_FLAG_READONLY 16
#define V4_FRAMEHDR_FLAG_GROUPIDENT 64
#define V4_FRAMEHDR_FLAG_COMPRESSION 8
#define V4_FRAMEHDR_FLAG_ENCRYPTION 4
#define V4_FRAMEHDR_FLAG_UNSYNC 2
#define V4_FRAMEHDR_FLAG_DATALEN 1
//id3v2.3
#define V3_FRAMEHDR_FLAG_TAGALTER 128
#define V3_FRAMEHDR_FLAG_FILEALTER 64
#define V3_FRAMEHDR_FLAG_READONLY 32
#define V3_FRAMEHDR_FLAG_COMPRESSION 128
#define V3_FRAMEHDR_FLAG_ENCRYPTION 64
#define V3_FRAMEHDR_FLAG_GROUPIDENT 32
#define ID3_FRAMEHDR_TYPE_T 'T'
#define ID3_FRAMEHDR_TYPE_W 'W'
#endif
@interface ID3Frame : NSObject
{
NSString *frameID;
NSString *frameDescription;
NSUInteger size;
ID3_VERSION majorVersion;
NSData *flags;
NSData *dataForParsing;
//Frame status flags
BOOL tagAlterPreserve;
BOOL fileAlterPreserve;
BOOL readOnly;
//Frame format flags
BOOL groupingIdentity;
BOOL compression;
BOOL encryption;
BOOL unsynchronisation;
BOOL dataLengthIndicator;
}
//Frame Values
@property ID3_VERSION majorVersion;
@property (copy) NSString *frameID;
@property (copy) NSString *frameDescription;
@property NSUInteger size;
@property (retain) NSData *flags;
@property (retain) NSData *dataForParsing;
//Frame Flags
@property BOOL tagAlterPreserve;
@property BOOL fileAlterPreserve;
@property BOOL readOnly;
@property BOOL groupingIdentity;
@property BOOL compression;
@property BOOL encryption;
@property BOOL unsynchronisation;
@property BOOL dataLengthIndicator;
+ (id)getFrameFromBytes:(const void*)bytes version:(ID3_VERSION)version error:(NSError **)error;
- (id)initWithID:(NSString *)frameIDString description:(NSString *)description version:(ID3_VERSION)version andBytes:(const void*)bytes error:(NSError **)error;
- (BOOL)setFlagPropertiesForData:(NSData *)data error:(NSError **)error;
- (NSDictionary *)descriptionOfFrame;
@end