[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libcdio-devel] cd extra audio data boundaries
From: |
Patrick Guimond |
Subject: |
[Libcdio-devel] cd extra audio data boundaries |
Date: |
Sat, 26 Aug 2006 20:13:49 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060728 SeaMonkey/1.0.3 |
Hi
It seems that the handling of cd extra discs (multisession) has been
commented for review in the cdda_interface imported from cdparanoia.
The attached patch re-enables this support by using internal cdio
functions and explains offset values.
Patrick Guimond
diff -ur libcdio/lib/cdda_interface/common_interface.c
libcdio_work/lib/cdda_interface/common_interface.c
--- libcdio/lib/cdda_interface/common_interface.c 2006-08-26
18:08:23.000000000 -0400
+++ libcdio_work/lib/cdda_interface/common_interface.c 2006-08-26
18:01:50.000000000 -0400
@@ -186,14 +186,12 @@
/*! Here we fix up a couple of things that will never happen. yeah,
right.
- rocky OMITTED FOR NOW:
The multisession stuff is from Hannu's code; it assumes it knows
the leadout/leadin size.
@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
- ask me why -- I don't know), and 1 if the multi-session lba is
- greater than 100.
+ 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
*/
int
FixupTOC(cdrom_drive_t *d, track_t i_tracks)
@@ -231,36 +229,38 @@
}
}
-#if LOOKED_OVER
- /* For a scsi device, the ioctl must go to the specialized SCSI
- CDROM device, not the generic device. */
-
- if (d->ioctl_fd != -1) {
- struct cdrom_multisession ms_str;
- int result;
-
- ms_str.addr_format = CDROM_LBA;
- result = ioctl(d->ioctl_fd, CDROMMULTISESSION, &ms_str);
- if (result == -1) return -1;
-
- if (ms_str.addr.lba > 100) {
-
- /* This is an odd little piece of code --Monty */
-
- /* believe the multisession offset :-) */
- /* adjust end of last audio track to be in the first session */
- for (j = i_tracks-1; j >= 0; j--) {
- if (j > 0 && !IS_AUDIO(d,j) && IS_AUDIO(d,j-1)) {
- if ((d->disc_toc[j].dwStartSector > ms_str.addr.lba - 11400) &&
- (ms_str.addr.lba - 11400 > d->disc_toc[j-1].dwStartSector))
- d->disc_toc[j].dwStartSector = ms_str.addr.lba - 11400;
+ d->audio_last_sector = CDIO_INVALID_LSN;
+
+ lsn_t last_ses_lsn;
+ if (cdio_get_last_session (d->p_cdio, &last_ses_lsn) < 0)
+ return -1;
+
+ /* A Red Book Disc must have only one session, otherwise this is a
+ * CD Extra */
+ if (last_ses_lsn > d->disc_toc[0].dwStartSector) {
+ /* CD Extra discs have two session, the first one ending after
+ * the last audio track
+ * Thus the need to fix the length of the the audio data portion to
+ * not cross the lead-out of this session */
+ for (j = i_tracks-1; j > 1; j--) {
+ if (cdio_get_track_format(d->p_cdio, j+1) != TRACK_FORMAT_AUDIO &&
+ cdio_get_track_format(d->p_cdio, j) == TRACK_FORMAT_AUDIO) {
+
+ /* First session lead-out is 1:30
+ * Lead-ins are 1:00
+ * Every session's first track have a 0:02 pregap
+ *
+ * That makes a control data section of (90+60+2)*75 sectors in the
+ * last audio track */
+ if ((last_ses_lsn - (90+60+2)*75 >= d->disc_toc[j-1].dwStartSector) &&
+ (last_ses_lsn - (90+60+2)*75 < d->disc_toc[j].dwStartSector)) {
+ d->audio_last_sector = last_ses_lsn - (90+60+2)*75 - 1;
break;
}
}
- return 1;
}
+ return 1;
}
-#endif
return 0;
}
diff -ur libcdio/lib/cdda_interface/toc.c libcdio_work/lib/cdda_interface/toc.c
--- libcdio/lib/cdda_interface/toc.c 2006-08-26 18:08:23.000000000 -0400
+++ libcdio_work/lib/cdda_interface/toc.c 2006-08-26 18:01:50.000000000
-0400
@@ -109,6 +109,15 @@
cderror(d,"401: Invalid track number\n");
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] */
return(d->disc_toc[i_track].dwStartSector-1);
}
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Libcdio-devel] cd extra audio data boundaries,
Patrick Guimond <=