changeset 8524:fe542f0201ea

CDDA seeking fixed
author arpi
date Sun, 22 Dec 2002 17:22:48 +0000
parents 31f102fc3aea
children 8d0bfe72e709
files libmpdemux/cdda.c libmpdemux/demux_rawaudio.c libmpdemux/stream.c
diffstat 3 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/cdda.c	Sun Dec 22 16:31:05 2002 +0000
+++ b/libmpdemux/cdda.c	Sun Dec 22 17:22:48 2002 +0000
@@ -204,14 +204,15 @@
   int i;
 
   sec = s->pos/CD_FRAMESIZE_RAW;
-//printf("pos: %d, sec: %d ## %d\n", s->pos, sec, s->pos/CD_FRAMESIZE_RAW);
-//printf("sector: %d\n", p->sector );
+//printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CD_FRAMESIZE_RAW);
+//printf("sector: %d  new: %d\n", p->sector, sec );
  
   for(i=0;i<p->cd->tracks;i++){
-	if( p->sector>p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) {
+        printf("trk #%d: %d .. %d\n",i,p->cd->disc_toc[i].dwStartSector,p->cd->disc_toc[i+1].dwStartSector);
+	if( p->sector>=p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) {
 		current_track = i;
 	}
-	if( sec>p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) {
+	if( sec>=p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) {
 		seeked_track = i;
 	}
   }
@@ -224,16 +225,17 @@
 		  }
 
 	}
- 
+#if 0
   if(sec < p->start_sector)
     sec = p->start_sector;
   else if(sec > p->end_sector)
     sec = p->end_sector;
+#endif
 
   p->sector = sec;
 //  s->pos = sec*CD_FRAMESIZE_RAW;
 
-//printf("seek: %d, sec: %d\n", s->pos, sec);
+//printf("seek: %d, sec: %d\n", (int)s->pos, sec);
   paranoia_seek(p->cdp,sec,SEEK_SET);
 
 }
--- a/libmpdemux/demux_rawaudio.c	Sun Dec 22 16:31:05 2002 +0000
+++ b/libmpdemux/demux_rawaudio.c	Sun Dec 22 17:22:48 2002 +0000
@@ -87,5 +87,7 @@
 
   pos -= (pos % (sh_audio->channels * sh_audio->samplesize) );
   stream_seek(s,pos);
+  sh_audio->delay=pos / (float)(sh_audio->wf->nAvgBytesPerSec);
   resync_audio_stream(sh_audio);
+//  printf("demux_rawaudio: streamtell=%d\n",(int)stream_tell(demuxer->stream));
 }
--- a/libmpdemux/stream.c	Sun Dec 22 16:31:05 2002 +0000
+++ b/libmpdemux/stream.c	Sun Dec 22 17:22:48 2002 +0000
@@ -130,6 +130,10 @@
     newpos=(pos/VCD_SECTOR_DATA)*VCD_SECTOR_DATA;break;
   case STREAMTYPE_DVD:
     newpos=pos/2048; newpos*=2048; break;
+#ifdef HAVE_CDDA
+  case STREAMTYPE_CDDA:
+    newpos=(pos/VCD_SECTOR_SIZE)*VCD_SECTOR_SIZE;break;
+#endif
   }
 
 if(verbose>=3){