summaryrefslogtreecommitdiff
path: root/track.swg
blob: 87b7581fc467c6710318da3b744e133cb6f286aa (plain)
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
/* -*- c -*-
  $Id: track.swg,v 1.4 2008/04/28 17:34:17 karl Exp $

  Copyright (C) 2006, 2008 Rocky Bernstein <[email protected]>

  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/>.
*/

/* See <cdio/track.h> For more extensive documentation */
%constant long int TRACK_FORMAT_AUDIO      = TRACK_FORMAT_AUDIO;
%constant long int TRACK_FORMAT_CDI        = TRACK_FORMAT_CDI;
%constant long int TRACK_FORMAT_XA         = TRACK_FORMAT_XA;
%constant long int TRACK_FORMAT_DATA       = TRACK_FORMAT_DATA;
%constant long int TRACK_FORMAT_PSX        = TRACK_FORMAT_PSX;

%constant long int CDIO_TRACK_FLAG_FALSE   = CDIO_TRACK_FLAG_FALSE;
%constant long int CDIO_TRACK_FLAG_TRUE    = CDIO_TRACK_FLAG_TRUE;
%constant long int CDIO_TRACK_FLAG_ERROR   = CDIO_TRACK_FLAG_ERROR;
%constant long int CDIO_TRACK_FLAG_UNKNOWN = CDIO_TRACK_FLAG_UNKNOWN;

%constant long int CDIO_CDROM_LBA          = CDIO_CDROM_LBA;
%constant long int CDIO_CDROM_MSF          = CDIO_CDROM_MSF;
%constant long int CDIO_CDROM_DATA_TRACK   = CDIO_CDROM_DATA_TRACK;
%constant long int CDIO_CDROM_CDI_TRACK    = CDIO_CDROM_CDI_TRACK;
%constant long int CDIO_CDROM_XA_TRACK     = CDIO_CDROM_XA_TRACK;

%constant long int AUDIO          = AUDIO;
%constant long int MODE1          = MODE1;
%constant long int MODE1_RAW      = MODE1_RAW;
%constant long int MODE2          = MODE2;
%constant long int MODE2_FORM1    = MODE2_FORM1;
%constant long int MODE2_FORM2    = MODE2_FORM2;
%constant long int MODE2_FORM_MIX = MODE2_FORM_MIX;
%constant long int MODE2_RAW      = MODE2_RAW;

%constant long int INVALID_TRACK  = CDIO_INVALID_TRACK;
%constant long int CDROM_LEADOUT_TRACK = 0xAA;

typedef int track_flag_t;

