1 //=========================================================================
2 // FILENAME	: taguilts.h
3 // DESCRIPTION	: Header for tagutils.c
4 //=========================================================================
5 // Copyright (c) 2008- NETGEAR, Inc. All Rights Reserved.
6 //=========================================================================
7 
8 /*
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 /*
24  * This file is derived from mt-daap project.
25  */
26 
27 #ifndef _TAG_H_
28 #define _TAG_H_
29 
30 #include <stdio.h>
31 #include <sys/types.h>
32 #include <sys/stat.h>
33 #include <stdint.h>
34 #include <libgen.h>
35 
36 #define ROLE_NOUSE 0
37 #define ROLE_START 1
38 #define ROLE_ARTIST 1
39 #define ROLE_TRACKARTIST 2
40 #define ROLE_ALBUMARTIST 3
41 #define ROLE_BAND 4
42 #define ROLE_CONDUCTOR 5
43 #define ROLE_COMPOSER 6
44 #define ROLE_LAST 6
45 #define N_ROLE 7
46 
47 struct song_metadata {
48 	int file_size;
49 	char *dirpath;
50 	char *path;
51 	char *basename;                         // basename is part of path
52 	char *type;
53 	int time_modified;
54 
55 	uint8_t *image;                         // coverart
56 	int image_size;
57 
58 	char *title;                            // TIT2
59 	char *album;                            // TALB
60 	char *genre;                            // TCON
61 	char *comment;                          // COMM
62 
63 	char *contributor[N_ROLE];              // TPE1  (artist)
64 						// TCOM  (composer)
65 						// TPE3  (conductor)
66 						// TPE2  (orchestra)
67 	char *contributor_sort[N_ROLE];
68 
69 
70 	char *grouping;                         // TIT1
71 	int year;                               // TDRC
72 	int track;                              // TRCK
73 	int total_tracks;                       // TRCK
74 	int disc;                               // TPOS
75 	int total_discs;                        // TPOS
76 	int bpm;                                // TBPM
77 	char compilation;                       // YTCP
78 
79 	int bitrate;
80 	int max_bitrate;
81 	int samplerate;
82 	int samplesize;
83 	int channels;
84 	int song_length;                        // TLEN
85 	int audio_size;
86 	int audio_offset;
87 	int vbr_scale;
88 	int lossless;
89 	int blockalignment;
90 
91 	char *mime;				// MIME type
92 	char *dlna_pn;				// DLNA Profile Name
93 
94 	char *tagversion;
95 
96 	unsigned long album_id;
97 	unsigned long track_id;
98 	unsigned long genre_id;
99 	unsigned long contributor_id[N_ROLE];
100 
101 	char *musicbrainz_albumid;
102 	char *musicbrainz_trackid;
103 	char *musicbrainz_artistid;
104 	char *musicbrainz_albumartistid;
105 
106 	int is_plist;
107 	int plist_position;
108 	int plist_id;
109 };
110 
111 #define WMA     0x161
112 #define WMAPRO  0x162
113 #define WMALSL  0x163
114 
115 extern int scan_init(char *path);
116 extern void make_composite_tags(struct song_metadata *psong);
117 extern int readtags(char *path, struct song_metadata *psong, struct stat *stat, char *lang, char *type);
118 extern void freetags(struct song_metadata *psong);
119 
120 extern int start_plist(const char *path, struct song_metadata *psong, struct stat *stat, char *lang, char *type);
121 extern int next_plist_track(struct song_metadata *psong, struct stat *stat, char *lang, char *type);
122 
123 #endif
124