File: perlcdio.swg

package info (click to toggle)
libdevice-cdio-perl 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,848 kB
  • sloc: ansic: 14,413; perl: 4,795; makefile: 20; sh: 3
file content (548 lines) | stat: -r--r--r-- 10,339 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
/* -*- c -*-
  Copyright (C) 2006, 2008, 2011, 2012 Rocky Bernstein <rocky@cpan.org>
  See end for license.
*/
%define DOCSTRING
"This is a wrapper for The CD Input and Control library (libcdio) which
encapsulates CD-ROM reading and control. Python programs wishing to be
oblivious of the OS- and device-dependent properties of a CD-ROM can
use this library."
%enddef
%module(docstring=DOCSTRING) perlcdio
%{
/* Includes the header in the wrapper code */
#include <cdio/types.h>
#include <cdio/cdio.h>
#include <cdio/audio.h>
#include <cdio/cd_types.h>
#include <cdio/iso9660.h>
%}

%include "typemaps.i"
/*%include "cstring.i"*/

/* Various libcdio constants and typedefs */
%include "types.swg"

%feature("autodoc", 1);

%include "audio.swg"
%include "read.swg"
%include "track.swg"
%include "cdtext.swg"

/* In the presence of the exception handling, the order is important.
   The below use %exception.
*/
%include "device.swg"
%include "disc.swg"

/* Encapsulation is done in two parts. The lower-level Perl interface
is called perlcdio (this file) and is generated via SWIG.

The more object-oriented module is Device::Cdio; it is a Perl class
that uses perlcdio. Although perlcdio is perfectly usable on its own,
it is expected that cdio is what most people will use. As pycdio more
closely models the C interface, it is conceivable (if unlikely) that
diehard libcdio C users who are very familiar with that interface
could prefer that.

It is probably possible to change the SWIG in such a way to combine
these pieces. However there are the problems. First, I'm not that much
of a SWIG expert. Second it looks as though the resulting SWIG code
would be more complex. Third the separation makes translation very
straight forward to understand and maintain: first get what's in C
into Python as a one-to-one translation. Then we implement some nice
abstraction off of that. The abstraction can be modified without
having to redo the underlying translation. (But the reverse is
generally not true: usually changes to the C-to-python translation,
pycdio, do result in small, but obvious and straightforward changes to
the abstraction layer cdio.)
*/

