summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-01 20:20:13 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-01 20:20:13 +0000
commitea139fadc1e714b2493d46ede57d3d52c36770db (patch)
treef1b1aa2a1f33ad17e0caf1a2f97ac639e3de6865 /stream
parent20fcc5c6ef76fea4b1f0f627170777e3fab8b950 (diff)
downloadmpv-ea139fadc1e714b2493d46ede57d3d52c36770db.tar.bz2
mpv-ea139fadc1e714b2493d46ede57d3d52c36770db.tar.xz
Ensure that cue_current_pos.track is not set to an invalid value after
attempting to seek to e.g. track 0. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30810 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_cue.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/stream/stream_cue.c b/stream/stream_cue.c
index c356827782..0300e7c78e 100644
--- a/stream/stream_cue.c
+++ b/stream/stream_cue.c
@@ -439,15 +439,14 @@ static int cue_read_cue (char *in_cue_filename)
-static int cue_read_toc_entry(void) {
-
- int track = cue_current_pos.track - 1;
-
+static int cue_read_toc_entry(int track) {
/* check if its a valid track, if not return -1 */
- if (track < 0 || track >= nTracks)
+ if (track <= 0 || track > nTracks)
return -1;
+ cue_current_pos.track = track;
+ track--;
switch (tracks[track].mode)
{
case AUDIO:
@@ -470,9 +469,7 @@ static int cue_read_toc_entry(void) {
}
static int cue_vcd_seek_to_track (int track){
- cue_current_pos.track = track;
-
- if (cue_read_toc_entry ())
+ if (cue_read_toc_entry (track))
return -1;
return VCD_SECTOR_DATA * cue_get_msf();