1 #ifndef WM_STRUCT_H
2 #define WM_STRUCT_H
3 /*
4  * $Id: wm_struct.h,v 1.7 1999/05/28 03:35:58 dirk Exp $
5  *
6  * This file is part of WorkMan, the civilized CD player library
7  * (c) 1991-1997 by Steven Grimm (original author)
8  * (c) by Dirk F�rsterling (current 'author' = maintainer)
9  * The maintainer can be contacted by his e-mail address:
10  * milliByte@DeathsDoor.com
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library; if not, write to the Free
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25  *
26  */
27 
28 
29 
30 /*
31  * Structure for a single track.  This is pretty much self-explanatory --
32  * one of these exists for each track on the current CD.
33  */
34 struct wm_trackinfo
35 {
36   char	*songname;	/* Name of song, dynamically allocated */
37   char	*otherdb;	/* Unrecognized info for this track */
38   char	*otherrc;
39   int	length;		/* Length of track in seconds or Kbytes */
40   int	start;		/* Starting position (f+s*75+m*60*75) */
41   int	volume;		/* Per-track volume (1-32, 0 to disable) */
42   int	track;		/* Physical track number */
43   int	section;	/* Section number (0 if track not split) */
44   int	contd;		/* Flag: continuation of previous track */
45   int	avoid;		/* Flag: don't play this track. */
46   int	data;		/* Flag: data track */
47 };
48 
49 /*
50  * Structure for internal playlist management.  The internal playlist is
51  * simply the list of track ranges that are being played currently.  This
52  * is built whenever the CD starts playing; it's used in normal and shuffle
53  * modes as well as playlist mode.
54  *
55  * The "starttime" element represents how much time has elapsed by the time
56  * we get to this entry.  For instance, if the list begins with a 5-minute
57  * track and a 3-minute track, the third entry would have a starttime of 8
58  * minutes.  This is used so that the elapsed play time can be displayed
59  * even in shuffle or playlist modes.
60  *
61  * The last member of the list has a start track of 0, and its starttime is
62  * the total playing time of the playlist (which will usually be overestimated,
63  * since we don't play leadouts in some cases.)
64  */
65 struct wm_play
66 {
67   int	start;		/* Start track, or 0 if end of list */
68   int	end;		/* last track plus 1 */
69   int	starttime;	/* Number of seconds elapsed previously */
70 };
71 
72 /*
73  * Structure for playlists (as seen by the user.)  This is simply a name
74  * followed by a zero-terminated list of track numbers to play.  The list
75  * is terminated by a NULL name.
76  */
77 struct wm_playlist
78 {
79   char	*name;		/* Name of this playlist */
80   int	*list;		/* List of tracks */
81 };
82 
83 struct wm_cdinfo
84 {
85   char	artist[84];	/* Artist's name */
86   char	cdname[84];	/* Disc's name */
87   int	ntracks;	/* Number of tracks on the disc */
88   int	length;		/* Total running time in seconds */
89   int	autoplay;	/* Start playing CD immediately */
90   int	playmode;	/* How to play the CD */
91   int	volume;		/* Default volume (1-32, 0 for none) */
92   struct wm_trackinfo *trk;	/* struct wm_trackinfo[ntracks] */
93   struct wm_playlist *lists;	/* User-specified playlists */
94   char	*whichdb;	/* Which database is this entry from? */
95   char	*otherdb;	/* Unrecognized lines from this entry */
96   char	*otherrc;
97   char	*user;		/* Name of originating user */
98   unsigned int cddbid;  /* CDDB-ID of the current disc */
99   struct cdinfo *next;	/* For browsers, etc. */
100 };
101 
102 /* The global variable "cd" points to the struct for the CD that's playing. */
103 extern struct wm_cdinfo *cd;
104 
105 struct wm_playlist *new_list();
106 
107 enum wm_cd_modes
108 {
109   WM_CDM_UNKNOWN = -1,
110   WM_CDM_BACK = 0, WM_CDM_TRACK_DONE = 0,
111   WM_CDM_PLAYING = 1,
112   WM_CDM_FORWARD = 2,
113   WM_CDM_PAUSED = 3,
114   WM_CDM_STOPPED = 4,
115   WM_CDM_EJECTED = 5
116 };
117 
118 /*
119  * Drive descriptor structure.  Used for access to low-level routines.
120  */
121 struct wm_drive
122 {
123   int	fd;		/* File descriptor, if used by platform */
124   char	vendor[32];	/* Vendor name */
125   char	model[32];	/* Drive model */
126   char  revision[32];   /* Revision of the drive */
127   void	*aux;		/* Pointer to optional platform-specific info */
128   void	*daux;		/* Pointer to optional drive-specific info */
129 
130   int	(*init)();
131   int	(*get_trackcount)();
132   int	(*get_cdlen)();
133   int	(*get_trackinfo)();
134   int	(*get_drive_status)();
135   int	(*get_volume)();
136   int	(*set_volume)();
137   int	(*pause)();
138   int	(*resume)();
139   int	(*stop)();
140   int	(*play)();
141   int	(*eject)();
142   int   (*closetray)();
143 };
144 
145 /*
146  * Structure for information of the usage of cddb.
147  */
148 struct wm_cddb {
149         int     protocol;               /* 0-off, 1-cddbp, 2-http, 3-htproxy */
150         char    cddb_server[84];        /* host.domain.name:port */
151         char    mail_adress[84];        /* user@domain.name */
152         char    path_to_cgi[84];        /* (/)path/to/cddb.cgi */
153         char    proxy_server[84];       /* host.domain.name:port */
154 };
155 extern struct wm_cddb cddb;
156 
157 
158 /*
159  * Each platform has to define generic functions, so may as well declare
160  * them all here to save space.
161  * These functions should never be seen outside libworkman. So I don't care
162  * about the wm_ naming convention here.
163  */
164 int     gen_init(),
165         gen_get_trackcount(),
166         gen_get_cdlen(),
167         gen_get_trackinfo(),
168 	gen_get_drive_status(),
169 	gen_get_volume(),
170 	gen_set_volume(),
171 	gen_pause(),
172 	gen_resume(),
173 	gen_stop(),
174 	gen_play(),
175 	gen_eject(),
176 	gen_closetray();
177 
178 struct wm_drive *find_drive_struct();
179 
180 
181 #endif /* WM_STRUCT_H */
182