Debian Codegraph @

swig/perlcdio.swg

raw
1 /* -*- c -*-
2 Copyright (C) 2006, 2008, 2011, 2012 Rocky Bernstein <[email protected]>
3 See end for license.
4 */
5 %define DOCSTRING
6 "This is a wrapper for The CD Input and Control library (libcdio) which
7 encapsulates CD-ROM reading and control. Python programs wishing to be
8 oblivious of the OS- and device-dependent properties of a CD-ROM can
9 use this library."
10 %enddef
11 %module(docstring=DOCSTRING) perlcdio
12 %{
13 /* Includes the header in the wrapper code */
14 #include <cdio/types.h>
15 #include <cdio/cdio.h>
16 #include <cdio/audio.h>
17 #include <cdio/cd_types.h>
18 #include <cdio/iso9660.h>
19 %}
20
21 %include "typemaps.i"
22 /*%include "cstring.i"*/
23
24 /* Various libcdio constants and typedefs */
25 %include "types.swg"
26
27 %feature("autodoc", 1);
28
29 %include "audio.swg"
30 %include "read.swg"
31 %include "track.swg"
32 %include "cdtext.swg"
33
34 /* In the presence of the exception handling, the order is important.
35 The below use %exception.
36 */
37 %include "device.swg"
38 %include "disc.swg"
39
40 /* Encapsulation is done in two parts. The lower-level Perl interface
41 is called perlcdio (this file) and is generated via SWIG.
42
43 The more object-oriented module is Device::Cdio; it is a Perl class
44 that uses perlcdio. Although perlcdio is perfectly usable on its own,
45 it is expected that cdio is what most people will use. As pycdio more
46 closely models the C interface, it is conceivable (if unlikely) that
47 diehard libcdio C users who are very familiar with that interface
48 could prefer that.
49
50 It is probably possible to change the SWIG in such a way to combine
51 these pieces. However there are the problems. First, I'm not that much
52 of a SWIG expert. Second it looks as though the resulting SWIG code
53 would be more complex. Third the separation makes translation very
54 straight forward to understand and maintain: first get what's in C
55 into Python as a one-to-one translation. Then we implement some nice
56 abstraction off of that. The abstraction can be modified without
57 having to redo the underlying translation. (But the reverse is
58 generally not true: usually changes to the C-to-python translation,
59 pycdio, do result in small, but obvious and straightforward changes to
60 the abstraction layer cdio.)
61 */
62
63 %feature("autodoc",
64 "Returns the libcdio version string, i.e. the library Device::Cdio
65 is currently using.");
66 %inline %{
67 const char * cdio_version()
68 {
69 return CDIO_VERSION;
70 }
71 %}
72
73
74 %perlcode %{
75 import Device::Cdio::VERSION;
76 $VERSION = $Device::Cdio::VERSION;
77 use strict;
78 =pod
79
80 =head1 NAME
81
82 perlcdio - lower-level wrapper to libcdio, the CD Input and Control library
83
84 =head1 SYNOPSIS
85
86 This is fairly straight-forward wrapper around the C library libcdio.
87 Although this is perfectly usable on its own, it is expected that the
88 Object-Oriented interface L<Device::Cdio> is what most people will
89 want to use.
90
91 There are various constants that are defined here.
92
93 =head1 DESCRIPTION
94
95 Encapsulation is done in two parts. The lower-level Perl
96 interface is called perlcdio (this file) and is generated via SWIG.
97
98 =head1 CONSTANTS
99
100 =head2 Driver ID's
101
102 =over 4
103
104 =item DRIVER_UNKNOWN
105
106 Use when you don't know what kind of driver and you don't care if it
107 is an CD image driver or a real CD-ROM driver. See also DRIVER_DEVICE
108 which doesn't include image drivers.
109
110 =item DRIVER_AIX
111
112 Driver for IBM's AIX.
113
114 =item DRIVER_BSDI
115
116 Driver for BSDI.
117
118 =item DRIVER_FREEBSD
119
120 Driver for Free BSD
121
122 =item DRIVER_LINUX
123
124 Driver for GNU/LINUX
125
126 =item DRIVER_SOLARIS
127
128 Driver for Solaris
129
130 =item DRIVER_OSX
131
132 Driver for Apple's OS X.
133
134 =item DRIVER_WIN32
135
136 Driver for Microsoft Windows
137
138 =item DRIVER_CDRDAO
139
140 Image Driver for cdrdao
141
142 =item DRIVER_BINCUE
143
144 Image driver for CDRWin BIN/CUE
145
146 =item DRIVER_NRG
147
148 Image driver for Nero NRG
149
150 =item DRIVER_DEVICE
151
152 Use when you don't know what kind of driver but the driver must be a
153 real CD-ROM driver. See also DRIVER_UNKNOWN which includes image
154 drivers.
155
156 =back
157
158
159 =head2 Driver Return codes
160
161 May driver operations return a status code.
162
163 =over 4
164
165 =item DRIVER_OP_SUCCESS
166
167 Driver operation was successful
168
169 =item DRIVER_OP_ERROR
170
171 Driver operation had an error of some sort
172
173 =item DRIVER_OP_UNSUPPORTED
174
175 Operation is not supported for this driver. For example
176 ejecting a CD from an image driver.
177
178 =item DRIVER_OP_UNINIT
179
180 Source is not initialized for this operation.
181
182 =item DRIVER_OP_NOT_PERMITTED
183
184 Operation is not permitted
185
186 =item DRIVER_OP_BAD_PARAMETER
187
188 An invalid parameter was passed to the routine
189
190 =item DRIVER_OP_BAD_POINTER
191
192 A pointer somehow got corrupted.
193
194 =item DRIVER_OP_NO_DRIVER
195
196 No driver has been set.
197
198 =back
199
200 =head2 Device Capabilities
201
202 =head3 Miscellaneous
203
204 =over 4
205
206 =item DRIVE_CAP_ERROR
207
208 =item DRIVE_CAP_UNKNOWN
209
210 =item DRIVE_CAP_MISC_CLOSE_TRAY
211
212 =item DRIVE_CAP_MISC_EJECT
213
214 =item DRIVE_CAP_MISC_LOCK
215
216 =item DRIVE_CAP_MISC_SELECT_SPEED
217
218 =item DRIVE_CAP_MISC_SELECT_DISC
219
220 =item DRIVE_CAP_MISC_MULTI_SESSION
221
222 =item DRIVE_CAP_MISC_MEDIA_CHANGED
223
224 =item DRIVE_CAP_MISC_RESET
225
226 =item DRIVE_CAP_MISC_FILE
227
228 =back
229
230 =head3 Read Capabilities
231
232 =over 4
233
234 =item DRIVE_CAP_READ_AUDIO
235
236 =item DRIVE_CAP_READ_CD_DA
237
238 =item DRIVE_CAP_READ_CD_G
239
240 =item DRIVE_CAP_READ_CD_R
241
242 =item DRIVE_CAP_READ_CD_RW
243
244 =item DRIVE_CAP_READ_DVD_R
245
246 =item DRIVE_CAP_READ_DVD_PR
247
248 =item DRIVE_CAP_READ_DVD_RAM
249
250 =item DRIVE_CAP_READ_DVD_ROM
251
252 =item DRIVE_CAP_READ_DVD_RW
253
254 =item DRIVE_CAP_READ_DVD_RPW
255
256 =item DRIVE_CAP_READ_C2_ERRS
257
258 =item DRIVE_CAP_READ_MODE2_FORM1
259
260 =item DRIVE_CAP_READ_MODE2_FORM2
261
262 =item DRIVE_CAP_READ_MCN
263
264 =item DRIVE_CAP_READ_ISRC
265
266 =back
267
268 =head2 Writing masks
269
270 =over 4
271
272 =item DRIVE_CAP_WRITE_CD_R
273
274 =item DRIVE_CAP_WRITE_CD_RW
275
276 =item DRIVE_CAP_WRITE_DVD_R
277
278 =item DRIVE_CAP_WRITE_DVD_PR
279
280 =item DRIVE_CAP_WRITE_DVD_RAM
281
282 =item DRIVE_CAP_WRITE_DVD_RW
283
284 =item DRIVE_CAP_WRITE_DVD_RPW
285
286 =item DRIVE_CAP_WRITE_MT_RAINIER
287
288 =item DRIVE_CAP_WRITE_BURN_PROOF
289
290 =back
291
292 =head3 Derived Capabilities
293
294 =over 4
295
296 =item DRIVE_CAP_WRITE_CD
297
298 Has some sort of CD writer ability
299
300 =item DRIVE_CAP_WRITE_DVD
301
302 Has some sort of DVD writer ability
303
304 =item DRIVE_CAP_WRITE
305
306 Has some sort of writer ability
307
308 =back
309
310 =head2 Filesystem type constants
311
312 These constants are used in getting drive capabilities:
313
314 =over 4
315
316 =item FS_AUDIO
317
318 audio only - not really a filesystem
319
320 =item FS_HIGH_SIERRA
321
322 High-Sierra Filesystem
323
324 =item FS_ISO_9660
325
326 ISO-9660 filesystem
327
328 =item FS_INTERACTIVE
329
330 =item FS_HFS
331
332 file system used on the Macintosh system in MacOS 6 through MacOS 9
333 and deprecated in OSX
334
335 =item FS_UFS
336
337 Generic Unix file system derived from the Berkeley fast file
338 system.
339
340 =item FS_EXT2
341
342 EXT2 was the GNU/Linux native filesystem for early kernels. Newer
343 GNU/Linux OS's may use EXT3 which EXT2 with a journal.
344
345 =item FS_ISO_HFS
346
347 both HFS & ISO-9660 filesystem
348
349 =item FS_ISO_9660_INTERACTIVE
350
351 both CD-RTOS and ISO filesystem
352
353 =item FS_3DO
354
355 The 3DO is, technically, a set of specifications created by the 3DO
356 company. These specs are for making a 3DO Interactive Multiplayer
357 which uses a CD-player. Panasonic in the early 90's was the first
358 company to manufacture and market a 3DO player.
359
360 =item FS_XISO
361
362 Microsoft X-BOX CD
363
364 =item FS_UDFX
365
366 =item FS_UDF
367
368 =item FS_ISO_UDF
369
370 =item FS_ANAL_XA
371
372 eXtended Architecture format
373
374 =item FS_ANAL_MULTISESSION
375
376 CD has multisesion
377
378 =item FS_ANAL_PHOTO_CD
379
380 Is a Kodak Photo CD
381
382 =item FS_ANAL_HIDDEN_TRACK
383
384 Hidden track at the beginning the CD
385
386 =item FS_ANAL_CDTV
387
388 =item FS_ANAL_BOOTABLE
389
390 CD is bootable
391
392 =item FS_ANAL_VIDEOCD
393
394 VCD 1.1
395
396 =item FS_ANAL_ROCKRIDGE
397
398 Has Rock Ridge Extensions to ISO 9660
399
400 =item FS_ANAL_JOLIET
401
402 Microsoft Joliet extensions to ISO 9660
403
404 =item FS_ANAL_SVCD
405
406 Super VCD or Choiji Video CD
407
408 =item FS_ANAL_CVD
409
410 Choiji Video CD
411
412 =item FS_ANAL_XISO
413
414 XBOX CD determined by some analysis
415
416 =item FS_MATCH_ALL
417
418 bitmask which can be used to specify matching any sort of CD
419
420 =back
421
422 =head2 Sector size constants
423
424 =over 4
425
426 =item CD_FRAMESIZE
427
428 =item CD_FRAMESIZE_RAW
429
430 Size of a Philip Red book CD-DA block. It is also the maximum CD sector
431 size possible: 2352 bytes.
432
433 =item ISO_BLOCKSIZE
434
435 Size of an ISO 9660 block. Also the size of the data portion in CD data
436 reads: 2048 bytes.
437
438 =item M2F2_SECTOR_SIZE
439
440 Mode 2 Form 2 Data size: 2328 bytes.
441
442 =item M2RAW_SECTOR_SIZE
443
444 Mod1 Form 1 Data size: 2336 bytes.
445
446 =back
447
448 =head2 Reading Modes
449
450 =over 4
451
452 =item READ_MODE_AUDIO
453
454 audio mode (CD-DA) read. Blocksize is a multiple of
455 $perlcdio::CD_FRAMESIZE_RAW (2352) bytes.
456
457 =item READ_MODE_M1F1
458
459 Mode 1 Form 1 read. Blocksize is a multiple of $perlcdio::CD_FRAMESIZE
460 (2048) bytes.
461
462 =item READ_MODE_M1F2
463
464 Mode 1 Form 2 read. Blocksize is a multiple of $perlcdio::M2RAW_SECTIOR_SIZE
465 (2336) bytes.
466
467 =item READ_MODE_M2F1
468
469 Mode 2 Form 1 read. Blocksize is a multiple of $perlcdio::CD_FRAMESIZE
470 (2048) bytes.
471
472 =item READ_MODE_M2F2
473
474 Mode 2 Form 1 read. Blocksize is a multiple of (2328) bytes.
475
476 =back
477
478 =head2 Miscellaneous
479
480 =over 4
481
482 =item VERSION_NUM
483
484 libcdio version that is getting used
485
486 =item INVALID_LBA
487
488 Canonical value used for an invalid LBA.
489
490 =item INVALID_LSN
491
492 Canonical value used for an invalid LSN.
493
494 =item INVALID_TRACK
495
496 Canonical value used for an invalid track number. (Valid range
497 is 0 to 99.)
498
499 =item LEADOUT_TRACK
500
501 Canonical value for the "leadout" or track just after the last track. So
502 again this value is outside the range 0 to 99.
503 The leadout track is often used to get the last LSN or LBA. The libcdio
504 routines also allow the last actual track plus one as a synonym for the
505 leadout track.
506
507 =back
508
509 =head1 METHODS
510
511 =head2 cdio_version
512
513 perlcdio::cdio_version
514
515 Returns the libcdio version string Device::Cdio is currently linked with.
516
517 =head2 this
518
519 This seems to be an artifact of SWIG.
520
521 =head1 SEE ALSO
522
523 L<http://www.gnu.org/software/libcdio> has documentation on
524 libcdio including the a manual and the API via doxygen.
525
526 =head1 AUTHORS
527
528 Rocky Bernstein C<< <rocky at cpan.org> >>.
529
530 =head1 COPYRIGHT
531
532 Copyright (C) 2006, 2008, 2011 Rocky Bernstein <[email protected]>
533
534 This program is free software: you can redistribute it and/or modify
535 it under the terms of the GNU General Public License as published by
536 the Free Software Foundation, either version 3 of the License, or
537 (at your option) any later version.
538
539 This program is distributed in the hope that it will be useful,
540 but WITHOUT ANY WARRANTY; without even the implied warranty of
541 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
542 GNU General Public License for more details.
543
544 You should have received a copy of the GNU General Public License
545 along with this program. If not, see <http://www.gnu.org/licenses/>.
546
547 =cut
548 %}