%feature("autodoc",
"Returns the libcdio version string, i.e. the library Device::Cdio
is currently using.");
%inline %{
const char * cdio_version()
{
    return CDIO_VERSION;
}
%}


%perlcode %{
import Device::Cdio::VERSION;
$VERSION = $Device::Cdio::VERSION;
use strict;
=pod

=head1 NAME

perlcdio - lower-level wrapper to libcdio, the CD Input and Control library

=head1 SYNOPSIS

This is fairly straight-forward wrapper around the C library libcdio.
Although this is perfectly usable on its own, it is expected that the
Object-Oriented interface L<Device::Cdio> is what most people will
want to use.

There are various constants that are defined here.

=head1 DESCRIPTION

Encapsulation is done in two parts. The lower-level Perl
interface is called perlcdio (this file) and is generated via SWIG.

=head1 CONSTANTS

=head2 Driver ID's

=over 4

=item DRIVER_UNKNOWN

Use when you don't know what kind of driver and you don't care if it
is an CD image driver or a real CD-ROM driver. See also DRIVER_DEVICE
which doesn't include image drivers.

=item DRIVER_AIX

Driver for IBM's AIX.

=item DRIVER_BSDI

Driver for BSDI.

=item DRIVER_FREEBSD

Driver for Free BSD

=item DRIVER_LINUX

Driver for GNU/LINUX

=item DRIVER_SOLARIS

Driver for Solaris

=item DRIVER_OSX

Driver for Apple's OS X.

=item DRIVER_WIN32

Driver for Microsoft Windows

=item DRIVER_CDRDAO

Image Driver for cdrdao

=item DRIVER_BINCUE

Image driver for CDRWin BIN/CUE

=item DRIVER_NRG

Image driver for Nero NRG

=item DRIVER_DEVICE

Use when you don't know what kind of driver but the driver must be a
real CD-ROM driver. See also DRIVER_UNKNOWN which includes image
drivers.

=back


=head2 Driver Return codes

May driver operations return a status code.

=over 4

=item DRIVER_OP_SUCCESS

Driver operation was successful

=item DRIVER_OP_ERROR

Driver operation had an error of some sort

=item DRIVER_OP_UNSUPPORTED

Operation is not supported for this driver. For example
ejecting a CD from an image driver.

=item DRIVER_OP_UNINIT

Source is not initialized for this operation.

=item DRIVER_OP_NOT_PERMITTED

Operation is not permitted

=item DRIVER_OP_BAD_PARAMETER

An invalid parameter was passed to the routine

=item DRIVER_OP_BAD_POINTER

A pointer somehow got corrupted.

=item DRIVER_OP_NO_DRIVER

No driver has been set.

=back

=head2 Device Capabilities

=head3 Miscellaneous

=over 4

=item DRIVE_CAP_ERROR

=item DRIVE_CAP_UNKNOWN

=item DRIVE_CAP_MISC_CLOSE_TRAY

=item DRIVE_CAP_MISC_EJECT

=item DRIVE_CAP_MISC_LOCK

=item DRIVE_CAP_MISC_SELECT_SPEED

=item DRIVE_CAP_MISC_SELECT_DISC

=item DRIVE_CAP_MISC_MULTI_SESSION

=item DRIVE_CAP_MISC_MEDIA_CHANGED

=item DRIVE_CAP_MISC_RESET

=item DRIVE_CAP_MISC_FILE

=back

=head3 Read Capabilities

=over 4

=item DRIVE_CAP_READ_AUDIO

=item DRIVE_CAP_READ_CD_DA

=item DRIVE_CAP_READ_CD_G

=item DRIVE_CAP_READ_CD_R

=item DRIVE_CAP_READ_CD_RW

=item DRIVE_CAP_READ_DVD_R

=item DRIVE_CAP_READ_DVD_PR

=item DRIVE_CAP_READ_DVD_RAM

=item DRIVE_CAP_READ_DVD_ROM

=item DRIVE_CAP_READ_DVD_RW

=item DRIVE_CAP_READ_DVD_RPW

=item DRIVE_CAP_READ_C2_ERRS

=item DRIVE_CAP_READ_MODE2_FORM1

=item DRIVE_CAP_READ_MODE2_FORM2

=item DRIVE_CAP_READ_MCN

=item DRIVE_CAP_READ_ISRC

=back

=head2 Writing masks

=over 4

=item DRIVE_CAP_WRITE_CD_R

=item DRIVE_CAP_WRITE_CD_RW

=item DRIVE_CAP_WRITE_DVD_R

=item DRIVE_CAP_WRITE_DVD_PR

=item DRIVE_CAP_WRITE_DVD_RAM

=item DRIVE_CAP_WRITE_DVD_RW

=item DRIVE_CAP_WRITE_DVD_RPW

=item DRIVE_CAP_WRITE_MT_RAINIER

=item DRIVE_CAP_WRITE_BURN_PROOF

=back

=head3 Derived Capabilities

=over 4

=item DRIVE_CAP_WRITE_CD

Has some sort of CD writer ability

=item DRIVE_CAP_WRITE_DVD

Has some sort of DVD writer ability

=item DRIVE_CAP_WRITE

Has some sort of writer ability

=back

=head2 Filesystem type constants

These constants are used in getting drive capabilities:

=over 4

=item FS_AUDIO

audio only - not really a filesystem

=item FS_HIGH_SIERRA

High-Sierra Filesystem

=item FS_ISO_9660

ISO-9660 filesystem

=item FS_INTERACTIVE

=item FS_HFS

file system used on the Macintosh system in MacOS 6 through MacOS 9
and deprecated in OSX

=item FS_UFS

Generic Unix file system derived from the Berkeley fast file
system.

=item FS_EXT2

EXT2 was the GNU/Linux native filesystem for early kernels. Newer
GNU/Linux OS's may use EXT3 which EXT2 with a journal.

=item FS_ISO_HFS

both HFS & ISO-9660 filesystem

=item FS_ISO_9660_INTERACTIVE

both CD-RTOS and ISO filesystem

=item FS_3DO

The 3DO is, technically, a set of specifications created by the 3DO
company.  These specs are for making a 3DO Interactive Multiplayer
which uses a CD-player. Panasonic in the early 90's was the first
company to manufacture and market a 3DO player.

=item FS_XISO

Microsoft X-BOX CD

=item FS_UDFX

=item FS_UDF

=item FS_ISO_UDF

=item FS_ANAL_XA

eXtended Architecture format

=item FS_ANAL_MULTISESSION

CD has multisesion

=item FS_ANAL_PHOTO_CD

Is a Kodak Photo CD

=item FS_ANAL_HIDDEN_TRACK

Hidden track at the beginning the CD

=item FS_ANAL_CDTV

=item FS_ANAL_BOOTABLE

CD is bootable

=item FS_ANAL_VIDEOCD

VCD 1.1

=item FS_ANAL_ROCKRIDGE

Has Rock Ridge Extensions to ISO 9660

=item FS_ANAL_JOLIET

Microsoft Joliet extensions to ISO 9660

=item FS_ANAL_SVCD

Super VCD or Choiji Video CD

=item FS_ANAL_CVD

Choiji Video CD

=item FS_ANAL_XISO

XBOX CD determined by some analysis

=item FS_MATCH_ALL

bitmask which can  be used to specify matching any sort of CD

=back

=head2 Sector size constants

=over 4

=item CD_FRAMESIZE

=item CD_FRAMESIZE_RAW

Size of a Philip Red book CD-DA block. It is also the maximum CD sector
size possible: 2352 bytes.

=item ISO_BLOCKSIZE

Size of an ISO 9660 block. Also the size of the data portion in CD data
reads: 2048 bytes.

=item M2F2_SECTOR_SIZE

Mode 2 Form 2 Data size: 2328 bytes.

=item M2RAW_SECTOR_SIZE

Mod1 Form 1 Data size: 2336 bytes.

=back

=head2 Reading Modes

=over 4

=item READ_MODE_AUDIO

audio mode (CD-DA) read. Blocksize is a multiple of
$perlcdio::CD_FRAMESIZE_RAW (2352) bytes.

=item READ_MODE_M1F1

Mode 1 Form 1 read. Blocksize is a multiple of $perlcdio::CD_FRAMESIZE
(2048) bytes.

=item READ_MODE_M1F2

Mode 1 Form 2 read. Blocksize is a multiple of $perlcdio::M2RAW_SECTIOR_SIZE
(2336) bytes.

=item READ_MODE_M2F1

Mode 2 Form 1 read. Blocksize is a multiple of $perlcdio::CD_FRAMESIZE
(2048) bytes.

=item READ_MODE_M2F2

Mode 2 Form 1 read. Blocksize is a multiple of (2328) bytes.

=back

=head2 Miscellaneous

=over 4

=item VERSION_NUM

libcdio version that is getting used

=item INVALID_LBA

Canonical value used for an invalid LBA.

=item INVALID_LSN

Canonical value used for an invalid LSN.

=item INVALID_TRACK

Canonical value used for an invalid track number. (Valid range
is 0 to 99.)

=item LEADOUT_TRACK

Canonical value for the "leadout" or track just after the last track. So
again this value is outside the range 0 to 99.
The leadout track is often used to get the last LSN or LBA. The libcdio
routines also allow the last actual track plus one as a synonym for the
leadout track.

=back

=head1 METHODS

=head2 cdio_version

    perlcdio::cdio_version

Returns the libcdio version string Device::Cdio is currently linked with.

=head2 this

This seems to be an artifact of SWIG.

=head1 SEE ALSO

L<http://www.gnu.org/software/libcdio> has documentation on
libcdio including the a manual and the API via doxygen.

=head1 AUTHORS

Rocky Bernstein C<< <rocky at cpan.org> >>.

=head1 COPYRIGHT

Copyright (C) 2006, 2008, 2011 Rocky Bernstein <rocky@cpan.org>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

=cut
%}