libcdio-paranoia  10.2+0.94+2git
Macros | Enumerations | Functions | Variables
paranoia.h File Reference

The top-level header for libcdda_paranoia: a device- and OS- independent library for reading CD-DA with error tolerance and repair. Applications include this for paranoia access. More...

#include <cdio/paranoia/cdda.h>

Go to the source code of this file.

Macros

#define CD_FRAMEWORDS   (CDIO_CD_FRAMESIZE_RAW/2)
 
#define cdrom_paranoia   cdrom_paranoia_t
 
#define paranoia_version   cdio_paranoia_version
 
#define paranoia_init   cdio_paranoia_init
 
#define paranoia_free   cdio_paranoia_free
 
#define paranoia_modeset   cdio_paranoia_modeset
 
#define paranoia_seek   cdio_paranoia_seek
 
#define paranoia_read   cdio_paranoia_read
 
#define paranoia_read_limited   cdio_paranoia_read_limited
 
#define paranoia_overlapset   cdio_paranoia_overlapset
 
#define paranoia_set_range   cdio_paranoia_set_range
 
#define paranoia_cachemodel_size   cdio_paranoia_cachemodel_size
 

Enumerations

enum  paranoia_mode_t {
  PARANOIA_MODE_DISABLE = 0x00, PARANOIA_MODE_VERIFY = 0x01, PARANOIA_MODE_FRAGMENT = 0x02, PARANOIA_MODE_OVERLAP = 0x04,
  PARANOIA_MODE_SCRATCH = 0x08, PARANOIA_MODE_REPAIR = 0x10, PARANOIA_MODE_NEVERSKIP = 0x20, PARANOIA_MODE_FULL = 0xff
}
 
enum  paranoia_cb_mode_t {
  PARANOIA_CB_READ, PARANOIA_CB_VERIFY, PARANOIA_CB_FIXUP_EDGE, PARANOIA_CB_FIXUP_ATOM,
  PARANOIA_CB_SCRATCH, PARANOIA_CB_REPAIR, PARANOIA_CB_SKIP, PARANOIA_CB_DRIFT,
  PARANOIA_CB_BACKOFF, PARANOIA_CB_OVERLAP, PARANOIA_CB_FIXUP_DROPPED, PARANOIA_CB_FIXUP_DUPED,
  PARANOIA_CB_READERR, PARANOIA_CB_CACHEERR, PARANOIA_CB_WROTE, PARANOIA_CB_FINISHED
}
 

Functions

const char * cdio_paranoia_version (void)
 
cdrom_paranoia_tcdio_paranoia_init (cdrom_drive_t *d)
 
void cdio_paranoia_free (cdrom_paranoia_t *p)
 
void cdio_paranoia_modeset (cdrom_paranoia_t *p, int mode_flags)
 
lsn_t cdio_paranoia_seek (cdrom_paranoia_t *p, int32_t seek, int whence)
 
int16_t * cdio_paranoia_read (cdrom_paranoia_t *p, void(*callback)(long int, paranoia_cb_mode_t))
 
int16_t * cdio_paranoia_read_limited (cdrom_paranoia_t *p, void(*callback)(long int, paranoia_cb_mode_t), int max_retries)
 
void cdio_paranoia_overlapset (cdrom_paranoia_t *p, long overlap)
 
void cdio_paranoia_set_range (cdrom_paranoia_t *p, long int start, long int end)
 
int cdio_paranoia_cachemodel_size (cdrom_paranoia_t *p, int sectors)
 

Variables

const char * paranoia_cb_mode2str []
 
paranoia_mode_t debug_paranoia_mode
 
paranoia_cb_mode_t debug_paranoia_cb_mode
 

Detailed Description

The top-level header for libcdda_paranoia: a device- and OS- independent library for reading CD-DA with error tolerance and repair. Applications include this for paranoia access.

Macro Definition Documentation

#define CD_FRAMEWORDS   (CDIO_CD_FRAMESIZE_RAW/2)

Paranoia likes to work with 16-bit numbers rather than (possibly byte-swapped) bytes. So there are this many 16-bit numbers block (frame, or sector) read.

Referenced by cdio_paranoia_overlapset(), cdio_paranoia_read_limited(), i_paranoia_trim(), main(), offset_adjust_settings(), paranoia_init(), and paranoia_seek().

#define cdrom_paranoia   cdrom_paranoia_t

For compatibility with good ol' paranoia

Referenced by analyze_cache().

#define paranoia_cachemodel_size   cdio_paranoia_cachemodel_size
#define paranoia_free   cdio_paranoia_free
#define paranoia_init   cdio_paranoia_init
#define paranoia_modeset   cdio_paranoia_modeset
#define paranoia_overlapset   cdio_paranoia_overlapset

Referenced by main().

#define paranoia_read   cdio_paranoia_read
#define paranoia_read_limited   cdio_paranoia_read_limited

Referenced by cdio_paranoia_read(), and main().

#define paranoia_seek   cdio_paranoia_seek
#define paranoia_set_range   cdio_paranoia_set_range
#define paranoia_version   cdio_paranoia_version

Referenced by analyze_cache(), and main().

Enumeration Type Documentation

Flags set in a callback.

The enumeration type one probably wouldn't really use in a program. It is here instead of defines to give symbolic names that can be helpful in debuggers where wants just to say refer to PARANOIA_CB_READ and get the correct value.

Enumerator
PARANOIA_CB_READ 

Read off adjust ???

PARANOIA_CB_VERIFY 

Verifying jitter

PARANOIA_CB_FIXUP_EDGE 

Fixed edge jitter

PARANOIA_CB_FIXUP_ATOM 

Fixed atom jitter

PARANOIA_CB_SCRATCH 

