2 Reading
Thomas Schmitt edited this page 2020-07-08 10:22:47 +00:00

Reading of optical media is for now restricted to reading of data sectors, which is done by call burn_read_data() of libburn, reading of audio CD sectors by call burn_read_audio(), and reading of CD-TEXT from audio CD by burn_disc_get_leadin_text().

This is fully sufficient for DVD media. On CD, a sector not only may host 2048 bytes of payload but stores more information which can be accessed by special SCSI commands. An example are Audio sectors of CD-DA discs which store payload in all their 2352 bytes. Other sector formats are known withi payload between that maximum and 2048.

Data reading has several use cases in libburnia:

Demo program telltoc is able to read CD TAO tracks up to the last data sectors which are normally inaccessible through the Linux block devices. This is due to the fact that a TAO track announces a size which includes two non-data sectors at the end of the track. Some drives correct this, some do not. Whether a track was recorded by TAO is hardly to tell. In a SAO track, all announced sectors are data sectors. telltoc solves this dilemma by reading the end sectors of a track one-by-one.

Application program cdrskin emulates ISO multi-session on DVD+RW by reading the first 64 kB of the ISO 9660 image from media, patching some address fields and writing them back. (Learned from Andy Polyakov's growisofs.) Further, cdrskin is able to copy audio tracks and CD-TEXT from CD to hard disk.

Library libisoburn creates an interface object for library libisofs which can read data blocks from libburn drives. This is used for detecting an ISO 9660 image and for loading its directory tree and management data. libisoburn itself performs the same patching of DVD+RW and similar media as can be done by cdrskin.

Application program xorriso uses data reading capabilities for comparing the content of disk files with the content of ISO image files and for copying files from ISO image to disk.

On several Linux systems, the block device driver needs reloading of the drive tray in order to make available freshly written data via its buffered i/o. The libburn read function does not need such a reload.