changeset 25382:25b27cf5bbeb

Make the end_sector accessable (it should be).
author ulion
date Sat, 15 Dec 2007 15:38:38 +0000
parents beda94ca3895
children 9ca05492f9f3
files stream/stream_cdda.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_cdda.c	Sat Dec 15 15:32:27 2007 +0000
+++ b/stream/stream_cdda.c	Sat Dec 15 15:38:38 2007 +0000
@@ -261,7 +261,7 @@
 
   st->priv = priv;
   st->start_pos = priv->start_sector*CD_FRAMESIZE_RAW;
-  st->end_pos = priv->end_sector*CD_FRAMESIZE_RAW;
+  st->end_pos = (priv->end_sector + 1) * CD_FRAMESIZE_RAW;
   st->type = STREAMTYPE_CDDA;
   st->sector_size = CD_FRAMESIZE_RAW;
 
@@ -289,6 +289,11 @@
   int16_t * buf;
   int i;
   
+  if((p->sector < p->start_sector) || (p->sector > p->end_sector)) {
+    s->eof = 1;
+    return 0;
+  }
+
   buf = paranoia_read(p->cdp,cdparanoia_callback);
   if (!buf)
     return 0;
@@ -302,11 +307,6 @@
   s->pos = p->sector*CD_FRAMESIZE_RAW;
   memcpy(buffer,buf,CD_FRAMESIZE_RAW);
 
-  if((p->sector < p->start_sector) || (p->sector >= p->end_sector)) {
-    s->eof = 1;
-    return 0;
-  }
-
   for(i=0;i<p->cd->tracks;i++){
 	  if(p->cd->disc_toc[i].dwStartSector==p->sector-1) {
 		  cd_track = cd_info_get_track(p->cd_info, i+1);
@@ -333,7 +333,7 @@
   
   s->pos = newpos;
   sec = s->pos/CD_FRAMESIZE_RAW;
-  if (s->pos < 0 || sec >= p->end_sector) {
+  if (s->pos < 0 || sec > p->end_sector) {
     s->eof = 1;
     return 0;
   }