From 0f6930201402f8d348dfa482a01ddc037a3f6a57 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Sat, 6 Sep 2003 23:10:36 +0000 Subject: Don't add the data track to the autoplay list for Audio CDs (Linux) We still need to get the track information to calculate the CD ID, and cached CDDB information to work though CVS patchset: 5348 CVS date: 2003/09/06 23:10:36 --- ChangeLog | 1 + src/input/input_cdda.c | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d3c46e6a..1b992a8e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ xine-lib (1-rc1) * fix aspect ratio of MPEG1 streams * Add support for TITLE= and CHAPTER*= comment in ogm files * fix deadlock/freeze problems in audio output thread + * Don't add the data track to the autoplay list for Audio CDs (Linux) xine-lib (1-rc0a) * includes ffmpeg's MPEG encode in dist tarball (fixes DXR3 support) diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index ca091958a..e845fa4bf 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.32 2003/08/25 21:51:39 f1rmb Exp $ + * $Id: input_cdda.c,v 1.33 2003/09/06 23:10:37 hadess Exp $ */ #ifdef HAVE_CONFIG_H @@ -91,6 +91,7 @@ typedef struct _cdrom_toc { int first_track; int last_track; int total_tracks; + int ignore_last_track; cdrom_toc_entry *toc_entries; cdrom_toc_entry leadout_track; /* need to know where last track ends */ @@ -375,6 +376,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { struct cdrom_tochdr tochdr; struct cdrom_tocentry tocentry; + struct cdrom_multisession ms; int i; /* fetch the table of contents */ @@ -383,8 +385,19 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { return -1; } + ms.addr_format = CDROM_LBA; + if (ioctl(fd, CDROMMULTISESSION, &ms) == -1) { + perror("CDROMMULTISESSION"); + return -1; + } + toc->first_track = tochdr.cdth_trk0; toc->last_track = tochdr.cdth_trk1; + if (ms.xa_flag) { + toc->ignore_last_track = 1; + } else { + toc->ignore_last_track = 0; + } toc->total_tracks = toc->last_track - toc->first_track + 1; /* allocate space for the toc entries */ @@ -2431,6 +2444,7 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, cdrom_toc toc; char trackmrl[20]; int fd, i, err = -1; + int num_tracks; /* free old playlist */ for( i = 0; this->autoplaylist[i]; i++ ) { @@ -2474,7 +2488,10 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, if ( err < 0 ) return NULL; - for ( i = 0; i <= toc.last_track - toc.first_track; i++ ) { + num_tracks = toc.last_track - toc.first_track; + if (toc.ignore_last_track) + num_tracks--; + for ( i = 0; i <= num_tracks; i++ ) { sprintf(trackmrl,"cdda:/%d",i+toc.first_track); this->autoplaylist[i] = strdup(trackmrl); } -- cgit v1.2.3