tag.h 2.1 KB
Newer Older
Warren Dukes's avatar
Warren Dukes committed
1
/* the Music Player Daemon (MPD)
2
 * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
Warren Dukes's avatar
Warren Dukes committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 * This project's homepage is: http://www.musicpd.org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef TAG_H
#define TAG_H

22 23
#include "../config.h"

24 25
#include "mpd_types.h"

26 27 28
#ifdef HAVE_ID3TAG
#include <id3tag.h>
#endif
Warren Dukes's avatar
Warren Dukes committed
29

30 31 32 33 34 35 36
#define TAG_ITEM_ARTIST		0
#define TAG_ITEM_ALBUM		1
#define TAG_ITEM_TITLE		2
#define TAG_ITEM_TRACK		3
#define TAG_ITEM_NAME		4
#define TAG_ITEM_GENRE		5
#define TAG_ITEM_DATE		6
37 38 39
#define TAG_ITEM_COMPOSER	7
#define TAG_ITEM_PERFORMER	8
#define TAG_ITEM_COMMENT	9
40
#define TAG_ITEM_DISC      10
41

42
#define TAG_NUM_OF_ITEM_TYPES	11
43

Max Kellermann's avatar
Max Kellermann committed
44
extern const char *mpdTagItemKeys[];
45 46 47

typedef struct _MpdTagItem {
	mpd_sint8 type;
Avuton Olrich's avatar
Avuton Olrich committed
48
	char *value;
49 50
} MpdTagItem;

Warren Dukes's avatar
Warren Dukes committed
51
typedef struct _MpdTag {
52
	int time;
Avuton Olrich's avatar
Avuton Olrich committed
53
	MpdTagItem *items;
54
	mpd_uint8 numOfItems;
Warren Dukes's avatar
Warren Dukes committed
55 56
} MpdTag;

57
#ifdef HAVE_ID3TAG
Avuton Olrich's avatar
Avuton Olrich committed
58
MpdTag *parseId3Tag(struct id3_tag *);
59 60
#endif

Avuton Olrich's avatar
Avuton Olrich committed
61
MpdTag *apeDup(char *file);
62

Avuton Olrich's avatar
Avuton Olrich committed
63
MpdTag *id3Dup(char *file);
Warren Dukes's avatar
Warren Dukes committed
64

65
MpdTag *newMpdTag(void);
Warren Dukes's avatar
Warren Dukes committed
66

67
void initTagConfig(void);
68 69 70

void clearItemsFromMpdTag(MpdTag * tag, int itemType);

Warren Dukes's avatar
Warren Dukes committed
71 72
void freeMpdTag(MpdTag * tag);

Avuton Olrich's avatar
Avuton Olrich committed
73
void addItemToMpdTagWithLen(MpdTag * tag, int itemType, char *value, int len);
74 75 76 77

#define addItemToMpdTag(tag, itemType, value) \
		addItemToMpdTagWithLen(tag, itemType, value, strlen(value))

78 79
void printTagTypes(int fd);

80
void printMpdTag(int fd, MpdTag * tag);
Warren Dukes's avatar
Warren Dukes committed
81

Avuton Olrich's avatar
Avuton Olrich committed
82
MpdTag *mpdTagDup(MpdTag * tag);
Warren Dukes's avatar
Warren Dukes committed
83

84 85
int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2);

Warren Dukes's avatar
Warren Dukes committed
86
#endif