summaryrefslogtreecommitdiff
path: root/sys/src/cmd/audio/zuke/plist.h
blob: 563d5a03ffd154695db73a46b22ecfea068c7df4 (plain)
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
/* Playlist begins with "# x\n" where x is the total number of records.
 * Each record begins with "# x y\n" where x is record index, y is its size in bytes.
 * Records are sorted according to mkplist.c:/^cmpmeta function.
 * This makes it somewhat easy to just load the whole playlist into memory once,
 * map all (Meta*)->... fields to it, saving on memory allocations, and using the same
 * data to provide poor's man full text searching.
 * Encoding: mkplist.c:/^printmeta/.
 * Decoding: zuke.c:/^readplist/.
 */
enum
{
	Precord='#',

	Palbum=			'a',
	Partist=		'A',
	Pbasename=		'b',
	Pdate=			'd',
	Pduration=		'D',
	Pimage=			'i',
	Ptitle=			't',
	Ptrack=			'T',
	Ppath=			'p',
	Pfilefmt=		'f',

	/* unused */
	Pchannels=		'c',
	Psamplerate=	's',

	Maxartist=16, /* max artists for a track */
};

typedef struct Meta Meta;

struct Meta
{
	char *artist[Maxartist];
	char *album;
	char *title;
	char *date;
	char *track;
	char *path;
	char *basename;
	char *imagefmt;
	char *filefmt;
	uvlong duration;
	int numartist;
	int imageoffset;
	int imagesize;
	int imagereader; /* non-zero if a special reader required */
};

void printmeta(Biobuf *b, Meta *m);