comparison stream/stream_cdda.c @ 25365:b57179296e5a

Only print one track info when exactly seeking to the beginning of a track.
author ulion
date Fri, 14 Dec 2007 15:39:46 +0000
parents 74fbb5173956
children 25b27cf5bbeb
comparison
equal deleted inserted replaced
25364:fec8936c8079 25365:b57179296e5a
326 static int seek(stream_t* s,off_t newpos) { 326 static int seek(stream_t* s,off_t newpos) {
327 cdda_priv* p = (cdda_priv*)s->priv; 327 cdda_priv* p = (cdda_priv*)s->priv;
328 cd_track_t *cd_track; 328 cd_track_t *cd_track;
329 int sec; 329 int sec;
330 int current_track=0, seeked_track=0; 330 int current_track=0, seeked_track=0;
331 int seek_to_track = 0;
331 int i; 332 int i;
332 333
333 s->pos = newpos; 334 s->pos = newpos;
334 sec = s->pos/CD_FRAMESIZE_RAW; 335 sec = s->pos/CD_FRAMESIZE_RAW;
335 if (s->pos < 0 || sec >= p->end_sector) { 336 if (s->pos < 0 || sec >= p->end_sector) {
345 if( p->sector>=p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) { 346 if( p->sector>=p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) {
346 current_track = i; 347 current_track = i;
347 } 348 }
348 if( sec>=p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) { 349 if( sec>=p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) {
349 seeked_track = i; 350 seeked_track = i;
351 seek_to_track = sec == p->cd->disc_toc[i].dwStartSector;
350 } 352 }
351 } 353 }
352 //printf("current: %d, seeked: %d\n", current_track, seeked_track); 354 //printf("current: %d, seeked: %d\n", current_track, seeked_track);
353 if( current_track!=seeked_track ) { 355 if (current_track != seeked_track && !seek_to_track) {
354 //printf("Track %d, sector=%d\n", seeked_track, sec); 356 //printf("Track %d, sector=%d\n", seeked_track, sec);
355 cd_track = cd_info_get_track(p->cd_info, seeked_track+1); 357 cd_track = cd_info_get_track(p->cd_info, seeked_track+1);
356 if( cd_track!=NULL ) { 358 if( cd_track!=NULL ) {
357 mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name); 359 mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
358 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb); 360 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);