libcdio  0.82
Data Structures | Defines | Typedefs | Enumerations | Functions | Variables
cdda.h File Reference

The top-level interface header for libcdio_cdda. Applications include this for paranoia access. More...

#include <cdio/cdio.h>
#include <signal.h>

Go to the source code of this file.

Data Structures

struct  TOC_s
 Structure for cdparanoia's CD Table of Contents. More...
struct  cdrom_drive_s
 Structure for cdparanoia's CD-ROM access. More...

Defines

#define MAXTRK   (CDIO_CD_MAX_TRACKS+1)
#define TOC   TOC_t
#define CDDA_TEST_ALWAYS_JITTER   4
#define CDDA_TEST_FRAG_SMALL   (1<<3)
#define CDDA_TEST_FRAG_LARGE   (2<<3)
#define CDDA_TEST_FRAG_MASSIVE   (3<<3)
#define CDDA_TEST_UNDERRUN   64
#define cdda_find_a_cdrom   cdio_cddap_find_a_cdrom
#define cdda_identify   cdio_cddap_identify
#define cdda_speed_set   cdio_cddap_speed_set
#define cdda_verbose_set   cdio_cddap_verbose_set
#define cdda_messages   cdio_cddap_messages
#define cdda_errors   cdio_cddap_errors
#define cdda_close   cdio_cddap_close
#define cdda_open   cdio_cddap_open
#define cdda_read   cdio_cddap_read
#define cdda_track_firstsector   cdio_cddap_track_firstsector
#define cdda_track_lastsector   cdio_cddap_track_lastsector
#define cdda_tracks   cdio_cddap_tracks
#define cdda_sector_gettrack   cdio_cddap_sector_gettrack
#define cdda_track_channels   cdio_cddap_track_channels
#define cdda_track_audiop   cdio_cddap_track_audiop
#define cdda_track_copyp   cdio_cddap_track_copyp
#define cdda_track_preemp   cdio_cddap_track_preemp
#define cdda_disc_firstsector   cdio_cddap_disc_firstsector
#define cdda_disc_lastsector   cdio_cddap_disc_lastsector
#define cdrom_drive   cdrom_drive_t

Typedefs

typedef struct cdrom_paranoia_s cdrom_paranoia_t
typedef struct cdrom_drive_s cdrom_drive_t
typedef struct TOC_s TOC_t
 Structure for cdparanoia's CD Table of Contents.

Enumerations

enum  paranoia_cdda_enums_t {
  CDDA_MESSAGE_FORGETIT = 0, CDDA_MESSAGE_PRINTIT = 1, CDDA_MESSAGE_LOGIT = 2, CD_FRAMESAMPLES = CDIO_CD_FRAMESIZE_RAW / 4,
  MAXTRK = (CDIO_CD_MAX_TRACKS+1)
}
enum  paranoia_jitter_t {
  CDDA_TEST_JITTER_SMALL = 1, CDDA_TEST_JITTER_LARGE = 2, CDDA_TEST_JITTER_MASSIVE = 3, CDDA_TEST_FRAG_SMALL = (1<<3),
  CDDA_TEST_FRAG_LARGE = (2<<3), CDDA_TEST_FRAG_MASSIVE = (3<<3), CDDA_TEST_UNDERRUN = 64
}
enum  transport_error_t {
  TR_OK = 0, TR_EWRITE = 1, TR_EREAD = 2, TR_UNDERRUN = 3,
  TR_OVERRUN = 4, TR_ILLEGAL = 5, TR_MEDIUM = 6, TR_BUSY = 7,
  TR_NOTREADY = 8, TR_FAULT = 9, TR_UNKNOWN = 10, TR_STREAMING = 11
}

Functions