Unsupported

PARANOIA_CB_REPAIR 

Unsupported

PARANOIA_CB_SKIP 

Skip exhausted retry

PARANOIA_CB_DRIFT 

Skip exhausted retry

PARANOIA_CB_BACKOFF 

Unsupported

PARANOIA_CB_OVERLAP 

Dynamic overlap adjust

PARANOIA_CB_FIXUP_DROPPED 

Fixed dropped bytes

PARANOIA_CB_FIXUP_DUPED 

Fixed duplicate bytes

PARANOIA_CB_READERR 

Hard read error

PARANOIA_CB_CACHEERR 

Bad cache management

PARANOIA_CB_WROTE 

Wrote block "*"

PARANOIA_CB_FINISHED 

Finished writing "*"

Flags used in paranoia_modeset.

The enumeration type one probably wouldn't really use in a program. It is here instead of defines to give symbolic names that can be helpful in debuggers where wants just to say refer to PARANOIA_MODE_DISABLE and get the correct value.

Enumerator
PARANOIA_MODE_DISABLE 

No fixups

PARANOIA_MODE_VERIFY 

Verify data integrety in overlap area

PARANOIA_MODE_FRAGMENT 

unsupported

PARANOIA_MODE_OVERLAP 

Perform overlapped reads

PARANOIA_MODE_SCRATCH 

unsupported

PARANOIA_MODE_REPAIR 

unsupported

PARANOIA_MODE_NEVERSKIP 

Do not skip failed reads (retry maxretries)

PARANOIA_MODE_FULL 

Maximum paranoia - all of the above (except disable)

Function Documentation

int cdio_paranoia_cachemodel_size ( cdrom_paranoia_t p,
int  sectors 
)

Set or query the number of sectors used for paranoia cache modelling.

Parameters
pparanoia object
sectorsnumber of sectors to use, default is 1200 (pass -1 to query current model size without setting a new value)
Returns
number of cache sectors before the call
void cdio_paranoia_free ( cdrom_paranoia_t p)

Free any resources associated with p.

Parameters
pparanoia object to for which resources are to be freed.
See also
paranoia_init.
cdrom_paranoia_t* cdio_paranoia_init ( cdrom_drive_t d)

Get and initialize a new cdrom_paranoia object from cdrom_drive. Run this before calling any of the other paranoia routines below.

Returns
new cdrom_paranoia object Call paranoia_free() when you are done with it
void cdio_paranoia_modeset ( cdrom_paranoia_t p,
int  mode_flags 
)

Set the kind of repair you want to on for reading. The modes are listed above

Parameters
pparanoia type
mode_flagsparanoia mode flags built from values in paranoia_mode_t, e.g. PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP
void cdio_paranoia_overlapset ( cdrom_paranoia_t p,
long  overlap 
)

a temporary hack

int16_t* cdio_paranoia_read ( cdrom_paranoia_t p,
void(*)(long int, paranoia_cb_mode_t callback 
)

Reads the next sector of audio data and returns a pointer to a full sector of verified samples.

Parameters
pparanoia object.
callbackcallback routine which gets called with the status on each read.
Returns
the audio data read, CDIO_CD_FRAMESIZE_RAW (2352) bytes. This data is not to be freed by the caller. It will persist only until the next call to paranoia_read() for this p.
int16_t* cdio_paranoia_read_limited ( cdrom_paranoia_t p,
void(*)(long int, paranoia_cb_mode_t callback,
int  max_retries 
)

The same as cdio_paranoia_read but the number of retries is set.

Parameters
pparanoia object.
callbackcallback routine which gets called with the status on each read.
max_retriesnumber of times to try re-reading a block before failing.
Returns
the block of CDIO_FRAMEIZE_RAW bytes (or CDIO_FRAMESIZE_RAW / 2 16-bit integers). Unless byte-swapping has been turned off the 16-bit integers Endian independent order.
See also
cdio_paranoia_read.

References cb, CD_FRAMEWORDS, ce, cs, cdrom_paranoia_s::cursor, cdrom_paranoia_s::d, cdrom_paranoia_s::dynoverlap, cdrom_paranoia_s::enable, sync_result::end, ENOMEDIUM, FLAGS_EDGE, free_elem(), i_cblock_destructor(), i_paranoia_trim(), root_block::lastsector, MAX_SECTOR_OVERLAP, new_v_fragment(), NULL, offsets::offpoints, cdrom_drive_s::opened, PARANOIA_CB_OVERLAP, PARANOIA_MODE_NEVERSKIP, PARANOIA_MODE_OVERLAP, PARANOIA_MODE_VERIFY, recover_cache(), root_block::returnedlimit, cdrom_paranoia_s::root, root_block::silencebegin, cdrom_paranoia_s::stage1, and root_block::vector.

lsn_t cdio_paranoia_seek ( cdrom_paranoia_t p,
int32_t  seek,
int  whence 
)

reposition reading offset.

Parameters
pparanoia type
seekbyte offset to seek to
whencelike corresponding parameter in libc's lseek, e.g. SEEK_SET or SEEK_END.
void cdio_paranoia_set_range ( cdrom_paranoia_t p,
long int  start,
long int  end 
)
const char* cdio_paranoia_version ( void  )

Get libcdio-paranoia version.

Returns
paranoia version string

References LIBCDIO_PARANOIA_VERSION.

Variable Documentation

paranoia_cb_mode_t debug_paranoia_cb_mode
paranoia_mode_t debug_paranoia_mode

The below variables are trickery to force the above enum symbol values to be recorded in debug symbol tables. They are used to allow one to refer to the enumeration value names in the typedefs above in a debugger and debugger expressions

const char* paranoia_cb_mode2str[]