1 /*
2  * Copyright (C) 1990 Regents of the University of California.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation for any purpose is hereby granted without fee,
6  * provided that the above copyright notice appear in all copies and that
7  * both that copyright notice and this permission notice appear in
8  * supporting documentation, and that the name of the University of
9  * California not be used in advertising or publicity pertaining to
10  * distribution of the software without specific, written prior
11  * permission.  the University of California makes no representations
12  * about the suitability of this software for any purpose.  It is provided
13  * "as is" without express or implied warranty.
14  */
15 
16 # include <X11/Intrinsic.h>
17 
18 # define NOTITLESTR     "No Title"
19 # define NODISCSTR      "No Disc"
20 
21 # define bit(n)			(1 << (n))
22 
23 /* bits for cdrom_state */
24 # define CDROM_STATE_PLAY	bit(0)
25 # define CDROM_STATE_PAUSE	bit(1)
26 # define CDROM_STATE_STOP	bit(2)
27 # define CDROM_STATE_EJECTED	bit(3)
28 # define CDROM_STATE_CYCLE	bit(4)
29 # define CDROM_STATE_SHUFFLE	bit(5)
30 # define CDROM_STATE_PROGRAM	bit(6)
31 
32 /* return codes from cdrom_status() */
33 # define CDROM_INVALID		1
34 # define CDROM_PLAYING		2
35 # define CDROM_PAUSED		3
36 # define CDROM_COMPLETED	4
37 # define CDROM_ERROR		5
38 # define CDROM_NO_STATUS	6
39 
40 #define	STILL_MOUNTED	1
41 #define	UNMOUNTED	0
42 #define CDROM_LEADOUT   0xAA
43 #define CDROM_MSF       0x02
44 
45 struct msf {
46 	unsigned char   minute;
47 	unsigned char   second;
48 	unsigned char   frame;
49 };
50 
51 struct prognode {
52 	unsigned char	track;
53 	Widget		button;
54 	struct prognode *next;
55 	struct prognode *prev;
56 };
57 
58 typedef struct _cdrom_info {
59 	unsigned char	curtrack;	/* current track playing	*/
60 	unsigned char	mintrack;	/* first audio track		*/
61 	unsigned char	maxtrack;	/* last audio track		*/
62 	unsigned char	ntracks;	/* size of random track list	*/
63 	int		duration;	/* seconds played so far	*/
64 	int		state;		/* state of cd-rom drive	*/
65 	short		currand;	/* index into random track list */
66 	short		lastprog;	/* number of selections in prog.*/
67 	unsigned short	*times;		/* duration of each track	*/
68 	struct msf 	*addrs;		/* starting minute/second/frames*/
69 	struct prognode	*selection;	/* currently selected prog. trk	*/
70 	struct prognode *program;	/* list of programmed tracks	*/
71 } cdrom_info;
72 
73 extern int		cdrom_open();
74 extern void		cdrom_close();
75 extern int		cdrom_start();
76 extern int		cdrom_stop();
77 extern int		cdrom_eject();
78 extern int		cdrom_pause();
79 extern int		cdrom_resume();
80 extern int		cdrom_volume();
81 extern int		cdrom_get_times();
82 extern int		cdrom_get_curtrack();
83 extern int		cdrom_get_msf();
84 extern int		cdrom_get_curmsf();
85 extern int		cdrom_play_track();
86 extern int		cdrom_play_msf();
87 extern int		cdrom_read_tocentry();
88 extern int		cdrom_read_tochdr();
89 extern int		cdrom_status();
90 
91 extern cdrom_info	cdi;
92 extern char		*disc_title;
93 extern char		program_str[];
94 extern char		*cdInfoDir;
95 
96