changeset 16926:24c52f2c3aa9

fix cdda://n syntax: do not hang when n > nr_tracks and play only track n, not all after (unfortunately, cdda://n- does not work, use e.g. cdda://n-99999).
author reimar
date Sun, 06 Nov 2005 14:17:51 +0000
parents 4bce034eeb0a
children 461c7ba402c3
files libmpdemux/cdda.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/cdda.c	Sun Nov 06 14:14:53 2005 +0000
+++ b/libmpdemux/cdda.c	Sun Nov 06 14:17:51 2005 +0000
@@ -97,6 +97,7 @@
   cdda_priv* priv;
   cd_info_t *cd_info,*cddb_info = NULL;
   unsigned int audiolen=0;
+  int last_track;
   int i;
   char *xmcd_file = NULL;
 
@@ -185,14 +186,16 @@
   if(p->speed)
     cdda_speed_set(cdd,p->speed);
 
+  last_track = cdda_tracks(cdd);
+  if (p->span.start > last_track) p->span.start = last_track;
+  if (p->span.end < p->span.start) p->span.end = p->span.start;
+  if (p->span.end > last_track) p->span.end = last_track;
   if(p->span.start)
     priv->start_sector = cdda_track_firstsector(cdd,p->span.start);
   else
     priv->start_sector = cdda_disc_firstsector(cdd);
 
   if(p->span.end) {
-    int last = cdda_tracks(cdd);
-    if(p->span.end > last) p->span.end = last;
     priv->end_sector = cdda_track_lastsector(cdd,p->span.end);
   } else
     priv->end_sector = cdda_disc_lastsector(cdd);