rbcdio 0.01
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/COPYING +340 -0
- data/ChangeLog +315 -0
- data/INSTALL +236 -0
- data/Makefile.am +163 -0
- data/Makefile.in +557 -0
- data/NEWS +5 -0
- data/README +75 -0
- data/Rakefile +234 -0
- data/THANKS +3 -0
- data/VERSION +1 -0
- data/VERSION.in +1 -0
- data/config.guess +1473 -0
- data/config.sub +1576 -0
- data/configure +4802 -0
- data/configure.ac +158 -0
- data/data/copying.iso +0 -0
- data/data/isofs-m1.bin +0 -0
- data/data/isofs-m1.cue +3 -0
- data/doc/created.rid +1 -0
- data/doc/fr_class_index.html +42 -0
- data/doc/fr_file_index.html +40 -0
- data/doc/fr_method_index.html +133 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/example/COPYING +340 -0
- data/example/README +47 -0
- data/example/audio.rb +186 -0
- data/example/cd-read.rb +167 -0
- data/example/copying +340 -0
- data/example/device.rb +91 -0
- data/example/drivers.rb +63 -0
- data/example/drives.rb +63 -0
- data/example/eject.rb +69 -0
- data/example/iso1.rb +89 -0
- data/example/iso2.rb +106 -0
- data/example/iso3.rb +111 -0
- data/example/tracks.rb +83 -0
- data/ext/cdio/Makefile +139 -0
- data/ext/cdio/extconf.rb +9 -0
- data/ext/cdio/rubycdio_wrap.c +3410 -0
- data/ext/iso9660/Makefile +139 -0
- data/ext/iso9660/extconf.rb +10 -0
- data/ext/iso9660/rubyiso9660_wrap.c +3005 -0
- data/install-sh +323 -0
- data/lib/Makefile +7 -0
- data/lib/cdio.rb +1000 -0
- data/lib/iso9660.rb +566 -0
- data/missing +360 -0
- data/rubycdio.m4 +14 -0
- data/swig/Makefile +7 -0
- data/swig/audio.swg +63 -0
- data/swig/compat.swg +104 -0
- data/swig/device.swg +513 -0
- data/swig/device_const.swg +144 -0
- data/swig/disc.swg +96 -0
- data/swig/read.swg +164 -0
- data/swig/rubycdio.swg +86 -0
- data/swig/rubyiso9660.swg +827 -0
- data/swig/track.swg +206 -0
- data/swig/types.swg +65 -0
- data/test/Makefile +7 -0
- data/test/Rakefile +8 -0
- data/test/cdda.bin +0 -0
- data/test/cdda.cue +7 -0
- data/test/cdda.toc +14 -0
- data/test/cdiotest.rb +228 -0
- data/test/isocopy.rb +394 -0
- data/test/isotest.rb +187 -0
- metadata +116 -0
data/swig/device.swg
ADDED
@@ -0,0 +1,513 @@
|
|
1
|
+
/* -*- c -*-
|
2
|
+
$Id: device.swg,v 1.10 2006/12/08 13:42:20 rocky Exp $
|
3
|
+
|
4
|
+
Copyright (C) 2006 Rocky Bernstein <rocky@gnu.org>
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation; either version 2 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU General Public License
|
17
|
+
along with this program; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19
|
+
02110-1301 USA.
|
20
|
+
*/
|
21
|
+
/* See <cdio/device.h> for more extensive documentation. */
|
22
|
+
|
23
|
+
%include "device_const.swg"
|
24
|
+
|
25
|
+
/* Set up to allow functions returning device lists of type "char
|
26
|
+
**". We'll use a typedef so we can make sure to isolate this. I
|
27
|
+
don't think we need to in this program, but it I think it makes
|
28
|
+
thing clearer.
|
29
|
+
*/
|
30
|
+
%inline %{
|
31
|
+
typedef char ** DeviceList_t;
|
32
|
+
%}
|
33
|
+
|
34
|
+
%typemap(out) DeviceList_t {
|
35
|
+
// $1 is of type DeviceList_t
|
36
|
+
char **p = result;
|
37
|
+
|
38
|
+
if (result) {
|
39
|
+
VALUE aDevices = rb_ary_new();
|
40
|
+
for (p = $1; *p; p++) {
|
41
|
+
rb_ary_push(aDevices, rb_str_new2(*p));
|
42
|
+
}
|
43
|
+
cdio_free_device_list($1);
|
44
|
+
return aDevices;
|
45
|
+
} else {
|
46
|
+
return Qnil;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
/*
|
51
|
+
close_tray(drive=undef, driver_id=DRIVER_UNKNOWN) -> [status, driver_id]
|
52
|
+
|
53
|
+
close media tray in CD drive if there is a routine to do so.
|
54
|
+
*/
|
55
|
+
%apply driver_id_t *OUTPUT { driver_id_t *p_out_driver_id };
|
56
|
+
driver_return_code_t close_tray(const char *psz_drive,
|
57
|
+
driver_id_t p_driver_id=DRIVER_UNKNOWN,
|
58
|
+
driver_id_t *p_out_driver_id);
|
59
|
+
%inline %{
|
60
|
+
driver_return_code_t
|
61
|
+
close_tray(const char *psz_drive, driver_id_t p_driver_id,
|
62
|
+
driver_id_t *p_out_driver_id)
|
63
|
+
{
|
64
|
+
*p_out_driver_id = p_driver_id;
|
65
|
+
return cdio_close_tray(psz_drive, p_out_driver_id);
|
66
|
+
}
|
67
|
+
%}
|
68
|
+
|
69
|
+
%rename cdio_destroy close;
|
70
|
+
%feature("autodoc",
|
71
|
+
"destroy(p_cdio)
|
72
|
+
Free resources associated with p_cdio. Call this when done using
|
73
|
+
using CD reading/control operations for the current device.
|
74
|
+
");
|
75
|
+
void cdio_destroy(CdIo_t *p_cdio);
|
76
|
+
|
77
|
+
#if LIBCDIO_VERSION_NUM > 76
|
78
|
+
/* cdio_driver_errmsg first appears in 0.77 code
|
79
|
+
*/
|
80
|
+
%rename cdio_driver_errmsg driver_errmsg;
|
81
|
+
/*!
|
82
|
+
@param drc the return code you want interpreted.
|
83
|
+
@return the string information about drc
|
84
|
+
*/
|
85
|
+
const char *cdio_driver_errmsg(driver_return_code_t drc);
|
86
|
+
#else
|
87
|
+
const char *driver_errmsg(driver_return_code_t drc);
|
88
|
+
%inline %{
|
89
|
+
const char *
|
90
|
+
driver_errmsg(driver_return_code_t drc)
|
91
|
+
{
|
92
|
+
switch(drc) {
|
93
|
+
case DRIVER_OP_SUCCESS:
|
94
|
+
return "driver operation was successful";
|
95
|
+
case DRIVER_OP_ERROR:
|
96
|
+
return "driver I/O error";
|
97
|
+
case DRIVER_OP_UNSUPPORTED:
|
98
|
+
return "driver operatation not supported";
|
99
|
+
case DRIVER_OP_UNINIT:
|
100
|
+
return "driver not initialized";
|
101
|
+
case DRIVER_OP_NOT_PERMITTED:
|
102
|
+
return "driver operatation not permitted";
|
103
|
+
case DRIVER_OP_BAD_PARAMETER:
|
104
|
+
return "bad parameter passed";
|
105
|
+
case DRIVER_OP_BAD_POINTER:
|
106
|
+
return "bad pointer to memory area";
|
107
|
+
case DRIVER_OP_NO_DRIVER:
|
108
|
+
return "driver not available";
|
109
|
+
default:
|
110
|
+
return "unknown or bad driver return status";
|
111
|
+
}
|
112
|
+
}
|
113
|
+
%}
|
114
|
+
#endif /* LIBCDIO_VERSION_NUM > 76 */
|
115
|
+
%feature("autodoc",
|
116
|
+
"eject_media(cdio)->return_code
|
117
|
+
|
118
|
+
Eject media in CD drive if there is a routine to do so.
|
119
|
+
");
|
120
|
+
driver_return_code_t eject_media (CdIo_t *p_cdio);
|
121
|
+
%inline %{
|
122
|
+
driver_return_code_t
|
123
|
+
eject_media (CdIo_t *p_cdio)
|
124
|
+
{
|
125
|
+
/* libcdio routines uses a Cdio_t **p_cdio, so we have to pass in
|
126
|
+
something it can clobber.
|
127
|
+
*/
|
128
|
+
CdIo_t **pp_cdio = &p_cdio;
|
129
|
+
return cdio_eject_media (pp_cdio);
|
130
|
+
}
|
131
|
+
%}
|
132
|
+
|
133
|
+
|
134
|
+
%rename cdio_eject_media_drive eject_media_drive;
|
135
|
+
%feature("autodoc",
|
136
|
+
"eject_media_drive(drive=nil)->return_code
|
137
|
+
Eject media in CD drive if there is a routine to do so.
|
138
|
+
|
139
|
+
psz_drive: the name of the device to be acted upon.
|
140
|
+
The operation status is returned.");
|
141
|
+
driver_return_code_t cdio_eject_media_drive (const char *psz_drive=NULL);
|
142
|
+
|
143
|
+
%rename cdio_get_arg get_arg;
|
144
|
+
%feature("autodoc",
|
145
|
+
"get_arg(p_cdio, key)->string
|
146
|
+
|
147
|
+
Get the value associatied with key.");
|
148
|
+
const char *cdio_get_arg (const CdIo_t *p_cdio, const char key[]);
|
149
|
+
|
150
|
+
%newobject cdio_get_default_device; // free malloc'd return value
|
151
|
+
%rename cdio_get_default_device get_device;
|
152
|
+
%feature("autodoc",
|
153
|
+
"get_device(cdio)->str
|
154
|
+
|
155
|
+
Get the CD device associated with cdio.
|
156
|
+
If cdio is NULL (we haven't initialized a specific device driver),
|
157
|
+
then find a suitable one and return the default device for that.
|
158
|
+
|
159
|
+
In some situations of drivers or OS's we can't find a CD device if
|
160
|
+
there is no media in it and it is possible for this routine to return
|
161
|
+
nil even though there may be a hardware CD-ROM.");
|
162
|
+
char *cdio_get_default_device (const CdIo_t *p_cdio=NULL);
|
163
|
+
|
164
|
+
%newobject get_default_device_driver; // free malloc'd return value
|
165
|
+
%feature("autodoc",
|
166
|
+
"get_default_device_driver(driver_id=nil)->[device, driver]
|
167
|
+
Return a string containing the default CD device if none is specified.
|
168
|
+
if p_driver_id is DRIVER_UNKNOWN or DRIVER_DEVICE then find a suitable
|
169
|
+
one set the default device for that.
|
170
|
+
|
171
|
+
nil is returned as the device if we couldn't get a default device.");
|
172
|
+
%apply driver_id_t *OUTPUT { driver_id_t *p_out_driver_id };
|
173
|
+
char *get_default_device_driver (driver_id_t p_driver_id,
|
174
|
+
driver_id_t *p_out_driver_id);
|
175
|
+
%inline %{
|
176
|
+
char *
|
177
|
+
get_default_device_driver(driver_id_t driver_id, driver_id_t *p_out_driver_id)
|
178
|
+
{
|
179
|
+
*p_out_driver_id = driver_id;
|
180
|
+
return cdio_get_default_device_driver(p_out_driver_id);
|
181
|
+
}
|
182
|
+
%}
|
183
|
+
|
184
|
+
%rename cdio_get_devices get_devices;
|
185
|
+
/*! Return an array of device names. If you want a specific
|
186
|
+
devices for a driver, give that device. If you want hardware
|
187
|
+
devices, give DRIVER_DEVICE and if you want all possible devices,
|
188
|
+
image drivers and hardware drivers give DRIVER_UNKNOWN.
|
189
|
+
|
190
|
+
NULL is returned if we couldn't return a list of devices.
|
191
|
+
|
192
|
+
In some situations of drivers or OS's we can't find a CD device if
|
193
|
+
there is no media in it and it is possible for this routine to return
|
194
|
+
NULL even though there may be a hardware CD-ROM.
|
195
|
+
*/
|
196
|
+
DeviceList_t cdio_get_devices (driver_id_t driver_id);
|
197
|
+
|
198
|
+
/* Like cdio_get_devices, but we may change the p_driver_id if we
|
199
|
+
were given DRIVER_DEVICE or DRIVER_UNKNOWN. This is because
|
200
|
+
often one wants to get a drive name and then *open* it
|
201
|
+
afterwards. Giving the driver back facilitates this, and speeds
|
202
|
+
things up for libcdio as well.
|
203
|
+
*/
|
204
|
+
|
205
|
+
DeviceList_t get_devices_ret (driver_id_t driver_id,
|
206
|
+
driver_id_t *p_out_driver_id);
|
207
|
+
%inline %{
|
208
|
+
DeviceList_t get_devices_ret (driver_id_t driver_id,
|
209
|
+
driver_id_t *p_out_driver_id) {
|
210
|
+
*p_out_driver_id = driver_id;
|
211
|
+
return cdio_get_devices_ret (p_out_driver_id);
|
212
|
+
}
|
213
|
+
%}
|
214
|
+
|
215
|
+
%feature("autodoc",
|
216
|
+
"get_devices_with_cap(capabilities, any)->[device1, device2...]
|
217
|
+
Get an array of device names in search_devices that have at least
|
218
|
+
the capabilities listed by the capabities parameter.
|
219
|
+
|
220
|
+
If any is False then every capability listed in the
|
221
|
+
extended portion of capabilities (i.e. not the basic filesystem)
|
222
|
+
must be satisified. If any is True, then if any of the
|
223
|
+
capabilities matches, we call that a success.
|
224
|
+
|
225
|
+
To find a CD-drive of any type, use the mask CDIO_FS_MATCH_ALL.
|
226
|
+
|
227
|
+
The array of device names is returned or NULL if we couldn't get a
|
228
|
+
default device. It is also possible to return a non NULL but after
|
229
|
+
dereferencing the the value is NULL. This also means nothing was
|
230
|
+
found.");
|
231
|
+
DeviceList_t get_devices_with_cap (unsigned int capabilities, bool b_any);
|
232
|
+
%inline %{
|
233
|
+
DeviceList_t
|
234
|
+
get_devices_with_cap (unsigned int capabilities, bool b_any) {
|
235
|
+
/* FIXME: ? libcdio allows one to specify a list (char **) of devices
|
236
|
+
to search. Don't know how to do that via SWIG though. */
|
237
|
+
return cdio_get_devices_with_cap (NULL, (cdio_fs_anal_t) capabilities,
|
238
|
+
b_any);
|
239
|
+
}
|
240
|
+
%}
|
241
|
+
|
242
|
+
%apply driver_id_t *OUTPUT { driver_id_t *p_out_driver_id };
|
243
|
+
%newobject get_devices_with_cap_ret;
|
244
|
+
%feature("autodoc",
|
245
|
+
"Like cdio_get_devices_with_cap but we return the driver we found
|
246
|
+
as well. This is because often one wants to search for kind of drive
|
247
|
+
and then *open* it afterwards. Giving the driver back facilitates this,
|
248
|
+
and speeds things up for libcdio as well.");
|
249
|
+
DeviceList_t get_devices_with_cap_ret (unsigned int capabilities, bool b_any,
|
250
|
+
driver_id_t *p_out_driver_id);
|
251
|
+
%inline %{
|
252
|
+
DeviceList_t
|
253
|
+
get_devices_with_cap_ret (unsigned int capabilities, bool b_any,
|
254
|
+
driver_id_t *p_out_driver_id) {
|
255
|
+
/* FIXME: ? libcdio allows one to specify a list (char **) of devices
|
256
|
+
to search. Don't know how to do that via SWIG though. */
|
257
|
+
return cdio_get_devices_with_cap_ret (NULL,
|
258
|
+
(cdio_fs_anal_t) capabilities, b_any,
|
259
|
+
p_out_driver_id);
|
260
|
+
}
|
261
|
+
%}
|
262
|
+
|
263
|
+
%rename cdio_get_drive_cap get_drive_cap;
|
264
|
+
%feature("autodoc",
|
265
|
+
"get_drive_cap()->(read_cap, write_cap, misc_cap)
|
266
|
+
|
267
|
+
Get drive capabilities of device.
|
268
|
+
|
269
|
+
In some situations of drivers or OS's we can't find a CD device if
|
270
|
+
there is no media in it. In this situation capabilities will show up as
|
271
|
+
empty even though there is a hardware CD-ROM.");
|
272
|
+
%apply uint32_t *OUTPUT { uint32_t *p_read_cap,
|
273
|
+
uint32_t *p_write_cap,
|
274
|
+
uint32_t *p_misc_cap };
|
275
|
+
void cdio_get_drive_cap (const CdIo_t *p_cdio,
|
276
|
+
uint32_t *p_read_cap,
|
277
|
+
uint32_t *p_write_cap,
|
278
|
+
uint32_t *p_misc_cap);
|
279
|
+
|
280
|
+
%rename cdio_get_drive_cap_dev get_drive_cap;
|
281
|
+
%feature("autodoc",
|
282
|
+
"get_drive_cap_dev()->(read_cap, write_cap, misc_cap)
|
283
|
+
|
284
|
+
Get drive capabilities of device.
|
285
|
+
|
286
|
+
In some situations of drivers or OS's we can't find a CD device if
|
287
|
+
there is no media in it. In this situation capabilities will show up as
|
288
|
+
empty even though there is a hardware CD-ROM.");
|
289
|
+
|
290
|
+
void cdio_get_drive_cap_dev(const char *device=NULL,
|
291
|
+
uint32_t *p_read_cap,
|
292
|
+
uint32_t *p_write_cap,
|
293
|
+
uint32_t *p_misc_cap);
|
294
|
+
|
295
|
+
%rename cdio_get_driver_name get_driver_name;
|
296
|
+
%feature("autodoc",
|
297
|
+
"get_driver_name(cdio)-> string
|
298
|
+
|
299
|
+
return a string containing the name of the driver in use.
|
300
|
+
");
|
301
|
+
const char *cdio_get_driver_name (const CdIo_t *p_cdio);
|
302
|
+
|
303
|
+
%rename cdio_get_driver_id get_driver_id;
|
304
|
+
%feature("autodoc",
|
305
|
+
"get_driver_id(cdio)-> int
|
306
|
+
|
307
|
+
Return the driver id of the driver in use.
|
308
|
+
if cdio has not been initialized or is nil,
|
309
|
+
return pycdio.DRIVER_UNKNOWN.");
|
310
|
+
driver_id_t cdio_get_driver_id (const CdIo_t *p_cdio);
|
311
|
+
|
312
|
+
%rename cdio_get_last_session get_last_session;
|
313
|
+
%apply int32_t *OUTPUT { lsn_t *i_last_session };
|
314
|
+
driver_return_code_t cdio_get_last_session (CdIo_t *p_cdio,
|
315
|
+
lsn_t *i_last_session);
|
316
|
+
|
317
|
+
%feature("autodoc",
|
318
|
+
"have_driver(driver_id) -> int
|
319
|
+
|
320
|
+
Return 1 if we have driver driver_id, 0 if not and -1
|
321
|
+
if driver id is out of range.");
|
322
|
+
%inline %{
|
323
|
+
int
|
324
|
+
have_driver (unsigned int driver_id)
|
325
|
+
{
|
326
|
+
if (driver_id < CDIO_MIN_DRIVER || driver_id > CDIO_MAX_DRIVER)
|
327
|
+
return -1;
|
328
|
+
if (cdio_have_driver(driver_id)) return 1;
|
329
|
+
return 0;
|
330
|
+
}
|
331
|
+
%}
|
332
|
+
|
333
|
+
%rename have_ATAPI "ATAPI?";
|
334
|
+
%feature("autodoc",
|
335
|
+
"ATAPI?(CdIo_t *p_cdio)->bool
|
336
|
+
return True if CD-ROM understand ATAPI commands.");
|
337
|
+
%inline %{
|
338
|
+
/*! True if CD-ROM understand ATAPI commands. */
|
339
|
+
bool
|
340
|
+
have_ATAPI (CdIo_t *p_cdio)
|
341
|
+
{
|
342
|
+
return cdio_have_atapi(p_cdio) == yep;
|
343
|
+
}
|
344
|
+
%}
|
345
|
+
|
346
|
+
%inline %{
|
347
|
+
typedef char * buf_t;
|
348
|
+
%}
|
349
|
+
|
350
|
+
%rename cdio_is_binfile is_binfile;
|
351
|
+
%feature("autodoc",
|
352
|
+
"is_binfile(binfile_name)->cue_name
|
353
|
+
|
354
|
+
Determine if binfile_name is the BIN file part of a CDRWIN CD disk
|
355
|
+
image.
|
356
|
+
|
357
|
+
Return the corresponding CUE file if bin_name is a BIN file or
|
358
|
+
nil if not a BIN file.");
|
359
|
+
buf_t cdio_is_binfile(const char *bin_name);
|
360
|
+
|
361
|
+
%rename cdio_is_cuefile is_cuefile;
|
362
|
+
%feature("autodoc",
|
363
|
+
"is_cuefile(cuefile_name)->bin_name
|
364
|
+
|
365
|
+
Determine if cuefile_name is the CUE file part of a CDRWIN CD disk
|
366
|
+
image.
|
367
|
+
|
368
|
+
Return the corresponding BIN file if bin_name is a CUE file or
|
369
|
+
nil if not a CUE file.");
|
370
|
+
buf_t cdio_is_cuefile(const char *cue_name);
|
371
|
+
|
372
|
+
%rename is_device "device?";
|
373
|
+
|
374
|
+
bool cdio_is_device(const char *psz_source,
|
375
|
+
driver_id_t driver_id=DRIVER_UNKNOWN);
|
376
|
+
|
377
|
+
%inline %{
|
378
|
+
bool
|
379
|
+
is_device(const char *psz_source, driver_id_t driver_id)
|
380
|
+
{
|
381
|
+
#if LIBCDIO_VERSION_NUM <= 76
|
382
|
+
/* There is a bug in the 0.76 code when driver_id==DRIVER_UNKNOWN
|
383
|
+
or DRIVER_DEVICE, so here we'll use code from compat.swg.
|
384
|
+
*/
|
385
|
+
if (DRIVER_UNKNOWN == driver_id || DRIVER_DEVICE == driver_id) {
|
386
|
+
char *psz_drive = cdio_get_default_device_driver(&driver_id);
|
387
|
+
/* We don't need the psz_drive, just the driver_id */
|
388
|
+
free(psz_drive);
|
389
|
+
}
|
390
|
+
#endif /* LIBCDIO_VERSION_NUM <= 76 */
|
391
|
+
return cdio_is_device(psz_source, driver_id);
|
392
|
+
}
|
393
|
+
%}
|
394
|
+
bool cdio_is_device(const char *psz_source,
|
395
|
+
driver_id_t driver_id=DRIVER_UNKNOWN);
|
396
|
+
|
397
|
+
%rename cdio_is_nrg "nrg?";
|
398
|
+
%feature("autodoc",
|
399
|
+
"nrg?(cue_name)->bool
|
400
|
+
|
401
|
+
Determine if nrg_name is a Nero CD disc image");
|
402
|
+
bool cdio_is_nrg(const char *nrg_name);
|
403
|
+
|
404
|
+
%rename cdio_is_tocfile "tocfile?";
|
405
|
+
%feature("autodoc",
|
406
|
+
"tocfile?(tocfile_name)->bool
|
407
|
+
|
408
|
+
Determine if tocfile_name is a cdrdao CD disc image");
|
409
|
+
bool cdio_is_tocfile(const char *tocfile_name);
|
410
|
+
|
411
|
+
%rename cdio_get_media_changed get_media_changed;
|
412
|
+
%feature("autodoc",
|
413
|
+
"get_media_changed(cdio) -> int
|
414
|
+
|
415
|
+
Find out if media has changed since the last call.
|
416
|
+
Return 1 if media has changed since last call, 0 if not. Error
|
417
|
+
return codes are the same as driver_return_code_t");
|
418
|
+
int cdio_get_media_changed(CdIo_t *p_cdio);
|
419
|
+
|
420
|
+
/* Set up to allow returning hardware info. We'll use a typedef so we
|
421
|
+
can make sure to isolate this.
|
422
|
+
*/
|
423
|
+
|
424
|
+
%inline %{
|
425
|
+
typedef struct {
|
426
|
+
cdio_hwinfo_t hw;
|
427
|
+
bool result;
|
428
|
+
} HWInfo_t;
|
429
|
+
%}
|
430
|
+
|
431
|
+
|
432
|
+
%typemap(out) HWInfo_t {
|
433
|
+
// $1 is of type HWInfo_t
|
434
|
+
VALUE ret;
|
435
|
+
if ($1.result == 0)
|
436
|
+
return Qnil;
|
437
|
+
else {
|
438
|
+
ret = rb_hash_new();
|
439
|
+
rb_hash_aset(ret, rb_str_new2("vendor"),
|
440
|
+
rb_str_new2($1.hw.psz_vendor));
|
441
|
+
rb_hash_aset(ret, rb_str_new2("model"),
|
442
|
+
rb_str_new2($1.hw.psz_model));
|
443
|
+
rb_hash_aset(ret, rb_str_new2("revision"),
|
444
|
+
rb_str_new2($1.hw.psz_revision));
|
445
|
+
return ret;
|
446
|
+
}
|
447
|
+
}
|
448
|
+
|
449
|
+
/*
|
450
|
+
get_hwinfo(p_cdio)->[vendor, model, release]
|
451
|
+
Get the CD-ROM hardware info via a SCSI MMC INQUIRY command.
|
452
|
+
An exception is raised if we had an error.
|
453
|
+
*/
|
454
|
+
const HWInfo_t get_hwinfo ( const CdIo_t *p_cdio);
|
455
|
+
|
456
|
+
%inline %{
|
457
|
+
const
|
458
|
+
HWInfo_t get_hwinfo ( const CdIo_t *p_cdio)
|
459
|
+
{
|
460
|
+
static HWInfo_t info;
|
461
|
+
info.result = cdio_get_hwinfo(p_cdio, &info.hw);
|
462
|
+
return info;
|
463
|
+
}
|
464
|
+
%}
|
465
|
+
|
466
|
+
%rename cdio_set_blocksize set_blocksize;
|
467
|
+
%feature("autodoc",
|
468
|
+
"set_blocksize(cdio, blocksize)->return_status
|
469
|
+
|
470
|
+
Set the blocksize for subsequent reads.");
|
471
|
+
driver_return_code_t cdio_set_blocksize ( const CdIo_t *p_cdio,
|
472
|
+
int i_blocksize );
|
473
|
+
|
474
|
+
%rename cdio_set_speed set_speed;
|
475
|
+
%feature("autodoc",
|
476
|
+
"cdio_set_speed(cdio, speed)->return_status
|
477
|
+
Set the drive speed.");
|
478
|
+
driver_return_code_t cdio_set_speed ( const CdIo_t *p_cdio, int i_speed );
|
479
|
+
|
480
|
+
|
481
|
+
/**** Using the name open() conflicts with some C routine.
|
482
|
+
So we use open_cd() instead.
|
483
|
+
***/
|
484
|
+
%feature("autodoc",
|
485
|
+
"open_cd(source=NULL, driver_id=nil, access_mode=nil)
|
486
|
+
|
487
|
+
Sets up to read from place specified by source, driver_id and
|
488
|
+
access mode. This should be called before using any other routine
|
489
|
+
except those that act on a CD-ROM drive by name.
|
490
|
+
|
491
|
+
If nil is given as the source, we'll use the default driver device.
|
492
|
+
If nil is given as the driver_id, we'll find a suitable device driver.
|
493
|
+
|
494
|
+
Return the a pointer than can be used in subsequent operations or
|
495
|
+
nil on error or no device.");
|
496
|
+
CdIo_t *open_cd(const char *psz_source,
|
497
|
+
driver_id_t driver_id=DRIVER_UNKNOWN,
|
498
|
+
const char *psz_access_mode=NULL);
|
499
|
+
|
500
|
+
%inline %{
|
501
|
+
CdIo_t *open_cd(const char *psz_orig_source, driver_id_t driver_id,
|
502
|
+
const char *psz_orig_access_mode)
|
503
|
+
{
|
504
|
+
const char *psz_source = psz_orig_source;
|
505
|
+
const char *psz_access_mode = psz_orig_access_mode;
|
506
|
+
|
507
|
+
if (psz_source && strlen(psz_source) == 0)
|
508
|
+
psz_source = NULL;
|
509
|
+
if (psz_access_mode || strlen(psz_access_mode) == 0)
|
510
|
+
psz_access_mode = NULL;
|
511
|
+
return cdio_open_am(psz_source, driver_id, psz_access_mode);
|
512
|
+
}
|
513
|
+
%}
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/* -*- c -*-
|
2
|
+
$Id: device_const.swg,v 1.1.1.1 2006/11/13 05:13:33 rocky Exp $
|
3
|
+
|
4
|
+
Copyright (C) 2006 Rocky Bernstein <rocky@cpan.org>
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation; either version 2 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU General Public License
|
17
|
+
along with this program; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
*/
|
20
|
+
/* See <cdio/device.h> for more extensive documentation. */
|
21
|
+
|
22
|
+
/**** ALL OF THESE ARE CONSTANTS *** */
|
23
|
+
%immutable;
|
24
|
+
|
25
|
+
/* Drive types returned by cdio_get_drive_cap() */
|
26
|
+
%constant long int DRIVE_CAP_ERROR = CDIO_DRIVE_CAP_ERROR;
|
27
|
+
%constant long int DRIVE_CAP_UNKNOWN = CDIO_DRIVE_CAP_UNKNOWN;
|
28
|
+
%constant long int DRIVE_CAP_MISC_CLOSE_TRAY = CDIO_DRIVE_CAP_MISC_CLOSE_TRAY;
|
29
|
+
%constant long int DRIVE_CAP_MISC_EJECT = CDIO_DRIVE_CAP_MISC_EJECT;
|
30
|
+
%constant long int DRIVE_CAP_MISC_LOCK = CDIO_DRIVE_CAP_MISC_LOCK ;
|
31
|
+
%constant long int DRIVE_CAP_MISC_SELECT_SPEED = CDIO_DRIVE_CAP_MISC_SELECT_SPEED;
|
32
|
+
%constant long int DRIVE_CAP_MISC_SELECT_DISC = CDIO_DRIVE_CAP_MISC_SELECT_DISC;
|
33
|
+
%constant long int DRIVE_CAP_MISC_MULTI_SESSION = CDIO_DRIVE_CAP_MISC_MULTI_SESSION;
|
34
|
+
%constant long int DRIVE_CAP_MISC_MEDIA_CHANGED = CDIO_DRIVE_CAP_MISC_MEDIA_CHANGED;
|
35
|
+
%constant long int DRIVE_CAP_MISC_RESET = CDIO_DRIVE_CAP_MISC_RESET;
|
36
|
+
%constant long int DRIVE_CAP_MISC_FILE = CDIO_DRIVE_CAP_MISC_FILE;
|
37
|
+
|
38
|
+
/* Reading masks.. */
|
39
|
+
%constant long int DRIVE_CAP_READ_AUDIO = CDIO_DRIVE_CAP_READ_AUDIO;
|
40
|
+
%constant long int DRIVE_CAP_READ_CD_DA = CDIO_DRIVE_CAP_READ_CD_DA;
|
41
|
+
%constant long int DRIVE_CAP_READ_CD_G = CDIO_DRIVE_CAP_READ_CD_G;
|
42
|
+
%constant long int DRIVE_CAP_READ_CD_R = CDIO_DRIVE_CAP_READ_CD_R;
|
43
|
+
%constant long int DRIVE_CAP_READ_CD_RW = CDIO_DRIVE_CAP_READ_CD_RW;
|
44
|
+
%constant long int DRIVE_CAP_READ_DVD_R = CDIO_DRIVE_CAP_READ_DVD_R;
|
45
|
+
%constant long int DRIVE_CAP_READ_DVD_PR = CDIO_DRIVE_CAP_READ_DVD_PR;
|
46
|
+
%constant long int DRIVE_CAP_READ_DVD_RAM = CDIO_DRIVE_CAP_READ_DVD_RAM;
|
47
|
+
%constant long int DRIVE_CAP_READ_DVD_ROM = CDIO_DRIVE_CAP_READ_DVD_ROM;
|
48
|
+
%constant long int DRIVE_CAP_READ_DVD_RW = CDIO_DRIVE_CAP_READ_DVD_RW;
|
49
|
+
%constant long int DRIVE_CAP_READ_DVD_RPW = CDIO_DRIVE_CAP_READ_DVD_RPW;
|
50
|
+
%constant long int DRIVE_CAP_READ_C2_ERRS = CDIO_DRIVE_CAP_READ_C2_ERRS;
|
51
|
+
%constant long int DRIVE_CAP_READ_MODE2_FORM1 = CDIO_DRIVE_CAP_READ_MODE2_FORM1;
|
52
|
+
%constant long int DRIVE_CAP_READ_MODE2_FORM2 = CDIO_DRIVE_CAP_READ_MODE2_FORM2;
|
53
|
+
%constant long int DRIVE_CAP_READ_MCN = CDIO_DRIVE_CAP_READ_MCN;
|
54
|
+
%constant long int DRIVE_CAP_READ_ISRC = CDIO_DRIVE_CAP_READ_ISRC;
|
55
|
+
|
56
|
+
/* Writing masks.. */
|
57
|
+
%constant long int DRIVE_CAP_WRITE_CD_R = CDIO_DRIVE_CAP_WRITE_CD_R;
|
58
|
+
%constant long int DRIVE_CAP_WRITE_CD_RW = CDIO_DRIVE_CAP_WRITE_CD_RW;
|
59
|
+
%constant long int DRIVE_CAP_WRITE_DVD_R = CDIO_DRIVE_CAP_WRITE_DVD_R;
|
60
|
+
%constant long int DRIVE_CAP_WRITE_DVD_PR = CDIO_DRIVE_CAP_WRITE_DVD_PR;
|
61
|
+
%constant long int DRIVE_CAP_WRITE_DVD_RAM = CDIO_DRIVE_CAP_WRITE_DVD_RAM;
|
62
|
+
%constant long int DRIVE_CAP_WRITE_DVD_RW = CDIO_DRIVE_CAP_WRITE_DVD_RW ;
|
63
|
+
%constant long int DRIVE_CAP_WRITE_DVD_RPW = CDIO_DRIVE_CAP_WRITE_DVD_RPW;
|
64
|
+
%constant long int DRIVE_CAP_WRITE_MT_RAINIER = CDIO_DRIVE_CAP_WRITE_MT_RAINIER;
|
65
|
+
%constant long int DRIVE_CAP_WRITE_BURN_PROOF = CDIO_DRIVE_CAP_WRITE_BURN_PROOF;
|
66
|
+
|
67
|
+
/*** Masks derived from above... ***/
|
68
|
+
/* Has some sort of CD writer ability. */
|
69
|
+
%constant long int DRIVE_CAP_WRITE_CD = CDIO_DRIVE_CAP_WRITE_CD;
|
70
|
+
/* Has some sort of DVD writer ability */
|
71
|
+
%constant long int DRIVE_CAP_WRITE_DVD = CDIO_DRIVE_CAP_WRITE_DVD;
|
72
|
+
%constant long int DRIVE_CAP_WRITE = CDIO_DRIVE_CAP_WRITE;
|
73
|
+
|
74
|
+
/*! Size of fields returned by an INQUIRY command */
|
75
|
+
%constant long int MMC_HW_VENDOR_LEN = CDIO_MMC_HW_VENDOR_LEN;
|
76
|
+
%constant long int MMC_HW_MODEL_LEN = CDIO_MMC_HW_MODEL_LEN;
|
77
|
+
%constant long int MMC_HW_REVISION_LEN = CDIO_MMC_HW_REVISION_LEN;
|
78
|
+
|
79
|
+
/**! Flags specifying the category of device to open or is opened. */
|
80
|
+
%constant long int SRC_IS_DISK_IMAGE_MASK = CDIO_SRC_IS_DISK_IMAGE_MASK;
|
81
|
+
%constant long int SRC_IS_DEVICE_MASK = CDIO_SRC_IS_DEVICE_MASK;
|
82
|
+
%constant long int SRC_IS_SCSI_MASK = CDIO_SRC_IS_SCSI_MASK;
|
83
|
+
%constant long int SRC_IS_NATIVE_MASK = CDIO_SRC_IS_NATIVE_MASK;
|
84
|
+
|
85
|
+
/* driver_id_t enums. */
|
86
|
+
%constant long int DRIVER_UNKNOWN = DRIVER_UNKNOWN;
|
87
|
+
%constant long int DRIVER_AIX = DRIVER_AIX;
|
88
|
+
%constant long int DRIVER_BSDI = DRIVER_BSDI;
|
89
|
+
%constant long int DRIVER_FREEBSD = DRIVER_FREEBSD;
|
90
|
+
%constant long int DRIVER_LINUX = DRIVER_LINUX;
|
91
|
+
%constant long int DRIVER_SOLARIS = DRIVER_SOLARIS;
|
92
|
+
%constant long int DRIVER_OSX = DRIVER_OSX;
|
93
|
+
%constant long int DRIVER_WIN32 = DRIVER_WIN32;
|
94
|
+
%constant long int DRIVER_CDRDAO = DRIVER_CDRDAO;
|
95
|
+
%constant long int DRIVER_BINCUE = DRIVER_BINCUE;
|
96
|
+
%constant long int DRIVER_NRG = DRIVER_NRG;
|
97
|
+
%constant long int DRIVER_DEVICE = DRIVER_DEVICE;
|
98
|
+
|
99
|
+
%constant long int MIN_DRIVER = CDIO_MIN_DRIVER;
|
100
|
+
%constant long int MIN_DEVICE_DRIVER = CDIO_MIN_DEVICE_DRIVER;
|
101
|
+
%constant long int MAX_DRIVER = CDIO_MAX_DRIVER;
|
102
|
+
%constant long int MAX_DEVICE_DRIVER = CDIO_MAX_DEVICE_DRIVER;
|
103
|
+
|
104
|
+
|
105
|
+
%constant long int DRIVER_OP_SUCCESS = DRIVER_OP_SUCCESS;
|
106
|
+
%constant long int DRIVER_OP_ERROR = DRIVER_OP_ERROR;
|
107
|
+
%constant long int DRIVER_OP_UNSUPPORTED = DRIVER_OP_UNSUPPORTED;
|
108
|
+
%constant long int DRIVER_OP_UNINIT = DRIVER_OP_UNINIT;
|
109
|
+
%constant long int DRIVER_OP_NOT_PERMITTED = DRIVER_OP_NOT_PERMITTED;
|
110
|
+
%constant long int DRIVER_OP_BAD_PARAMETER = DRIVER_OP_BAD_PARAMETER;
|
111
|
+
%constant long int DRIVER_OP_BAD_POINTER = DRIVER_OP_BAD_POINTER;
|
112
|
+
%constant long int DRIVER_OP_NO_DRIVER = DRIVER_OP_NO_DRIVER;
|
113
|
+
|
114
|
+
%constant unsigned int FS_AUDIO = CDIO_FS_AUDIO;
|
115
|
+
%constant unsigned int FS_HIGH_SIERRA = CDIO_FS_HIGH_SIERRA;
|
116
|
+
%constant unsigned int FS_ISO_9660 = CDIO_FS_ISO_9660;
|
117
|
+
%constant unsigned int FS_INTERACTIVE = CDIO_FS_INTERACTIVE;
|
118
|
+
%constant unsigned int FS_HFS = CDIO_FS_HFS;
|
119
|
+
%constant unsigned int FS_UFS = CDIO_FS_UFS;
|
120
|
+
%constant unsigned int FS_EXT2 = CDIO_FS_EXT2;
|
121
|
+
%constant unsigned int FS_ISO_HFS = CDIO_FS_ISO_HFS;
|
122
|
+
%constant unsigned int FS_ISO_9660_INTERACTIVE = CDIO_FS_ISO_9660_INTERACTIVE;
|
123
|
+
%constant unsigned int FS_3DO = CDIO_FS_3DO;
|
124
|
+
%constant unsigned int FS_XISO = CDIO_FS_XISO;
|
125
|
+
%constant unsigned int FS_UDFX = CDIO_FS_UDFX;
|
126
|
+
%constant unsigned int FS_UDF = CDIO_FS_UDF;
|
127
|
+
%constant unsigned int FS_ISO_UDF = CDIO_FS_ISO_UDF;
|
128
|
+
|
129
|
+
%constant unsigned int FS_ANAL_XA = CDIO_FS_ANAL_XA;
|
130
|
+
%constant unsigned int FS_ANAL_MULTISESSION = CDIO_FS_ANAL_MULTISESSION;
|
131
|
+
%constant unsigned int FS_ANAL_PHOTO_CD = CDIO_FS_ANAL_PHOTO_CD;
|
132
|
+
%constant unsigned int FS_ANAL_HIDDEN_TRACK = CDIO_FS_ANAL_HIDDEN_TRACK;
|
133
|
+
%constant unsigned int FS_ANAL_CDTV = CDIO_FS_ANAL_CDTV;
|
134
|
+
%constant unsigned int FS_ANAL_BOOTABLE = CDIO_FS_ANAL_BOOTABLE;
|
135
|
+
%constant unsigned int FS_ANAL_VIDEOCD = CDIO_FS_ANAL_VIDEOCD;
|
136
|
+
%constant unsigned int FS_ANAL_ROCKRIDGE = CDIO_FS_ANAL_ROCKRIDGE;
|
137
|
+
%constant unsigned int FS_ANAL_JOLIET = CDIO_FS_ANAL_JOLIET;
|
138
|
+
%constant unsigned int FS_ANAL_SVCD = CDIO_FS_ANAL_SVCD;
|
139
|
+
%constant unsigned int FS_ANAL_CVD = CDIO_FS_ANAL_CVD;
|
140
|
+
%constant unsigned int FS_ANAL_XISO = CDIO_FS_ANAL_XISO;
|
141
|
+
%constant unsigned int FS_MATCH_ALL = CDIO_FS_MATCH_ALL;
|
142
|
+
%constant unsigned int FS_UNKNOWN = CDIO_FS_UNKNOWN;
|
143
|
+
|
144
|
+
%mutable;
|