libcdio-paranoia  10.2+0.94+2git
Functions
common_interface.c File Reference
#include "common_interface.h"
#include <math.h>
#include "utils.h"
#include "smallft.h"

Functions

int data_bigendianp (cdrom_drive_t *d)
 
int FixupTOC (cdrom_drive_t *d, track_t i_tracks)
 

Function Documentation

int data_bigendianp ( cdrom_drive_t d)

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.

References cdrom_drive_s::bigendianp, cdda_track_audiop(), cdda_track_firstsector(), cdda_track_lastsector(), cdmessage(), cdrom_drive_s::enable_cdda, fft_forward(), NULL, cdrom_drive_s::read_audio, and cdrom_drive_s::tracks.

Referenced by cdio_cddap_open(), and cdio_cddap_read_timed().

int FixupTOC ( cdrom_drive_t d,
track_t  i_tracks 
)

Here we fix up a couple of things that will never happen. yeah, right.

The multisession stuff is from Hannu code; it assumes it knows the leadout/leadin size. [I think Hannu refers to Hannu Savolainen from GNU/Linux Kernel code.]

Returns
-1 if we can't get multisession info, 0 if there is one session only or the last session LBA is the same as the first audio track and 1 if the multi-session lba is higher than first audio track

References cdrom_drive_s::audio_last_sector, cdmessage(), cdrom_drive_s::disc_toc, TOC_s::dwStartSector, and cdrom_drive_s::p_cdio.