libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD


From: Thomas Schmitt
Subject: Re: [Libcdio-devel] CD_MSF_FORMAT vs LBA on NetBSD
Date: Tue, 30 Oct 2018 21:16:31 +0100

Hi,

i see a possible explanation for wrong LBA on NetBSD in
  
https://github.com/vext01/libcdio/commit/3826afab31d4d418be3f0fee1132fa61077000f5

Function get_track_lba_netbsd() assumes that read_toc_netbsd() obtains
tocent[].addr in LBA format. But on NetBSD the obtained format is MSF
(and in OpenBSD i propose to convert it to MSF from LBA).

So get_track_lba_netbsd() should convert its answer from MSF format
before using it as LBA to compute its return value:
  
  msf_t msf;
  ...
  msf.m = p_env->tocent[i_track - p_env->gen.i_first_track].addr.msf.minute;
  msf.s = p_env->tocent[i_track - p_env->gen.i_first_track].addr.msf.second;
  msf.f = p_env->tocent[i_track - p_env->gen.i_first_track].addr.msf.frame;
  return (cdio_msf_to_lba(&msf) + CDIO_PREGAP_SECTORS);

instead of

  return (p_env->tocent[i_track - p_env->gen.i_first_track].addr.lba +
      CDIO_PREGAP_SECTORS);

(Here the possibility of a start track number != 1 is anticipated.
 get_track_msf_netbsd() on the other hand uses the submitted track_num
 under the assumption that numbering starts with 1.
 Can this be the reason for the rumor that MSF does not work on OpenBSD ?
 Just a more demanding test CD with first track number like 7 or 13 ?)


If the failed program run used API function cdio_get_track_lba() then
on NetBSD the current situation in vext01 should produce wrong LBAs
because cdio_get_track_lba() in lib/driver/track.c prefers
  p_cdio->op.get_track_lba
over
  p_cdio->op.get_track_msf

On OpenBSD the two violations of assumptions compensate each other for
get_track_lba_netbsd(). But consequential, get_track_msf_netbsd() is
supposed to be broken, currently. This means cdio_get_track_msf() is broken.

-----------------------------------------------------------------------

A simple solution would be to throw out get_track_lba_netbsd() and
to set .get_track_lba to NULL.
Then both functions in track.c would use get_track_msf_netbsd().
Next one would fix get_track_msf_netbsd() to take into respect
  p_env->gen.i_first_track
instead of 1 when accessing .tocent[] by track number.

As long as it is purely about CD media, asking the drive for LBA offers
no advantage over asking it for MSF (that's SCSI command READ TOC/PMA/ATIP
field "Format"). On DVD and BD media there are LBAs which exceed the limit
of 256 minutes. But there are no audio sectors on DVD or BD.


Have a nice day :)

Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]