[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libcdio-devel] About the ability to handle DVD and BD media
From: |
Thomas Schmitt |
Subject: |
[Libcdio-devel] About the ability to handle DVD and BD media |
Date: |
Sun, 24 May 2020 20:51:41 +0200 |
Hi,
i now wonder whether libcdio is supposed to handle DVD and BD media at all.
Maybe it should rather bail out on non-CD media or fall back to simple
standard i/o ?
--------------------------------------------------------------------------
The current situation is problematic:
gnu_linux.c uses in read_toc_linux() the Linux ioctl CDROMREADTOCENTRY
to obtain the start addresses and other info about the tracks. Among them
is the Leadout start address which tells the readble size of the medium.
There are two variations of this ioctl: CDROM_MSF and CDROM_LBA.
libcdio decides to use CDROM_MSF, which limits the replied addresses to
255 minutes, 255 seconds, 255 frames (actually only 59 seconds and 74 frames).
I changed this to CDROM_LBA and get as Leadout LBA 1151849, which is
the correct (*) translation of MSF 255:59:74. sr_read_tocentry() in Linux
drivers/scsi/sr_ioctl.c with CDROM_LBA emits SCSI command READ TOC/PMA/ATIP
for reply format 0 and with MSF bit off.
MMC-5 table 483 "Fabrication of TOC Form 0 for Single Session DVD"
says about the replied address field:
Track AAh (Lead-out) Descriptor
Bytes 16...19
Track Start Address
LBA form = Actual start of lead-out,
MSF form = MSF translation of LBA with a
maximum of MSF address of 00h, FFh, 3Bh, 4Ah
But somehow the drive firmwares (3 tested) seem to interpret this that
the LBA shall also be restricted to the equivalent of 255:59:74.
(I could not get libburn to issue such a READ TOC/PMA/ATIP command for DVD.
It is deeply convinced that a DVD table-of-content has to be made by
SCSI commands READ DISC INFORMATION and READ TRACK INFORMATION.)
Whatever, libcdio then applies its own alteration to the result
++ WARN: number of minutes (255) truncated to 99.
170: 99:57:74 449699 leadout (1008 MB raw, 878 MB formatted)
So salvaging the size assessment of media larger than CD on Linux is
not trivial. For DVD and BD one could use Linux ioctl BLKGETSIZE to
replace the inquiry of leadout by fabricated TOC.
The definitions of TOC fabrication for DVD and BD in MMC-5 hardcode
the start address for track 1:
Table 483 — Fabrication of TOC Form 0 for Single Session DVD
Table 484 — Response Format 0: Data Returned for BD-ROM disc
Table 486 — Response Format 0: Data Returned for formatted BD-R discs
Track 1 Descriptor
Byte 8...11
Track Start Address
LBA form = 000000h, MSF form = 00:00:02:00
More tracks than 1 and AA get not fabricated for non-CD by this output
format.
-----------------------------------------------------------------------
(*) The functions cdio_lba_to_msf() and cdio_msf_to_lba() do it wrong
by mapping MSF 0:0:0 to LBA 0. Actually it is LBA -150. 0:2:0 is LBA 0.
See above quote from table 483.
This causes my test with CDROM_LBA to report after conversion
LBA->MSF->LBA a start LBA of 0xffffffffffffff6a.
#: MSF LSN Type Green? Copy?
1: 00:00:00 18446744073709551466 data false no
instead of
1: 00:02:00 0 data false no
(Somewhere must be a -150 applied which i did not find yet.)
Have a nice day :)
Thomas
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Libcdio-devel] About the ability to handle DVD and BD media,
Thomas Schmitt <=