Mercurial > mplayer.hg
comparison stream/stream_cue.c @ 30768:6032dd934340
Ensure that cue_current_pos.track is not set to an invalid value after
attempting to seek to e.g. track 0.
author | reimar |
---|---|
date | Mon, 01 Mar 2010 20:20:13 +0000 |
parents | 29588c0eafd3 |
children | ac65c60efd86 |
comparison
equal
deleted
inserted
replaced
30767:29588c0eafd3 | 30768:6032dd934340 |
---|---|
437 } | 437 } |
438 | 438 |
439 | 439 |
440 | 440 |
441 | 441 |
442 static int cue_read_toc_entry(void) { | 442 static int cue_read_toc_entry(int track) { |
443 | |
444 int track = cue_current_pos.track - 1; | |
445 | |
446 /* check if its a valid track, if not return -1 */ | 443 /* check if its a valid track, if not return -1 */ |
447 if (track < 0 || track >= nTracks) | 444 if (track <= 0 || track > nTracks) |
448 return -1; | 445 return -1; |
449 | 446 |
450 | 447 |
448 cue_current_pos.track = track; | |
449 track--; | |
451 switch (tracks[track].mode) | 450 switch (tracks[track].mode) |
452 { | 451 { |
453 case AUDIO: | 452 case AUDIO: |
454 cue_current_pos.mode = AUDIO; | 453 cue_current_pos.mode = AUDIO; |
455 break; | 454 break; |
468 | 467 |
469 return 0; | 468 return 0; |
470 } | 469 } |
471 | 470 |
472 static int cue_vcd_seek_to_track (int track){ | 471 static int cue_vcd_seek_to_track (int track){ |
473 cue_current_pos.track = track; | 472 if (cue_read_toc_entry (track)) |
474 | |
475 if (cue_read_toc_entry ()) | |
476 return -1; | 473 return -1; |
477 | 474 |
478 return VCD_SECTOR_DATA * cue_get_msf(); | 475 return VCD_SECTOR_DATA * cue_get_msf(); |
479 } | 476 } |
480 | 477 |