1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-07 07:31:48 +00:00

demux_lavf: fix stream switch returned index for no sound/video

If the argument given to demux_lavf audio/video switch code is not one
of -2, -1, or valid audio/video ID the code will treat it the same as
-2 (switch to no sound / no video). However the returned index was not
set to -2 in this case. Fix. Also change the returned index from -1 to
-2 when staying at no sound / video.
This commit is contained in:
Uoti Urpala 2011-03-31 00:11:28 +03:00
parent df31b077b4
commit 5949f5b9fd

View File

@ -865,22 +865,18 @@ static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
} }
} }
if(id == -2) { // no sound if (id == -1) { // next track
i = -1;
} else if(id == -1) { // next track
i = (curridx + 2) % (nstreams + 1) - 1; i = (curridx + 2) % (nstreams + 1) - 1;
if (i >= 0) if (i >= 0)
newid = pstreams[i]; newid = pstreams[i];
} } else if (id >= 0 && id < nstreams) { // select track by id
else // select track by id i = id;
{ newid = pstreams[i];
if (id >= 0 && id < nstreams) { } else // no sound
i = id; i = -1;
newid = pstreams[i];
}
}
if (i == curridx) { if (i == curridx) {
*(int *) arg = curridx; *(int *) arg = curridx < 0 ? -2 : curridx;
return DEMUXER_CTRL_OK; return DEMUXER_CTRL_OK;
} else { } else {
ds_free_packs(ds); ds_free_packs(ds);