cdrom_drive_tcdio_cddap_find_a_cdrom (int messagedest, char **ppsz_message)
cdrom_drive_tcdio_cddap_identify (const char *psz_device, int messagedest, char **ppsz_message)
cdrom_drive_tcdio_cddap_identify_cdio (CdIo_t *p_cdio, int messagedest, char **ppsz_messages)
int cdio_cddap_speed_set (cdrom_drive_t *d, int speed)
void cdio_cddap_verbose_set (cdrom_drive_t *d, int err_action, int mes_action)
char * cdio_cddap_messages (cdrom_drive_t *d)
char * cdio_cddap_errors (cdrom_drive_t *d)
bool cdio_cddap_close_no_free_cdio (cdrom_drive_t *d)
int cdio_cddap_close (cdrom_drive_t *d)
int cdio_cddap_open (cdrom_drive_t *d)
long cdio_cddap_read (cdrom_drive_t *d, void *p_buffer, lsn_t beginsector, long sectors)
lsn_t cdio_cddap_track_firstsector (cdrom_drive_t *d, track_t i_track)
lsn_t cdio_cddap_track_lastsector (cdrom_drive_t *d, track_t i_track)
track_t cdio_cddap_tracks (cdrom_drive_t *d)
int cdio_cddap_sector_gettrack (cdrom_drive_t *d, lsn_t lsn)
int cdio_cddap_track_channels (cdrom_drive_t *d, track_t i_track)
int cdio_cddap_track_audiop (cdrom_drive_t *d, track_t i_track)
int cdio_cddap_track_copyp (cdrom_drive_t *d, track_t i_track)
int cdio_cddap_track_preemp (cdrom_drive_t *d, track_t i_track)
lsn_t cdio_cddap_disc_firstsector (cdrom_drive_t *d)
lsn_t cdio_cddap_disc_lastsector (cdrom_drive_t *d)
int data_bigendianp (cdrom_drive_t *d)

Variables

paranoia_jitter_t debug_paranoia_jitter
paranoia_cdda_enums_t debug_paranoia_cdda_enums

Detailed Description

The top-level interface header for libcdio_cdda. Applications include this for paranoia access.


Define Documentation

Errors returned by lib:

001: Unable to set CDROM to read audio mode
002: Unable to read table of contents lead-out
003: CDROM reporting illegal number of tracks
004: Unable to read table of contents header
005: Unable to read table of contents entry
006: Could not read any data from drive
007: Unknown, unrecoverable error reading data
008: Unable to identify CDROM model
009: CDROM reporting illegal table of contents
010: Unaddressable sector 

100: Interface not supported
101: Drive is neither a CDROM nor a WORM device
102: Permision denied on cdrom (ioctl) device
103: Permision denied on cdrom (data) device

300: Kernel memory error

400: Device not open
401: Invalid track number
402: Track not audio data
403: No audio tracks on disc

For compatibility with good ol' paranoia

#define cdda_open   cdio_cddap_open
#define cdda_read   cdio_cddap_read
#define CDDA_TEST_ALWAYS_JITTER   4

jitter testing. The first two bits are set to determine the byte-distance we will jitter the data; 0 is no shifting.< jitter testing. Set the below bit to always cause jittering on reads. The below bit only has any effect if the first two (above) bits are nonzero. If the above bits are set, but the below bit isn't we'll jitter 90% of the time.

#define CDDA_TEST_FRAG_LARGE   (2<<3)
#define CDDA_TEST_FRAG_MASSIVE   (3<<3)

under-run testing. The below bit is set for testing.

#define CDDA_TEST_FRAG_SMALL   (1<<3)

fragment testing

#define CDDA_TEST_UNDERRUN   64
#define cdrom_drive   cdrom_drive_t
#define MAXTRK   (CDIO_CD_MAX_TRACKS+1)

We keep MAXTRK since this header is exposed publicly and other programs may have used this.

#define TOC   TOC_t

For compatibility. TOC is deprecated, use TOC_t instead.


Typedef Documentation

typedef struct cdrom_drive_s cdrom_drive_t
typedef struct cdrom_paranoia_s cdrom_paranoia_t

cdrom_paranoia is an opaque structure which is used in all of the library operations.

typedef struct TOC_s TOC_t

Structure for cdparanoia's CD Table of Contents.


Enumeration Type Documentation

For compatibility. cdrom_drive_t is deprecated, use cdrom_drive_t instead. Flags for simulating jitter used in testing.

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 CDDA_TEST_JITTER_SMALL and get the correct value.

Enumerator:
CDDA_MESSAGE_FORGETIT 
CDDA_MESSAGE_PRINTIT 
CDDA_MESSAGE_LOGIT 
CD_FRAMESAMPLES 
MAXTRK 

Flags for simulating jitter used in testing.

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 CDDA_TEST_JITTER_SMALL and get the correct value.

Enumerator:
CDDA_TEST_JITTER_SMALL 
CDDA_TEST_JITTER_LARGE 
CDDA_TEST_JITTER_MASSIVE 
CDDA_TEST_FRAG_SMALL 
CDDA_TEST_FRAG_LARGE 
CDDA_TEST_FRAG_MASSIVE 
CDDA_TEST_UNDERRUN 

