~moody/mpl

mpl/dat.h -rw-r--r-- 1.7 KiB
7309e0f2 — Jacob Moody Archive and point to zuke 6 months ago
                                                                                
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
enum cmsg{
	NEXT,
	PREV,
	STOP,
	START,
	PAUSE,
	DUMP,
};

enum volmsg{
	UP,
	DOWN,
	MUTE,
	UNMUTE,
};

/*
 * ID3v1 represents the first version of ID3 metainformation.
 * The spec does not define character set, so we treat it as
 * UTF8, which should cover most bases.
 * See: http://id3.org/ID3v1
 */
typedef struct ID3v1 ID3v1;
struct ID3v1{
	Rune 	*title;
	Rune 	*artist;
	Rune 	*album;
	int	year;
	Rune	*comment;
	char	genre;
};

typedef struct VorbisMeta VorbisMeta;
struct VorbisMeta{
	/* Raw values */
	uint ncom;
	Rune **key;
	Rune **val;

	/* Common Tags */
	Rune *title;
	Rune *artist;
	Rune *album;
	int year;
	int tracknumber;
};

typedef struct FlacPic FlacPic;
struct FlacPic{
	char *mime;
	Rune *desc;
	Point p;
	uvlong size;
	uchar *data;
};

typedef struct FlacMeta FlacMeta;
struct FlacMeta{
	VorbisMeta;
	FlacPic;
};


enum metatype{
	FLAC,
	MP3,
	VORBIS,
	RADIO,
};

typedef struct Song Song;
struct Song{
	enum metatype type;
	union {
		FlacMeta *fmeta;
		VorbisMeta *vmeta;
		ID3v1 *idmeta;
		Rune *title;
	};
	char *path;
};

typedef struct Album Album;
struct Album{
	Rune *name;
	Image *cover;
	int nsong;
	Song *songs;

	int nocover;
};

typedef struct Lib Lib;
struct Lib{
	int nalbum, cursong;
	Album *start, *stop, *cur;
	char *name;
};

enum {
	CSONG,
	CLIST,
};

typedef struct Click Click;
struct Click{
	Rectangle r;
	int type; /* Either CSONG or CLIST */

	/* For song events */
	Album *a;
	int songnum;

	/* For list events */
	char *list;
};

/*
 * Simple hashmap implementation.
 * Hnode key must be non nil.
 */
typedef struct Hmap Hmap;
typedef struct Hnode Hnode;
struct Hmap{
	RWLock;
	int size;
	struct Hnode{
		char *key;
		void *val;
		Hnode *next;
	} *nodes;
};