1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12 
13 /* @(#)cdda_paranoia.h	1.20 04/02/20 J. Schilling from cdparanoia-III-alpha9.8 */
14 /*
15  *	Modifications to make the code portable Copyright (c) 2002 J. Schilling
16  */
17 /*
18  * CopyPolicy: GNU Public License 2 applies
19  * Copyright (C) by Monty (xiphmont@mit.edu)
20  *
21  */
22 
23 #ifndef	_CDROM_PARANOIA_H
24 #define	_CDROM_PARANOIA_H
25 
26 #ifndef _MCONFIG_H
27 #include <mconfig.h>
28 #endif
29 #ifndef _UTYPES_H
30 #include <utypes.h>
31 #endif
32 
33 #ifndef	__GNUC__
34 #define	inline
35 #endif
36 
37 #define	CD_FRAMESIZE_RAW		2352
38 #define	CD_FRAMEWORDS			(CD_FRAMESIZE_RAW/2)
39 
40 /*
41  * Second parameter of the callback function
42  */
43 #define	PARANOIA_CB_READ		 0	/* Read off adjust ??? */
44 #define	PARANOIA_CB_VERIFY		 1	/* Verifying jitter */
45 #define	PARANOIA_CB_FIXUP_EDGE		 2	/* Fixed edge jitter */
46 #define	PARANOIA_CB_FIXUP_ATOM		 3	/* Fixed atom jitter */
47 #define	PARANOIA_CB_SCRATCH		 4	/* Unsupported */
48 #define	PARANOIA_CB_REPAIR		 5	/* Unsupported */
49 #define	PARANOIA_CB_SKIP		 6	/* Skip exhausted retry */
50 #define	PARANOIA_CB_DRIFT		 7	/* Drift detected */
51 #define	PARANOIA_CB_BACKOFF		 8	/* Unsupported */
52 #define	PARANOIA_CB_OVERLAP		 9	/* Dyn Overlap adjust */
53 #define	PARANOIA_CB_FIXUP_DROPPED	10	/* Fixed dropped bytes */
54 #define	PARANOIA_CB_FIXUP_DUPED		11	/* Fixed duplicate bytes */
55 #define	PARANOIA_CB_READERR		12	/* Hard read error */
56 
57 /*
58  * Cdparanoia modes to be set with paranoia_modeset()
59  */
60 #define	PARANOIA_MODE_FULL		 0xFF
61 #define	PARANOIA_MODE_DISABLE		 0
62 
63 #define	PARANOIA_MODE_VERIFY		 1	/* Verify data integrity in overlap area */
64 #define	PARANOIA_MODE_FRAGMENT		 2	/* unsupported */
65 #define	PARANOIA_MODE_OVERLAP		 4	/* Perform overlapped reads */
66 #define	PARANOIA_MODE_SCRATCH		 8	/* unsupported */
67 #define	PARANOIA_MODE_REPAIR		16	/* unsupported */
68 #define	PARANOIA_MODE_NEVERSKIP		32	/* Do not skip failed reads (retry maxretries) */
69 
70 
71 #ifndef	CDP_COMPILE
72 typedef	void    cdrom_paranoia;
73 #endif
74 
75 /*
76  * The interface from libcdparanoia to the high level caller
77  */
78 extern cdrom_paranoia	*paranoia_init(void * d, int nsectors);
79 extern void	paranoia_dynoverlapset(cdrom_paranoia * p, int minoverlap,
80 											  int maxoverlap);
81 extern void	paranoia_modeset(cdrom_paranoia * p, int mode);
82 extern long	paranoia_seek(cdrom_paranoia * p, long seek, int mode);
83 extern Int16_t	*paranoia_read(cdrom_paranoia * p, void (*callback) (long, int));
84 extern Int16_t	*paranoia_read_limited(cdrom_paranoia * p,
85 												  void (*callback) (long, int),
86 												  int maxretries);
87 extern void	paranoia_free(cdrom_paranoia * p);
88 extern void	paranoia_overlapset(cdrom_paranoia * p, long overlap);
89 
90 #ifndef	HAVE_MEMMOVE
91 #define	memmove(dst, src, size)		movebytes((src), (dst), (size))
92 #endif
93 
94 
95 /*
96  * The callback interface from libparanoia to the CD-ROM interface
97  */
98 extern long	cdda_disc_firstsector(void *d);		/* -> long sector */
99 extern long	cdda_disc_lastsector(void *d);		/* -> long sector */
100 /* -> long sectors */
101 extern long	cdda_read(void *d, void *buffer, long beginsector, long sectors);
102 extern int	cdda_sector_gettrack(void *d, long sector);	/* -> int trackno */
103 extern int	cdda_track_audiop(void *d, int track);	/* -> int Is audiotrack */
104 extern long	cdda_track_firstsector(void *d, int track);	/* -> long sector */
105 extern long	cdda_track_lastsector(void *d, int track);	/* -> long sector */
106 extern int	cdda_tracks(void *d);		/* -> int tracks */
107 
108 #endif	/* _CDROM_PARANOIA_H */
109