comparison libmpdemux/cdda.c @ 8524:fe542f0201ea

CDDA seeking fixed
author arpi
date Sun, 22 Dec 2002 17:22:48 +0000
parents 3dc0b71630ff
children c40e862a7dc2
comparison
equal deleted inserted replaced
8523:31f102fc3aea 8524:fe542f0201ea
202 int sec; 202 int sec;
203 int current_track=0, seeked_track=0; 203 int current_track=0, seeked_track=0;
204 int i; 204 int i;
205 205
206 sec = s->pos/CD_FRAMESIZE_RAW; 206 sec = s->pos/CD_FRAMESIZE_RAW;
207 //printf("pos: %d, sec: %d ## %d\n", s->pos, sec, s->pos/CD_FRAMESIZE_RAW); 207 //printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CD_FRAMESIZE_RAW);
208 //printf("sector: %d\n", p->sector ); 208 //printf("sector: %d new: %d\n", p->sector, sec );
209 209
210 for(i=0;i<p->cd->tracks;i++){ 210 for(i=0;i<p->cd->tracks;i++){
211 if( p->sector>p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) { 211 printf("trk #%d: %d .. %d\n",i,p->cd->disc_toc[i].dwStartSector,p->cd->disc_toc[i+1].dwStartSector);
212 if( p->sector>=p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) {
212 current_track = i; 213 current_track = i;
213 } 214 }
214 if( sec>p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) { 215 if( sec>=p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) {
215 seeked_track = i; 216 seeked_track = i;
216 } 217 }
217 } 218 }
218 //printf("current: %d, seeked: %d\n", current_track, seeked_track); 219 //printf("current: %d, seeked: %d\n", current_track, seeked_track);
219 if( current_track!=seeked_track ) { 220 if( current_track!=seeked_track ) {
222 if( cd_track!=NULL ) { 223 if( cd_track!=NULL ) {
223 printf("%s\n", cd_track->name ); 224 printf("%s\n", cd_track->name );
224 } 225 }
225 226
226 } 227 }
227 228 #if 0
228 if(sec < p->start_sector) 229 if(sec < p->start_sector)
229 sec = p->start_sector; 230 sec = p->start_sector;
230 else if(sec > p->end_sector) 231 else if(sec > p->end_sector)
231 sec = p->end_sector; 232 sec = p->end_sector;
233 #endif
232 234
233 p->sector = sec; 235 p->sector = sec;
234 // s->pos = sec*CD_FRAMESIZE_RAW; 236 // s->pos = sec*CD_FRAMESIZE_RAW;
235 237
236 //printf("seek: %d, sec: %d\n", s->pos, sec); 238 //printf("seek: %d, sec: %d\n", (int)s->pos, sec);
237 paranoia_seek(p->cdp,sec,SEEK_SET); 239 paranoia_seek(p->cdp,sec,SEEK_SET);
238 240
239 } 241 }
240 242
241 void close_cdda(stream_t* s) { 243 void close_cdda(stream_t* s) {