Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /* -*- C -*- |
---|---|
2 | This is part of the audio CD player library |
3 | Copyright (C)1998-99 Tony Arcieri |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public |
16 | License along with this library; if not, write to the |
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. |
19 | */ |
20 | |
21 | /* WARNING: do not modify cdaudio.h, it is generated from cdaudio.h.in */ |
22 | |
23 | #ifndef _CDAUDIO_H |
24 | #define _CDAUDIO_H |
25 | |
26 | #define LIBCDAUDIO_VERSION_MAJOR 0 |
27 | #define LIBCDAUDIO_VERSION_MINOR 99 |
28 | #define LIBCDAUDIO_VERSION_MICRO 12 |
29 | |
30 | #define LIBCDAUDIO_VERSION \ |
31 | ((LIBCDAUDIO_VERSION_MAJOR<<16)| \ |
32 | (LIBCDAUDIO_VERSION_MINOR<< 8)| \ |
33 | (LIBCDAUDIO_VERSION_MICRO)) |
34 | |
35 | /* Used with disc_info */ |
36 | enum cd_cdaudio_status_t { |
37 | CDAUDIO_PLAYING, CDAUDIO_PAUSED, CDAUDIO_COMPLETED, |
38 | CDAUDIO_NOSTATUS, CDAUDIO_INVALID, CDAUDIO_ERROR |
39 | }; |
40 | |
41 | #if 0 |
42 | #define CDAUDIO_PLAYING 0 |
43 | #define CDAUDIO_PAUSED 1 |
44 | #define CDAUDIO_COMPLETED 2 |
45 | #define CDAUDIO_NOSTATUS 3 |
46 | #define CDAUDIO_INVALID 4 |
47 | #define CDAUDIO_ERROR 5 |
48 | #endif |
49 | |
50 | enum cd_track_type_t { CDAUDIO_TRACK_AUDIO, CDAUDIO_TRACK_DATA }; |
51 | |
52 | #if 0 |
53 | #define CDAUDIO_TRACK_AUDIO 0 |
54 | #define CDAUDIO_TRACK_DATA 1 |
55 | #endif |
56 | |
57 | #define MAX_TRACKS 100 |
58 | #define MAX_SLOTS 100 /* For CD changers */ |
59 | |
60 | /* CDDB defaults */ |
61 | #define CDDB_PROTOCOL_LEVEL 3 |
62 | #define CDDBP_DEFAULT_PORT 888 |
63 | #define HTTP_DEFAULT_PORT 80 |
64 | #define CDDB_EMAIL_SUBMIT_ADDRESS "freedb-submit@freedb.org" |
65 | #define HTTP_SUBMIT_CGI "/~cddb/submit.cgi" |
66 | #define CDINDEX_SUBMIT_CGI "/cgi-bin/cdi/xsubmit.pl" |
67 | #define CDDB_SUBMIT_HTTP 0 |
68 | #define CDDB_SUBMIT_EMAIL 1 |
69 | #define CDDB_SUBMIT_MODE 0 |
70 | #define CDDB_MAX_SERVERS 128 |
71 | #define MAX_INEXACT_MATCHES 16 |
72 | #define EXTENDED_DATA_SIZE 4096 |
73 | #define DISC_ART_SIZE 32768 |
74 | #define CDINDEX_ID_SIZE 30 |
75 | |
76 | /* Connection modes */ |
77 | enum cd_connection_mode_t { |
78 | CDDB_MODE_CDDBP, CDDB_MODE_HTTP, CDINDEX_MODE_HTTP, |
79 | COVERART_MODE_HTTP |
80 | }; |
81 | |
82 | enum cd_cddb_access_t { CDDB_ACCESS_LOCAL, CDDB_ACCESS_REMOTE }; |
83 | enum cd_cddb_proxy_t { CDDB_PROXY_DISABLED, CDDB_PROXY_ENABLED }; |
84 | |
85 | #if 0 |
86 | #define CDDB_MODE_CDDBP 0 |
87 | #define CDDB_MODE_HTTP 1 |
88 | #define CDINDEX_MODE_HTTP 2 |
89 | #define COVERART_MODE_HTTP 3 |
90 | #define CDDB_ACCESS_LOCAL 0 |
91 | #define CDDB_ACCESS_REMOTE 1 |
92 | #define CDDB_PROXY_DISABLED 0 |
93 | #define CDDB_PROXY_ENABLED 1 |
94 | #endif |
95 | |
96 | /* CDDB genres */ |
97 | enum cd_cddb_genre_t { |
98 | CDDB_UNKNOWN, CDDB_BLUES, CDDB_CLASSICAL, CDDB_COUNTRY, CDDB_DATA, |
99 | CDDB_FOLK, CDDB_JAZZ, CDDB_MISC, CDDB_NEWAGE, CDDB_REGGAE, |
100 | CDDB_ROCK, CDDB_SOUNDTRACK |
101 | }; |
102 | |
103 | #if 0 |
104 | #define CDDB_UNKNOWN 0 |
105 | #define CDDB_BLUES 1 |
106 | #define CDDB_CLASSICAL 2 |
107 | #define CDDB_COUNTRY 3 |
108 | #define CDDB_DATA 4 |
109 | #define CDDB_FOLK 5 |
110 | #define CDDB_JAZZ 6 |
111 | #define CDDB_MISC 7 |
112 | #define CDDB_NEWAGE 8 |
113 | #define CDDB_REGGAE 9 |
114 | #define CDDB_ROCK 10 |
115 | #define CDDB_SOUNDTRACK 11 |
116 | #endif |
117 | |
118 | /* CD Index artist types */ |
119 | enum cd_cdindex_artist_t { |
120 | CDINDEX_SINGLE_ARTIST, CDINDEX_MULTIPLE_ARTIST |
121 | }; |
122 | |
123 | #if 0 |
124 | #define CDINDEX_SINGLE_ARTIST 0 |
125 | #define CDINDEX_MULTIPLE_ARTIST 1 |
126 | #endif |
127 | |
128 | /* Play function options */ |
129 | enum cd_play_function_t { |
130 | PLAY_START_TRACK=0, PLAY_END_TRACK=1, |
131 | PLAY_START_POSITION=2, PLAY_END_POSITION=4 |
132 | }; |
133 | |
134 | #if 0 |
135 | #define PLAY_START_TRACK 0 |
136 | #define PLAY_END_TRACK 1 |
137 | #define PLAY_START_POSITION 2 |
138 | #define PLAY_END_POSITION 4 |
139 | #endif |
140 | |
141 | #ifndef __LIBCDAUDIO_INTERNAL |
142 | |
143 | #define cdindex_write_disc_data(cd_desc, data) \ |
144 | cdindex_write_data(cd_desc, &data) |
145 | #define cddb_write_disc_data(cd_desc, data) \ |
146 | cddb_write_data(cd_desc, &data) |
147 | #define cddb_erase_entry(data) \ |
148 | cddb_erase_data(&data) |
149 | |
150 | extern char cddb_message[256]; |
151 | extern int parse_disc_artist; |
152 | extern int parse_track_artist; |
153 | extern int cddb_submit_method; |
154 | extern char *cddb_submit_email_address; |
155 | |
156 | #endif /* __LIBCDAUDIO_INTERNAL */ |
157 | |
158 | /* CDDB entry */ |
159 | struct cddb_entry { |
160 | int entry_present; /* Is there an entry? */ |
161 | long entry_timestamp; /* Last modification |
162 | time */ |
163 | unsigned long entry_id; /* CDDB ID of entry */ |
164 | char entry_cdindex_id[CDINDEX_ID_SIZE]; /* CD Index ID of entry */ |
165 | enum cd_cddb_genre_t entry_genre; /* CDDB genre of entry */ |
166 | }; |
167 | |
168 | /* CDDB configuration */ |
169 | struct cddb_conf { |
170 | enum cd_cddb_access_t conf_access; /* CDDB_ACCESS_LOCAL or |
171 | CDDB_ACCESS_REMOTE */ |
172 | enum cd_cddb_proxy_t conf_proxy; /* Is a proxy being |
173 | used? */ |
174 | }; |
175 | |
176 | /* Server retrieval structure */ |
177 | struct cddb_server { |
178 | char server_name[256]; /* Server name */ |
179 | int server_port; /* Server port */ |
180 | }; |
181 | |
182 | /* CDDB server list structure */ |
183 | struct cddb_host { |
184 | struct cddb_server host_server; |
185 | char host_addressing[256]; |
186 | int host_protocol; |
187 | }; |
188 | |
189 | /* CDDB hello structure */ |
190 | struct cddb_hello { |
191 | char hello_program[256]; /* Program name*/ |
192 | char hello_version[256]; /* Version */ |
193 | }; |
194 | |
195 | /* An entry in the query list */ |
196 | struct query_list_entry { |
197 | enum cd_cddb_genre_t list_genre; /* CDDB genre of entry */ |
198 | unsigned long list_id; /* CDDB ID of entry */ |
199 | char list_title[64]; /* Title of entry */ |
200 | char list_artist[64]; /* Entry's artist */ |
201 | }; |
202 | |
203 | /* TOC data for CDDB query */ |
204 | struct cddb_direct_query_toc { |
205 | unsigned long toc_id; |
206 | int tracks; |
207 | int positions[MAX_TRACKS]; |
208 | }; |
209 | |
210 | /* CDDB query structure */ |
211 | enum cd_cddb_query_result_t { QUERY_NOMATCH, QUERY_EXACT, QUERY_INEXACT }; |
212 | |
213 | struct cddb_query { |
214 | #if 0 |
215 | #define QUERY_NOMATCH 0 |
216 | #define QUERY_EXACT 1 |
217 | #define QUERY_INEXACT 2 |
218 | #endif |
219 | enum cd_cddb_query_result_t query_match; /* Uses above |
220 | definitions */ |
221 | int query_matches; /* Number of matches */ |
222 | struct query_list_entry query_list[MAX_INEXACT_MATCHES]; |
223 | }; |
224 | |
225 | /* Used for keeping track of times */ |
226 | struct disc_timeval { |
227 | int minutes; |
228 | int seconds; |
229 | int frames; |
230 | }; |
231 | |
232 | /* Brief disc information */ |
233 | struct disc_status { |
234 | int status_present; /* Is disc present? */ |
235 | enum cd_cdaudio_status_t status_mode; /* Disc mode */ |
236 | struct disc_timeval status_disc_time; /* Current disc time */ |
237 | struct disc_timeval status_track_time; /* Current track time */ |
238 | int status_current_track; /* Current track */ |
239 | }; |
240 | |
241 | /* Track specific information */ |
242 | struct track_info { |
243 | struct disc_timeval track_length; /* Length of track */ |
244 | struct disc_timeval track_pos; /* Position of track */ |
245 | int track_lba; /* Logical Block |
246 | Address */ |
247 | enum cd_track_type_t track_type; /* CDAUDIO_TRACK_AUDIO |
248 | or |
249 | CDAUDIO_TRACK_DATA */ |
250 | }; |
251 | |
252 | /* Disc information such as current track, amount played, etc */ |
253 | struct disc_info { |
254 | int disc_present; /* Is disc present? */ |
255 | enum cd_cdaudio_status_t disc_mode; /* Current disc mode */ |
256 | struct disc_timeval disc_track_time; /* Current track time */ |
257 | struct disc_timeval disc_time; /* Current disc time */ |
258 | struct disc_timeval disc_length; /* Total disc length */ |
259 | int disc_current_track; /* Current track */ |
260 | int disc_first_track; /* First track on the |
261 | disc */ |
262 | int disc_total_tracks; /* Number of tracks on |
263 | disc */ |
264 | struct track_info disc_track[MAX_TRACKS]; /* Track specific |
265 | information */ |
266 | }; |
267 | |
268 | /* Invisible volume structure */ |
269 | struct __volume { |
270 | int left; |
271 | int right; |
272 | }; |
273 | |
274 | /* Volume structure */ |
275 | struct disc_volume { |
276 | struct __volume vol_front; /* Normal volume |
277 | settings */ |
278 | struct __volume vol_back; /* Surround sound |
279 | volume settings */ |
280 | }; |
281 | |
282 | struct art_query_entry { |
283 | char list_album[64]; |
284 | char list_artist[64]; |
285 | struct cddb_host list_host; |
286 | }; |
287 | |
288 | /* Disc art query structure */ |
289 | struct art_query { |
290 | enum cd_cddb_query_result_t query_match; /* Uses same values as |
291 | cddb_query */ |
292 | int query_matches; /* Number of matches */ |
293 | struct art_query_entry query_list[MAX_INEXACT_MATCHES]; |
294 | }; |
295 | |
296 | /* Cover art structure */ |
297 | struct art_data { |
298 | int art_present; /* Is art present? */ |
299 | int art_length; /* Size of image */ |
300 | char art_mime_type[16]; /* MIME type of image */ |
301 | char art_image[DISC_ART_SIZE]; /* Stored image */ |
302 | }; |
303 | |
304 | /* Compact cover art structure */ |
305 | struct art_mc_data { |
306 | int art_present; |
307 | int art_length; |
308 | char art_mime_type[16]; |
309 | char *art_data; |
310 | }; |
311 | |
312 | /* Track database structure */ |
313 | struct track_data { |
314 | char track_name[256]; /* Track name */ |
315 | char track_artist[256]; /* Track specific |
316 | artist */ |
317 | char track_extended[EXTENDED_DATA_SIZE]; /* Extended |
318 | information */ |
319 | }; |
320 | |
321 | /* Disc database structure */ |
322 | struct disc_data { |
323 | unsigned long data_id; /* CDDB ID */ |
324 | char data_cdindex_id[CDINDEX_ID_SIZE]; /* CD Index ID */ |
325 | int data_revision; /* CDDB revision |
326 | (incremented with |
327 | each submit) */ |
328 | char data_title[256]; /* Disc title */ |
329 | char data_artist[256]; /* Album artist */ |
330 | char data_extended[EXTENDED_DATA_SIZE]; /* Extended |
331 | information */ |
332 | enum cd_cddb_genre_t data_genre; /* Disc genre */ |
333 | enum cd_cdindex_artist_t data_artist_type; /* Single or multiple |
334 | artist CD */ |
335 | struct track_data data_track[MAX_TRACKS]; /* Track names */ |
336 | }; |
337 | |
338 | /* Compact track database structure */ |
339 | struct track_mc_data { |
340 | int track_name_len; |
341 | char *track_name; |
342 | int track_artist_len; |
343 | char *track_artist; |
344 | int track_extended_len; |
345 | char *track_extended; |
346 | }; |
347 | |
348 | /* Compact disc database structure */ |
349 | struct disc_mc_data { |
350 | unsigned long data_id; |
351 | char data_cdindex_id[CDINDEX_ID_SIZE]; |
352 | int data_title_len; |
353 | char *data_title; |
354 | int data_artist_len; |
355 | char *data_artist; |
356 | int data_extended_len; |
357 | char *data_extended; |
358 | enum cd_cddb_genre_t data_genre; |
359 | int data_revision; |
360 | enum cd_cdindex_artist_t data_artist_type; |
361 | int data_total_tracks; |
362 | struct track_mc_data **data_track; |
363 | }; |
364 | |
365 | /* Summary of a single disc in the changer */ |
366 | struct disc_summary { |
367 | int disc_present; /* Is disc present? */ |
368 | struct disc_timeval disc_length; /* Length of disc */ |
369 | int disc_total_tracks; /* Total tracks */ |
370 | unsigned long disc_id; /* CDDB ID */ |
371 | char data_cdindex_id[CDINDEX_ID_SIZE]; /* CDI ID */ |
372 | char disc_info[128]; /* Artist name / Disc |
373 | name */ |
374 | struct art_data data_art; /* Disc art */ |
375 | }; |
376 | |
377 | /* Disc changer structure */ |
378 | struct disc_changer { |
379 | int changer_slots; |
380 | struct disc_summary changer_disc[MAX_SLOTS]; |
381 | }; |
382 | |
383 | /* Compact disc summary */ |
384 | struct disc_mc_summary { |
385 | int disc_present; |
386 | struct disc_timeval disc_length; |
387 | int disc_total_tracks; |
388 | unsigned long disc_id; |
389 | char data_cdindex_id[CDINDEX_ID_SIZE]; |
390 | int disc_info_len; |
391 | char *disc_info; |
392 | struct art_mc_data data_art; |
393 | }; |
394 | |
395 | /* Compact disc changer structure */ |
396 | struct disc_mc_changer { |
397 | int changer_slots; |
398 | struct disc_mc_summary **changer_disc; |
399 | }; |
400 | |
401 | /* CDDB server list structure */ |
402 | struct cddb_serverlist { |
403 | int list_len; |
404 | struct cddb_host list_host[CDDB_MAX_SERVERS]; |
405 | }; |
406 | |
407 | #ifdef __cplusplus |
408 | extern "C"{ |
409 | #endif |
410 | |
411 | extern long cdaudio_getversion(void); |
412 | |
413 | /* Function prototopes */ |
414 | void cd_version(char *buffer, int len); |
415 | |
416 | int cd_frames_to_lba(int frames); |
417 | int cd_lba_to_frames(int lba); |
418 | int cd_msf_to_frames(struct disc_timeval time); |
419 | int cd_msf_to_lba(struct disc_timeval time); |
420 | void cd_frames_to_msf(struct disc_timeval *time, int frames); |
421 | void cd_lba_to_msf(struct disc_timeval *time, int frames); |
422 | |
423 | int cd_init_device(char *device_name); |
424 | int cd_finish(int cd_desc); |
425 | int cd_stat(int cd_desc, struct disc_info *disc); |
426 | int cd_poll(int cd_desc, struct disc_status *status); |
427 | int cd_update(struct disc_info *disc, struct disc_status status); |
428 | |
429 | int cd_play_frames(int cd_desc, int startframe, int endframe); |
430 | int cd_playctl(int cd_desc, int options, int start_track, ...); |
431 | int cd_play_track_pos(int cd_desc, int starttrack, |
432 | int endtrack, int startpos); |
433 | int cd_play_track(int cd_desc, int starttrack, int endtrack); |
434 | int cd_play_pos(int cd_desc, int track, int startpos); |
435 | int cd_play(int cd_desc, int track); |
436 | |
437 | int cd_track_advance(int cd_desc, int endtrack, |
438 | struct disc_timeval time); |
439 | int cd_advance(int cd_desc, struct disc_timeval time); |
440 | int cd_stop(int cd_desc); |
441 | int cd_pause(int cd_desc); |
442 | int cd_resume(int cd_desc); |
443 | int cd_eject(int cd_desc); |
444 | int cd_close(int cd_desc); |
445 | |
446 | int cd_set_volume(int cd_desc, struct disc_volume vol); |
447 | int cd_get_volume(int cd_desc, struct disc_volume *vol); |
448 | |
449 | long cddb_discid(int cd_desc); |
450 | int cddb_process_url(struct cddb_host *host, const char *url); |
451 | int cddb_read_serverlist(struct cddb_conf *conf, |
452 | struct cddb_serverlist *list, |
453 | struct cddb_server *proxy); |
454 | int cddb_write_serverlist(struct cddb_conf conf, |
455 | struct cddb_serverlist list, |
456 | struct cddb_server proxy); |
457 | char *cddb_genre(enum cd_cddb_genre_t genre); |
458 | |
459 | int cddb_direct_mc_alloc(struct disc_mc_data *data, int tracks); |
460 | int cddb_mc_alloc(int cd_desc, struct disc_mc_data *data); |
461 | void cddb_mc_free(struct disc_mc_data *data); |
462 | int cddb_mc_copy_from_data(struct disc_mc_data *outdata, |
463 | struct disc_data *indata); |
464 | int cddb_data_copy_from_mc(struct disc_data *outdata, |
465 | struct disc_mc_data *indata); |
466 | |
467 | int cddb_connect(struct cddb_server *server); |
468 | int cddb_connect_server(struct cddb_host host, |
469 | struct cddb_server *proxy, |
470 | struct cddb_hello hello, ...); |
471 | int cddb_skip_http_header(int sock); |
472 | int cddb_read_token(int sock, int token[3]); |
473 | int cddb_query(int cd_desc, int sock, enum cd_connection_mode_t mode, |
474 | struct cddb_query *query, ...); |
475 | int cddb_read(int cd_desc, int sock, enum cd_connection_mode_t mode, |
476 | struct cddb_entry entry, struct disc_data *data, ...); |
477 | int cddb_quit(int sock); |
478 | int cddb_sites(int sock, enum cd_connection_mode_t mode, |
479 | struct cddb_serverlist *list, ...); |
480 | |
481 | int cddb_read_data(int desc, struct disc_data *data); |
482 | int cddb_generate_unknown_entry(int cd_desc, struct disc_data *data); |
483 | int cddb_read_disc_data(int cd_desc, struct disc_data *data); |
484 | int cddb_write_data(int cd_desc, struct disc_data *data); |
485 | int cddb_erase_data(struct disc_data *data); |
486 | int cddb_stat_disc_data(int cd_desc, struct cddb_entry *entry); |
487 | |
488 | int cddb_http_query(int cd_desc, struct cddb_host host, |
489 | struct cddb_hello hello, struct cddb_query *query); |
490 | int cddb_http_proxy_query(int cd_desc, struct cddb_host host, |
491 | struct cddb_server proxy, |
492 | struct cddb_hello hello, |
493 | struct cddb_query *query); |
494 | int cddb_http_read(int cd_desc, struct cddb_host host, |
495 | struct cddb_hello hello, |
496 | struct cddb_entry entry, |
497 | struct disc_data *data); |
498 | int cddb_http_proxy_read(int cd_desc, struct cddb_host host, |
499 | struct cddb_server proxy, |
500 | struct cddb_hello hello, |
501 | struct cddb_entry entry, |
502 | struct disc_data *data); |
503 | int cddb_http_sites(int cd_desc, struct cddb_host host, |
504 | struct cddb_hello hello, |
505 | struct cddb_serverlist *list); |
506 | int cddb_http_proxy_sites(int cd_desc, struct cddb_host host, |
507 | struct cddb_server proxy, |
508 | struct cddb_hello hello, |
509 | struct cddb_serverlist *list); |
510 | int cddb_http_submit(int cd_desc, struct cddb_host host, |
511 | struct cddb_server *proxy, |
512 | char *email_address); |
513 | |
514 | int cdindex_discid(int cd_desc, char *discid, int len); |
515 | |
516 | int cdindex_connect_server(struct cddb_host host, |
517 | struct cddb_server *proxy, |
518 | char *http_string, |
519 | int len); |
520 | int cdindex_read(int cd_desc, int sock, struct disc_data *data, |
521 | char *http_string); |
522 | |
523 | int cdindex_write_data(int cd_desc, struct disc_data *data); |
524 | |
525 | int coverart_connect_server(struct cddb_host host, |
526 | struct cddb_server *proxy, |
527 | char *http_string, |
528 | int len); |
529 | int coverart_query(int cd_desc, int sock, |
530 | struct art_query *query, |
531 | char *http_string); |
532 | int coverart_name_query(int sock, struct art_query *query, |
533 | char *http_string, char *album, char *artist); |
534 | |
535 | int coverart_read(struct art_data *art, |
536 | struct cddb_server *proxy, |
537 | struct cddb_host host); |
538 | int coverart_read_data(int cd_desc, struct art_data *art); |
539 | int coverart_write_data(int cd_desc, struct art_data art); |
540 | |
541 | int cd_changer_select_disc(int cd_desc, int disc); |
542 | int cd_changer_slots(int cd_desc); |
543 | int cd_changer_stat(int cd_desc, struct disc_changer *changer); |
544 | |
545 | #ifdef __cplusplus |
546 | } |
547 | #endif |
548 | |
549 | #endif |
550 |
Warning: That file was not part of the compilation database. It may have many parsing errors.