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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
/*
* $Id: struct.h,v 1.4 1999/02/12 13:55:20 dirk Exp $
*
* This file is part of WorkMan, the civilized CD player program
* (c) 1991-1997 by Steven Grimm (original author)
* (c) by Dirk F"orsterling (current 'author' = maintainer)
* The maintainer can be contacted by his e-mail address:
* milliByte@DeathsDoor.com
*
* 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.
*/
#ifndef STRUCT_H
#define STRUCT_H
/*
* I did not know any better place...
*/
#ifdef DEBUG
#define CHECKPOINT(t) fprintf(stderr, "%s (%d): %s\n", __FILE__, __LINE__, t );
#else
#define CHECKPOINT(t)
#endif
/*
* Structure for a single track. This is pretty much self-explanatory --
* one of these exists for each track on the current CD.
*/
struct trackinfo
{
char *songname; /* Name of song, dynamically allocated */
char *otherdb; /* Unrecognized info for this track */
char *otherrc;
int length; /* Length of track in seconds or Kbytes */
int start; /* Starting position (f+s*75+m*60*75) */
int volume; /* Per-track volume (1-32, 0 to disable) */
int track; /* Physical track number */
int section; /* Section number (0 if track not split) */
int contd; /* Flag: continuation of previous track */
int avoid; /* Flag: don't play this track. */
int data; /* Flag: data track */
};
/*
* Structure for internal playlist management. The internal playlist is
* simply the list of track ranges that are being played currently. This
* is built whenever the CD starts playing; it's used in normal and shuffle
* modes as well as playlist mode.
*
* The "starttime" element represents how much time has elapsed by the time
* we get to this entry. For instance, if the list begins with a 5-minute
* track and a 3-minute track, the third entry would have a starttime of 8
* minutes. This is used so that the elapsed play time can be displayed
* even in shuffle or playlist modes.
*
* The last member of the list has a start track of 0, and its starttime is
* the total playing time of the playlist (which will usually be overestimated,
* since we don't play leadouts in some cases.)
*/
struct play
{
int start; /* Start track, or 0 if end of list */
int end; /* last track plus 1 */
int starttime; /* Number of seconds elapsed previously */
};
/*
* Structure for playlists (as seen by the user.) This is simply a name
* followed by a zero-terminated list of track numbers to play. The list
* is terminated by a NULL name.
*/
struct playlist
{
char *name; /* Name of this playlist */
int *list; /* List of tracks */
};
struct cdinfo_wm
{
char artist[84]; /* Artist's name */
char cdname[84]; /* Disc's name */
int ntracks; /* Number of tracks on the disc */
int length; /* Total running time in seconds */
int autoplay; /* Start playing CD immediately */
int playmode; /* How to play the CD */
int volume; /* Default volume (1-32, 0 for none) */
struct trackinfo *trk; /* struct trackinfo[ntracks] */
struct playlist *lists; /* User-specified playlists */
char *whichdb; /* Which database is this entry from? */
char *otherdb; /* Unrecognized lines from this entry */
char *otherrc;
char *user; /* Name of originating user */
unsigned int cddbid;
struct cdinfo *next; /* For browsers, etc. */
};
/* The global variable "cd" points to the struct for the CD that's playing. */
extern struct cdinfo_wm *cd;
struct playlist *new_list();
enum cd_modes
{
UNKNOWN = -1,
BACK = 0, TRACK_DONE = 0,
PLAYING = 1,
FORWARD = 2,
PAUSED=3,
STOPPED=4,
EJECTED=5
};
/*
* Drive descriptor structure. Used for access to low-level routines.
*/
struct wm_drive
{
int fd; /* File descriptor, if used by platform */
char vendor[16]; /* Vendor name */
char model[24]; /* Drive model */
void *aux; /* Pointer to optional platform-specific info */
void *daux; /* Pointer to optional drive-specific info */
int (*init)();
int (*get_trackcount)();
int (*get_cdlen)();
int (*get_trackinfo)();
int (*get_drive_status)();
int (*get_volume)();
int (*set_volume)();
int (*pause)();
int (*resume)();
int (*stop)();
int (*play)();
int (*eject)();
int (*closetray)();
};
/*
* Structure for information of the usage of cddb.
*/
struct wm_cddb {
int protocol; // 0-off, 1-cddbp, 2-http, 3-htproxy
char cddb_server[84]; // host.domain.name:port
char mail_adress[84]; // user@domain.name
char path_to_cgi[84]; // (/)path/to/cddb.cgi
char proxy_server[84]; // host.domain.name:port
};
extern struct wm_cddb cddb;
/*
* Each platform has to define generic functions, so may as well declare
* them all here to save space.
*/
int gen_init(),
gen_get_trackcount(),
gen_get_cdlen(),
gen_get_trackinfo(),
gen_get_drive_status(),
gen_get_volume(),
gen_set_volume(),
gen_pause(),
gen_resume(),
gen_stop(),
gen_play(),
gen_eject(),
gen_closetray();
struct wm_drive *find_drive_struct();
#endif /* STRUCT_H */
|