File: DiscID.xs

package info (click to toggle)
libmusicbrainz-discid-perl 0.06-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 132 kB
  • sloc: perl: 174; makefile: 3
file content (133 lines) | stat: -rw-r--r-- 2,189 bytes parent folder | download
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
/*

  libdiscid perl bindings

  Copyright 2009 Nicholas J. Humfrey <njh@aelius.com>

*/

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include <discid/discid.h>




MODULE = MusicBrainz::DiscID  PACKAGE = MusicBrainz::DiscID

##
## Return the name of the default disc drive for this operating system.
##
char*
discid_get_default_device()

##
## Return a handle for a new DiscId object.
##
DiscId*
discid_new()

##
## Release the memory allocated for the DiscId object.
##
void
discid_free( disc )
  DiscId *disc

##
## Read the disc in the given CD-ROM/DVD-ROM drive.
##
int
discid_read( disc, device )
  DiscId *disc
  char* device

##
## Return a human-readable error message.
##
char*
discid_get_error_msg( disc )
  DiscId *disc

##
## Return a MusicBrainz DiscID.
##
char*
discid_get_id( disc )
  DiscId *disc

##
## Return a FreeDB DiscID.
##
char*
discid_get_freedb_id( disc )
  DiscId *disc

##
## Return an URL for submitting the DiscID to MusicBrainz.
##
char*
discid_get_submission_url( disc )
  DiscId *disc

##
## Return the number of the first track on this disc.
##
int
discid_get_first_track_num( disc )
  DiscId *disc

##
## Return the number of the last track on this disc.
##
int
discid_get_last_track_num( disc )
  DiscId *disc

##
## Return the length of the disc in sectors.
##
int
discid_get_sectors( disc )
  DiscId *disc

##
## Return the sector offset of a track.
##
int
discid_get_track_offset( disc, track_num )
  DiscId *disc
  int track_num

##
## Return the length of a track in sectors.
##
int
discid_get_track_length( disc, track_num )
  DiscId *disc
  int track_num

##
## Provides the TOC of a known CD.
##
int
discid_put( disc, first_track, sectors, offsets ... )
  DiscId *disc
  int first_track
  int sectors
  int n_items = items;
  PREINIT:
	  int i, last_track, offsets[100];
  CODE:
    memset(offsets, 0, sizeof(offsets));
    if (items > 102 ) n_items = 102;  // rely on discid_put to return error
    for (i=3; i<n_items; i++) {
        offsets[i-2] = (int)SvIV(ST(i));
    }
    offsets[0] = sectors;
    last_track = items - 2 - first_track;
    RETVAL = discid_put( disc, first_track, last_track, offsets );
  OUTPUT:
    RETVAL