%rename cdio_get_first_track_num get_first_track_num;
%feature("autodoc",
"get_first_track_num(p_cdio) -> int
Get the number of the first track. 

return the track number or $perlcdio.INVALID_TRACK if there was
a problem.");
track_t cdio_get_first_track_num(const CdIo_t *p_cdio);

%rename cdio_get_last_track_num    get_last_track_num ;
%feature("autodoc",
"get_last_track_num 
Return the last track number.
$perlcdio.INVALID_TRACK is if there was a problem.");
track_t cdio_get_last_track_num (const CdIo_t *p_cdio);

%rename cdio_get_track get_track;
%feature("autodoc",
"cdio_get_track(lsn)->int

    Find the track which contains lsn.
    $perlcdio.INVALID_TRACK is returned if the lsn outside of the CD or
    if there was some error. 
    
    If the lsn is before the pregap of the first track, 0 is returned.
    Otherwise we return the track that spans the lsn.");
track_t cdio_get_track(const CdIo_t *p_cdio, lsn_t lsn);

%rename cdio_get_track_channels get_track_channels;
%feature("autodoc",
"get_track_channels(cdio, track)->int

Return number of channels in track: 2 or 4; -2 if implemented or -1
for error.  Not meaningful if track is not an audio track.");
int cdio_get_track_channels(const CdIo_t *p_cdio, track_t i_track);

%rename cdio_get_track_copy_permit get_track_copy_permit;
%feature("autodoc",
"get_copy_permit(cdio, track)->int

Return copy protection status on a track. Is this meaningful 
not an audio track?
");
track_flag_t cdio_get_track_copy_permit(const CdIo_t *p_cdio, 
					 track_t i_track);

%feature("autodoc",
"get_track_format(cdio, track)->format

Get the format (audio, mode2, mode1) of track. ");
const char *get_track_format(const CdIo_t *p_cdio, track_t i_track);

%rename cdio_get_track_green is_track_green;
%feature("autodoc",
"is_track_green(cdio, track) -> bool

Return True if we have XA data (green, mode2 form1) or
XA data (green, mode2 form2). That is track begins:
 sync - header - subheader
12     4      -  8
    
FIXME: there's gotta be a better design for this and get_track_format?");
bool cdio_get_track_green(const CdIo_t *p_cdio, track_t i_track);

%rename cdio_get_track_last_lsn  get_track_last_lsn;
%feature("autodoc",
"cdio_get_track_last_lsn(cdio, track)->lsn

Return the ending LSN for track number
track in cdio.  CDIO_INVALID_LSN is returned on error.");
lsn_t cdio_get_track_last_lsn(const CdIo_t *p_cdio, track_t i_track);

%rename cdio_get_track_lba get_track_lba;
%feature("autodoc",
"cdio_get_track_lba  
    Get the starting LBA for track number
    i_track in p_cdio.  Track numbers usually start at something 
    greater than 0, usually 1.

    The 'leadout' track is specified either by setting i_track
    to $perl::CDIO_CDROM_LEADOUT_TRACK or one more than the 
    number of tracks.

    @param p_cdio object to get information from
    @param i_track  the track number we want the LSN for
    @return the starting LBA or CDIO_INVALID_LBA on error.");
  lba_t cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track);

%rename cdio_get_track_lsn   get_track_lsn;
%feature("autodoc",
"cdio_get_track_lsn (cdio, track)->int

Return the starting LSN for track number. 
Track numbers usually start at something greater than 0, usually 1.

The 'leadout' track is specified either by
using i_track CDROM_LEADOUT_TRACK or the total tracks+1.

$perlcdio::INVALID_LSN is returned on error.");
lsn_t cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track);

%feature("autodoc",
"get_track_msf(cdio,track)->string

  Return the starting MSF (minutes/secs/frames) for track number
  track.  Track numbers usually start at something 
  greater than 0, usually 1.

  The 'leadout' track is specified either by
  using i_track $perlcdio::CDROM_LEADOUT_TRACK or the total tracks+1.

@return string mm:ss:ff if all good, or string 'error' on error.");
const char *get_track_msf(const CdIo_t *p_cdio, track_t i_track);
%inline %{
const char *get_track_msf(const CdIo_t *p_cdio, track_t i_track)
{
	msf_t msf;
	char *psz_msf;

	if (!cdio_get_track_msf( p_cdio, i_track, &msf )) {
		return "error";
	}
	psz_msf = cdio_msf_to_str( &msf );
	return psz_msf;
}
%}
	
%rename cdio_get_track_preemphasis get_track_preemphasis;
%feature("autodoc",
"cdio_get_track_preemphasis(cdio, track)

Get linear preemphasis status on an audio track.
This is not meaningful if not an audio track?
");
track_flag_t cdio_get_track_preemphasis(const CdIo_t *p_cdio, track_t i_track);

%rename cdio_get_track_sec_count get_track_sec_count;
%feature("autodoc",
"get_track_sec_count(cdio, track)->int

Get the number of sectors between this track an the next.  This
includes any pregap sectors before the start of the next track.
Track numbers usually start at something 
greater than 0, usually 1.

0 is returned if there is an error.");
unsigned int cdio_get_track_sec_count(const CdIo_t *p_cdio, track_t i_track);

%inline %{
const char 
*get_track_format(const CdIo_t *p_cdio, track_t i_track) 
{
  track_format_t track_format = cdio_get_track_format(p_cdio, i_track);
  return track_format2str[track_format];
}
%}