libcdio-paranoia 10.2+2.0.2
cdda.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2004, 2005, 2006, 2008, 2011, 2012
3 Rocky Bernstein <rocky@gnu.org>
4 Copyright (C) 2014 Robert Kausch <robert.kausch@freac.org>
5 Copyright (C) 2001 Xiph.org and Heiko Eissfeldt heiko@escape.colossus.de
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
28#ifndef CDIO__PARANOIA__CDDA_H_
29#define CDIO__PARANOIA__CDDA_H_
30
31#include <cdio/cdio.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
42
54 typedef enum {
58 CD_FRAMESAMPLES = CDIO_CD_FRAMESIZE_RAW / 4,
59 MAXTRK = (CDIO_CD_MAX_TRACKS+1)
61
62
63#include <signal.h>
64
68#define MAXTRK (CDIO_CD_MAX_TRACKS+1)
69
71typedef struct TOC_s {
72 unsigned char bTrack;
75
77#define TOC TOC_t
78
81
82 CdIo_t *p_cdio;
83 int opened;
86
106 track_t tracks;
114
117 char *errorbuf;
119
120 /* functions specific to particular drives/interfaces */
121
122 int (*enable_cdda) (cdrom_drive_t *d, int onoff);
124 long (*read_audio) (cdrom_drive_t *d, void *p, lsn_t begin,
125 long sectors);
126 int (*set_speed) (cdrom_drive_t *d, int speed);
129
132
134
140};
141
142
151 typedef enum {
160
170#define CDDA_TEST_ALWAYS_JITTER 4
171
173#define CDDA_TEST_FRAG_SMALL (1<<3)
174#define CDDA_TEST_FRAG_LARGE (2<<3)
175#define CDDA_TEST_FRAG_MASSIVE (3<<3)
176
178#define CDDA_TEST_UNDERRUN 64
179
180#if TESTING_IS_FINISHED
181
183#define CDDA_TEST_SCRATCH 128
184#undef CDDA_TEST_BOGUS_BYTES 256
185#undef CDDA_TEST_DROPDUPE_BYTES 512
186#endif /* TESTING_IS_FINISHED */
187
197extern cdrom_drive_t *cdio_cddap_find_a_cdrom(int messagedest,
198 char **ppsz_message);
199
207extern cdrom_drive_t *cdio_cddap_identify(const char *psz_device,
208 int messagedest,
209 char **ppsz_message);
210
221 int messagedest, char **ppsz_messages);
222
225extern const char *cdio_cddap_version(void);
226
230extern char *cdio_cddap_messages(cdrom_drive_t *d);
231
235extern char *cdio_cddap_errors(cdrom_drive_t *d);
236
239extern void cdio_cddap_free_messages(char *psz_messages);
240
243extern int cdio_cddap_speed_set(cdrom_drive_t *d, int speed);
244extern void cdio_cddap_verbose_set(cdrom_drive_t *d, int err_action,
245 int mes_action);
246
258
269extern int cdio_cddap_close(cdrom_drive_t *d);
270
271extern int cdio_cddap_open(cdrom_drive_t *d);
272
273extern long cdio_cddap_read(cdrom_drive_t *d, void *p_buffer,
274 lsn_t beginsector, long sectors);
275
276extern long cdio_cddap_read_timed(cdrom_drive_t *d, void *p_buffer,
277 lsn_t beginsector, long sectors, int *milliseconds);
278
281 track_t i_track);
282
285extern lsn_t cdio_cddap_track_lastsector(cdrom_drive_t *d, track_t i_track);
286
289
295extern int cdio_cddap_sector_gettrack(cdrom_drive_t *d, lsn_t lsn);
296
301extern int cdio_cddap_track_channels(cdrom_drive_t *d, track_t i_track);
302
304extern int cdio_cddap_track_audiop(cdrom_drive_t *d, track_t i_track);
305
307extern int cdio_cddap_track_copyp(cdrom_drive_t *d, track_t i_track);
308
312extern int cdio_cddap_track_preemp(cdrom_drive_t *d, track_t i_track);
313
316
321
336extern int data_bigendianp(cdrom_drive_t *d);
337
340typedef enum {
341 TR_OK = 0,
354
355
356#ifdef NEED_STRERROR_TR
357const char *strerror_tr[]={
358 "Success",
359 "Error writing packet command to device",
360 "Error reading command from device",
361 "SCSI packet data underrun (too little data)",
362 "SCSI packet data overrun (too much data)",
363 "Illegal SCSI request (rejected by target)",
364 "Medium reading data from medium",
365 "Device busy",
366 "Device not ready",
367 "Target hardware fault",
368 "Unspecified error",
369 "Drive lost streaming"
370};
371#endif /*NEED_STERROR_TR*/
372
404#ifndef DO_NOT_WANT_PARANOIA_COMPATIBILITY
406#define cdda_find_a_cdrom cdio_cddap_find_a_cdrom
407#define cdda_identify cdio_cddap_identify
408#define cdda_version cdio_cddap_version
409#define cdda_speed_set cdio_cddap_speed_set
410#define cdda_verbose_set cdio_cddap_verbose_set
411#define cdda_messages cdio_cddap_messages
412#define cdda_errors cdio_cddap_errors
413#define cdda_close cdio_cddap_close
414#define cdda_open cdio_cddap_open
415#define cdda_read cdio_cddap_read
416#define cdda_read_timed cdio_cddap_read_timed
417#define cdda_track_firstsector cdio_cddap_track_firstsector
418#define cdda_track_lastsector cdio_cddap_track_lastsector
419#define cdda_tracks cdio_cddap_tracks
420#define cdda_sector_gettrack cdio_cddap_sector_gettrack
421#define cdda_track_channels cdio_cddap_track_channels
422#define cdda_track_audiop cdio_cddap_track_audiop
423#define cdda_track_copyp cdio_cddap_track_copyp
424#define cdda_track_preemp cdio_cddap_track_preemp
425#define cdda_disc_firstsector cdio_cddap_disc_firstsector
426#define cdda_disc_lastsector cdio_cddap_disc_lastsector
427#define cdrom_drive cdrom_drive_t
428
429#endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/
430
431#ifdef __cplusplus
432}
433#endif /* __cplusplus */
434
443
444#ifdef __cplusplus
445extern "C" {
446#endif
447 extern const char *cdio_cddap_version(void);
448 extern void cdio_cddap_free_messages(char *psz_messages);
449
450#ifdef __cplusplus
451}
452#endif
453
454#endif /*CDIO__PARANOIA__CDDA_H_*/
lsn_t cdio_cddap_disc_firstsector(cdrom_drive_t *d)
cdrom_drive_t * cdio_cddap_identify_cdio(CdIo_t *p_cdio, int messagedest, char **ppsz_messages)
Definition: scan_devices.c:194
int cdio_cddap_speed_set(cdrom_drive_t *d, int speed)
Definition: interface.c:135
#define CDDA_TEST_FRAG_SMALL
Definition: cdda.h:173
int cdio_cddap_track_audiop(cdrom_drive_t *d, track_t i_track)
Definition: toc.c:194
int cdio_cddap_sector_gettrack(cdrom_drive_t *d, lsn_t lsn)
Definition: toc.c:169
paranoia_cdda_enums_t
Definition: cdda.h:54
@ CDDA_MESSAGE_PRINTIT
Definition: cdda.h:56
@ CDDA_MESSAGE_FORGETIT
Definition: cdda.h:55
@ CDDA_MESSAGE_LOGIT
Definition: cdda.h:57
@ CD_FRAMESAMPLES
Definition: cdda.h:58
bool cdio_cddap_close_no_free_cdio(cdrom_drive_t *d)
Definition: interface.c:59
int cdio_cddap_track_channels(cdrom_drive_t *d, track_t i_track)
Definition: toc.c:187
paranoia_jitter_t debug_paranoia_jitter
Definition: cddap_interface.c:28
lsn_t cdio_cddap_disc_lastsector(cdrom_drive_t *d)
#define CDDA_TEST_FRAG_MASSIVE
Definition: cdda.h:175
int cdio_cddap_track_preemp(cdrom_drive_t *d, track_t i_track)
Definition: toc.c:212
void cdio_cddap_verbose_set(cdrom_drive_t *d, int err_action, int mes_action)
Definition: interface.c:181
char * cdio_cddap_messages(cdrom_drive_t *d)
Definition: interface.c:188
const char * cdio_cddap_version(void)
Definition: interface.c:34
transport_error_t
Definition: cdda.h:340
@ TR_BUSY
Definition: cdda.h:348
@ TR_FAULT
Definition: cdda.h:350
@ TR_ILLEGAL
Definition: cdda.h:346
@ TR_OVERRUN
Definition: cdda.h:345
@ TR_EREAD
Definition: cdda.h:343
@ TR_EWRITE
Definition: cdda.h:342
@ TR_MEDIUM
Definition: cdda.h:347
@ TR_OK
Definition: cdda.h:341
@ TR_UNKNOWN
Definition: cdda.h:351
@ TR_UNDERRUN
Definition: cdda.h:344
@ TR_STREAMING
Definition: cdda.h:352
@ TR_NOTREADY
Definition: cdda.h:349
#define MAXTRK
Definition: cdda.h:68
paranoia_cdda_enums_t debug_paranoia_cdda_enums
Definition: cddap_interface.c:29
char * cdio_cddap_errors(cdrom_drive_t *d)
Definition: interface.c:196
void cdio_cddap_free_messages(char *psz_messages)
Definition: interface.c:204
lsn_t cdio_cddap_track_firstsector(cdrom_drive_t *d, track_t i_track)
struct TOC_s TOC_t
Structure for cdparanoia's CD Table of Contents.
track_t cdio_cddap_tracks(cdrom_drive_t *d)
int cdio_cddap_open(cdrom_drive_t *d)
Definition: interface.c:99
#define CDDA_TEST_UNDERRUN
Definition: cdda.h:178
int cdio_cddap_track_copyp(cdrom_drive_t *d, track_t i_track)
Definition: toc.c:202
long cdio_cddap_read(cdrom_drive_t *d, void *p_buffer, lsn_t beginsector, long sectors)
Definition: interface.c:176
#define CDDA_TEST_FRAG_LARGE
Definition: cdda.h:174
lsn_t cdio_cddap_track_lastsector(cdrom_drive_t *d, track_t i_track)
int data_bigendianp(cdrom_drive_t *d)
Definition: common_interface.c:53
cdrom_drive_t * cdio_cddap_find_a_cdrom(int messagedest, char **ppsz_message)
Definition: scan_devices.c:73
paranoia_jitter_t
Definition: cdda.h:151
@ CDDA_TEST_JITTER_SMALL
Definition: cdda.h:152
@ CDDA_TEST_JITTER_MASSIVE
Definition: cdda.h:154
@ CDDA_TEST_JITTER_LARGE
Definition: cdda.h:153
long cdio_cddap_read_timed(cdrom_drive_t *d, void *p_buffer, lsn_t beginsector, long sectors, int *milliseconds)
Definition: interface.c:145
cdrom_drive_t * cdio_cddap_identify(const char *psz_device, int messagedest, char **ppsz_message)
Definition: scan_devices.c:150
int cdio_cddap_close(cdrom_drive_t *d)
Definition: interface.c:86
Structure for cdparanoia's CD Table of Contents.
Definition: cdda.h:71
int32_t dwStartSector
Definition: cdda.h:73
unsigned char bTrack
Definition: cdda.h:72
Structure for cdparanoia's CD-ROM access.
Definition: cdda.h:80
char * messagebuf
Definition: cdda.h:118
char * drive_model
Definition: cdda.h:87
bool b_swap_bytes
Definition: cdda.h:103
char * cdda_device_name
Definition: cdda.h:85
int bigendianp
Definition: cdda.h:89
int errordest
Definition: cdda.h:115
int(* read_toc)(cdrom_drive_t *d)
Definition: cdda.h:123
char * errorbuf
Definition: cdda.h:117
int is_atapi
Definition: cdda.h:130
int messagedest
Definition: cdda.h:116
long(* read_audio)(cdrom_drive_t *d, void *p, lsn_t begin, long sectors)
Definition: cdda.h:124
CdIo_t * p_cdio
Definition: cdda.h:82
lsn_t audio_first_sector
Definition: cdda.h:112
int(* enable_cdda)(cdrom_drive_t *d, int onoff)
Definition: cdda.h:122
int drive_type
Definition: cdda.h:88
int is_mmc
Definition: cdda.h:131
int opened
Definition: cdda.h:83
int last_milliseconds
Definition: cdda.h:133
lsn_t audio_last_sector
Definition: cdda.h:113
int(* set_speed)(cdrom_drive_t *d, int speed)
Definition: cdda.h:126
int error_retry
Definition: cdda.h:127
track_t tracks
Definition: cdda.h:106
TOC_t disc_toc[MAXTRK]
Definition: cdda.h:107
int cd_extra
Definition: cdda.h:97
int nsectors
Definition: cdda.h:93
int i_test_flags
Definition: cdda.h:135
int report_all
Definition: cdda.h:128
Definition: p_block.h:153