transport errors:

Enumerator:
TR_OK 
TR_EWRITE 

Error writing packet command (transport)

TR_EREAD 

Error reading packet data (transport)

TR_UNDERRUN 

Read underrun

TR_OVERRUN 

Read overrun

TR_ILLEGAL 

Illegal/rejected request

TR_MEDIUM 

Medium error

TR_BUSY 

Device busy

TR_NOTREADY 

Device not ready

TR_FAULT 

Device failure

TR_UNKNOWN 

Unspecified error

TR_STREAMING 

loss of streaming


Function Documentation

Closes d and releases all storage associated with it. Doubles as "cdrom_drive_free()".

Parameters:
dcdrom_drive_t object to be closed.
Returns:
0 if passed a null pointer and 1 if not in which case some work was probably done.
See also:
cdio_cddap_close_no_free_cdio

Closes d and releases all storage associated with it except the internal p_cdio pointer.

Parameters:
dcdrom_drive_t object to be closed.
Returns:
0 if passed a null pointer and 1 if not in which case some work was probably done.
See also:
cdio_cddap_close

Get first lsn of the first audio track. -1 is returned on error.

Get last lsn of the last audio track. The last lsn is generally one less than the start of the next track after the audio track. -1 is returned on error.

cdrom_drive_t* cdio_cddap_find_a_cdrom ( int  messagedest,
char **  ppsz_message 
)

autosense functions Get a CD-ROM drive with a CD-DA in it. If mesagedest is 1, then any messages in the process will be stored in message.

cdrom_drive_t* cdio_cddap_identify ( const char *  psz_device,
int  messagedest,
char **  ppsz_message 
)

Returns a paranoia CD-ROM drive object with a CD-DA in it or NULL if there was an error.

See also:
cdio_cddap_identify_cdio
cdrom_drive_t* cdio_cddap_identify_cdio ( CdIo_t p_cdio,
int  messagedest,
char **  ppsz_messages 
)

Returns a paranoia CD-ROM drive object with a CD-DA in it or NULL if there was an error. In contrast to cdio_cddap_identify, we start out with an initialized p_cdio object. For example you may have used that for other purposes such as to get CDDB/CD-Text information.

See also:
cdio_cddap_identify
long cdio_cddap_read ( cdrom_drive_t d,
void *  p_buffer,
lsn_t  beginsector,
long  sectors 
)

Return the track containing the given LSN. If the LSN is before the first track (in the pregap), 0 is returned. If there was an error or the LSN after the LEADOUT (beyond the end of the CD), then CDIO_INVALID_TRACK is returned.

int cdio_cddap_speed_set ( cdrom_drive_t d,
int  speed 
)

drive-oriented functions

int cdio_cddap_track_audiop ( cdrom_drive_t d,
track_t  i_track 
)

Return 1 is track is an audio track, 0 otherwise.

int cdio_cddap_track_channels ( cdrom_drive_t d,
track_t  i_track 
)

Return the number of channels in track: 2 or 4; -2 if not implemented or -1 for error. Not meaningful if track is not an audio track.

int cdio_cddap_track_copyp ( cdrom_drive_t d,
track_t  i_track 
)

Return 1 is track has copy permit set, 0 otherwise.

Return the lsn for the start of track i_track

Get last lsn of the track. This generally one less than the start of the next track. -1 is returned on error.

int cdio_cddap_track_preemp ( cdrom_drive_t d,
track_t  i_track 
)

Return 1 is audio track has linear preemphasis set, 0 otherwise. Only makes sense for audio tracks.

Return the number of tracks on the CD.

void cdio_cddap_verbose_set ( cdrom_drive_t d,
int  err_action,
int  mes_action 
)

Determine Endian-ness of the CD-drive based on reading data from it. Some drives return audio data Big Endian while some (most) return data Little Endian. Drives known to return data bigendian are SCSI drives from Kodak, Ricoh, HP, Philips, Plasmon, Grundig CDR100IPW, and Mitsumi CD-R. ATAPI and MMC drives are little endian.

rocky: As someone who didn't write the code, I have to say this is nothing less than brilliant. An FFT is done both ways and the the transform is looked at to see which has data in the FFT (or audible) portion. (Or so that's how I understand it.)

Returns:
1 if big-endian, 0 if little-endian, -1 if we couldn't figure things out or some error.

Variable Documentation

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


Generated for libcdio by doxygen 1.7.6.1