Support for multisession CD Extra Discs courtesy of Patrick
Guimond. testiso9660.c: remove ltime comparison check. :-(
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: common_interface.c,v 1.13 2005/02/05 12:37:35 rocky Exp $
|
$Id: common_interface.c,v 1.14 2007/09/28 00:25:43 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
Copyright (C) 1998, 2002 Monty monty@xiph.org
|
Copyright (C) 1998, 2002 Monty monty@xiph.org
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -186,14 +186,12 @@ data_bigendianp(cdrom_drive_t *d)
|
|||||||
/*! Here we fix up a couple of things that will never happen. yeah,
|
/*! Here we fix up a couple of things that will never happen. yeah,
|
||||||
right.
|
right.
|
||||||
|
|
||||||
rocky OMITTED FOR NOW:
|
|
||||||
The multisession stuff is from Hannu's code; it assumes it knows
|
The multisession stuff is from Hannu's code; it assumes it knows
|
||||||
the leadout/leadin size.
|
the leadout/leadin size.
|
||||||
|
|
||||||
@return -1 if we can't get multisession info, 0 if there is one
|
@return -1 if we can't get multisession info, 0 if there is one
|
||||||
session only or the multi-session LBA is less than or 100 (don't
|
session only or the last session LBA is the same as the first audio
|
||||||
ask me why -- I don't know), and 1 if the multi-session lba is
|
track and 1 if the multi-session lba is higher than first audio track
|
||||||
greater than 100.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
FixupTOC(cdrom_drive_t *d, track_t i_tracks)
|
FixupTOC(cdrom_drive_t *d, track_t i_tracks)
|
||||||
@@ -231,37 +229,42 @@ FixupTOC(cdrom_drive_t *d, track_t i_tracks)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LOOKED_OVER
|
d->audio_last_sector = CDIO_INVALID_LSN;
|
||||||
/* For a scsi device, the ioctl must go to the specialized SCSI
|
|
||||||
CDROM device, not the generic device. */
|
{
|
||||||
|
lsn_t last_ses_lsn;
|
||||||
if (d->ioctl_fd != -1) {
|
if (cdio_get_last_session (d->p_cdio, &last_ses_lsn) < 0)
|
||||||
struct cdrom_multisession ms_str;
|
return -1;
|
||||||
int result;
|
|
||||||
|
/* A Red Book Disc must have only one session, otherwise this is a
|
||||||
ms_str.addr_format = CDROM_LBA;
|
* CD Extra */
|
||||||
result = ioctl(d->ioctl_fd, CDROMMULTISESSION, &ms_str);
|
if (last_ses_lsn > d->disc_toc[0].dwStartSector) {
|
||||||
if (result == -1) return -1;
|
/* CD Extra discs have two session, the first one ending after
|
||||||
|
* the last audio track
|
||||||
if (ms_str.addr.lba > 100) {
|
* Thus the need to fix the length of the the audio data portion to
|
||||||
|
* not cross the lead-out of this session */
|
||||||
/* This is an odd little piece of code --Monty */
|
for (j = i_tracks-1; j > 1; j--) {
|
||||||
|
if (cdio_get_track_format(d->p_cdio, j+1) != TRACK_FORMAT_AUDIO &&
|
||||||
/* believe the multisession offset :-) */
|
cdio_get_track_format(d->p_cdio, j) == TRACK_FORMAT_AUDIO) {
|
||||||
/* adjust end of last audio track to be in the first session */
|
/* First session lead-out is 1:30
|
||||||
for (j = i_tracks-1; j >= 0; j--) {
|
* Lead-ins are 1:00
|
||||||
if (j > 0 && !IS_AUDIO(d,j) && IS_AUDIO(d,j-1)) {
|
* Every session's first track have a 0:02 pregap
|
||||||
if ((d->disc_toc[j].dwStartSector > ms_str.addr.lba - 11400) &&
|
*
|
||||||
(ms_str.addr.lba - 11400 > d->disc_toc[j-1].dwStartSector))
|
* That makes a control data section of (90+60+2)*75 sectors in the
|
||||||
d->disc_toc[j].dwStartSector = ms_str.addr.lba - 11400;
|
* last audio track */
|
||||||
break;
|
const int lead_out_gap = ((90+60+2) * CDIO_CD_FRAMES_PER_SEC);
|
||||||
|
|
||||||
|
if ((last_ses_lsn - lead_out_gap >= d->disc_toc[j-1].dwStartSector) &&
|
||||||
|
(last_ses_lsn - lead_out_gap < d->disc_toc[j].dwStartSector)) {
|
||||||
|
d->audio_last_sector = last_ses_lsn - lead_out_gap - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: toc.c,v 1.5 2005/01/10 02:10:46 rocky Exp $
|
$Id: toc.c,v 1.6 2007/09/28 00:25:43 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
@@ -109,6 +109,15 @@ cdda_track_lastsector(cdrom_drive_t *d, track_t i_track)
|
|||||||
cderror(d,"401: Invalid track number\n");
|
cderror(d,"401: Invalid track number\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CD Extra have their first session ending at the last audio track */
|
||||||
|
if (d->cd_extra > 0 && i_track+1 <= d->tracks) {
|
||||||
|
if (d->audio_last_sector >= d->disc_toc[i_track-1].dwStartSector &&
|
||||||
|
d->audio_last_sector < d->disc_toc[i_track].dwStartSector) {
|
||||||
|
return d->audio_last_sector;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Safe, we've always the leadout at disc_toc[tracks] */
|
/* Safe, we've always the leadout at disc_toc[tracks] */
|
||||||
return(d->disc_toc[i_track].dwStartSector-1);
|
return(d->disc_toc[i_track].dwStartSector-1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: testiso9660.c,v 1.18 2007/07/19 02:03:39 rocky Exp $
|
$Id: testiso9660.c,v 1.19 2007/09/28 00:25:43 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
Copyright (C) 2003, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
|
|
||||||
@@ -274,13 +274,15 @@ main (int argc, const char *argv[])
|
|||||||
printf("Problem running iso966)get_ltime\n");
|
printf("Problem running iso966)get_ltime\n");
|
||||||
return 44;
|
return 44;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FIXED
|
||||||
t2 = mktime(&tm);
|
t2 = mktime(&tm);
|
||||||
if ( t1 != t2 && ! time_compare(p_tm, &tm) ) {
|
if ( t1 != t2 && ! time_compare(p_tm, &tm) ) {
|
||||||
printf("local time retrieved with iso9660_get_ltime() not\n");
|
printf("local time retrieved with iso9660_get_ltime() not\n");
|
||||||
printf("same as that set with iso9660_set_ltime().\n");
|
printf("same as that set with iso9660_set_ltime().\n");
|
||||||
return 45;
|
return 45;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
p_tm = gmtime(&now);
|
p_tm = gmtime(&now);
|
||||||
t1 = mktime(p_tm);
|
t1 = mktime(p_tm);
|
||||||
|
|||||||
Reference in New Issue
Block a user