KCompactDisc

wm_struct.h
1#ifndef WM_STRUCT_H
2#define WM_STRUCT_H
3/*
4 * This file is part of WorkMan, the civilized CD player library
5 * Copyright (C) 1991-1997 by Steven Grimm <koreth@midwinter.com>
6 * Copyright (C) by Dirk Försterling <milliByte@DeathsDoor.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 */
23
24#include "wm_platform.h"
25
26#define WM_STR_GENVENDOR "Generic"
27#define WM_STR_GENMODEL "drive"
28#define WM_STR_GENREV "type"
29
30struct wm_drive;
31
32/*
33 * Structure for a single track. This is pretty much self-explanatory --
34 * one of these exists for each track on the current CD.
35 */
36struct wm_trackinfo
37{
38 int length; /* Length of track in seconds or Kbytes */
39 int start; /* Starting position (f+s*75+m*60*75) */
40 int track; /* Physical track number */
41 int data; /* Flag: data track */
42};
43
44struct wm_cdinfo
45{
46 int ntracks; /* Number of tracks on the disc */
47 int curtrack;
48 int curtracklen;
49 int cur_cdmode;
50 int cur_index; /* Current index mark */
51 int cur_pos_rel; /* Current track-relative position in seconds */
52 int cur_pos_abs; /* Current absolute position in seconds */
53 int cur_frame; /* Current frame number */
54 int length; /* Total running time in seconds */
55 int cd_cur_balance;
56 struct wm_trackinfo *trk; /* struct wm_trackinfo[ntracks] */
57};
58
59/*
60 * Each platform has to define generic functions, so may as well declare
61 * them all here to save space.
62 * These functions should never be seen outside libworkman. So I don't care
63 * about the wm_ naming convention here.
64 */
65struct wm_drive_proto
66{
67 int (*open)(struct wm_drive *d);
68 int (*close)(struct wm_drive *d);
69 int (*get_trackcount)(struct wm_drive *d, int *tracks);
70 int (*get_cdlen)(struct wm_drive *d, int *frames);
71 int (*get_trackinfo)(struct wm_drive *d, int track, int *data, int *startframe);
72 int (*get_drive_status)(struct wm_drive *d, int oldmode, int *mode, int *pos, int *track, int *ind);
73 int (*pause)(struct wm_drive *d);
74 int (*resume)(struct wm_drive *d);
75 int (*stop)(struct wm_drive *d);
76 int (*play)(struct wm_drive *d, int start, int end);
77 int (*eject)(struct wm_drive *d);
78 int (*closetray)(struct wm_drive *d);
79 int (*scsi)(struct wm_drive *d, unsigned char *cdb, int cdb_len, void *ret_buf, int ret_buflen, int get_reply);
80 int (*set_volume)(struct wm_drive *d, int left, int right);
81 int (*get_volume)(struct wm_drive *d, int *left, int *right);
82 int (*scale_volume)(int *left, int *right);
83 int (*unscale_volume)(int *left, int *right);
84};
85
86/* forward declaration */
87int gen_init(struct wm_drive *d);
88int gen_open(struct wm_drive *d);
89int gen_close(struct wm_drive *d);
90int gen_get_trackcount(struct wm_drive *d, int *tracks);
91int gen_get_cdlen(struct wm_drive *d, int *frames);
92int gen_get_trackinfo(struct wm_drive *d, int track, int *data, int *startframe);
93int gen_get_drive_status(struct wm_drive *d, int oldmode, int *mode, int *pos, int *track, int *ind);
94int gen_pause(struct wm_drive *d);
95int gen_resume(struct wm_drive *d);
96int gen_stop(struct wm_drive *d);
97int gen_play(struct wm_drive *d, int start, int end);
98int gen_eject(struct wm_drive *d);
99int gen_closetray(struct wm_drive *d);
100int gen_scsi(struct wm_drive *d, unsigned char *cdb, int cdb_len, void *ret_buf, int ret_buflen, int get_reply);
101int gen_set_volume(struct wm_drive *d, int left, int right);
102int gen_get_volume(struct wm_drive *d, int *left, int *right);
103int gen_scale_volume(int *left, int *right);
104int gen_unscale_volume(int *left, int *right);
105
106/*
107 * Information about a particular block of CDDA data.
108 */
109struct wm_cdda_block
110{
111 unsigned char status;
112 unsigned char track;
113 unsigned char index;
114 unsigned char reserved;
115
116 int frame;
117 char *buf;
118 long buflen;
119};
120
121#ifdef WMLIB_CDDA_BUILD
122int gen_cdda_init(struct wm_drive *d);
123int gen_cdda_open(struct wm_drive* d);
124int gen_cdda_read(struct wm_drive* d, struct wm_cdda_block *block);
125int gen_cdda_close(struct wm_drive* d);
126#else
127 #define gen_cdda_init(x) (-1)
128 #define gen_cdda_open(x) (-1)
129 #define gen_cdda_read(x, y) (-1)
130 #define gen_cdda_close(x) (-1)
131#endif
132
133
134/*
135 * Drive descriptor structure. Used for access to low-level routines.
136 */
137struct wm_drive
138{
139 int cdda; /* cdda 1, cdin 0 */
140
141 /* common section */
142 char *cd_device;
143 char *soundsystem;
144 char *sounddevice;
145 char *ctldevice;
146
147 char vendor[9]; /* Vendor name */
148 char model[17]; /* Drive model */
149 char revision[5]; /* Revision of the drive */
150 void *aux; /* Pointer to optional platform-specific info */
151
152 struct wm_cdinfo thiscd;
153 int cur_cdmode;
154
155 /* cdin section */
156 int fd; /* file descriptor */
157 void *daux; /* Pointer to optional drive-specific info etc. */
158 struct wm_drive_proto proto;
159
160 /* cdda section */
161 unsigned char status;
162 unsigned char track;
163 unsigned char index;
164 unsigned char command;
165
166 int current_position;
167 int ending_position;
168
169 int frame;
170 int frames_at_once;
171
172 struct wm_cdda_block *blocks;
173 int numblocks;
174 void *cddax; /* Pointer to optional drive-specific info etc. */
175 int oldmode;
176};
177
178int toshiba_fixup(struct wm_drive *d);
179int sony_fixup(struct wm_drive *d);
180
181struct cdtext_info* get_glob_cdtext(struct wm_drive*, int);
182void free_cdtext(void);
183
184int wm_cdda_init(struct wm_drive *d);
185int wm_cdda_destroy(struct wm_drive *d);
186
187#endif /* WM_STRUCT_H */
void stop(Ekos::AlignState mode)
Q_SCRIPTABLE Q_NOREPLY void pause()
Q_SCRIPTABLE Q_NOREPLY void start()
Q_SCRIPTABLE CaptureState status()
const QList< QKeySequence > & end()
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:35 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.