summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-03-31 00:11:28 +0300
committerUoti Urpala <uau@mplayer2.org>2011-03-31 03:44:20 +0300
commit5949f5b9fdf70d5341fdc38b14817e1ba111a550 (patch)
tree21fa63a10e29677efc0d7b8f3497e2c9e3a77554 /libmpdemux
parentdf31b077b485da9084609806a92d5be2c37c1359 (diff)
downloadmpv-5949f5b9fdf70d5341fdc38b14817e1ba111a550.tar.bz2
mpv-5949f5b9fdf70d5341fdc38b14817e1ba111a550.tar.xz
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.
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_lavf.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 6a32240ebd..e2fd964ae1 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -865,22 +865,18 @@ static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
}
}
- if(id == -2) { // no sound
- i = -1;
- } else if(id == -1) { // next track
+ if (id == -1) { // next track
i = (curridx + 2) % (nstreams + 1) - 1;
if (i >= 0)
newid = pstreams[i];
- }
- else // select track by id
- {
- if (id >= 0 && id < nstreams) {
- i = id;
- newid = pstreams[i];
- }
- }
+ } else if (id >= 0 && id < nstreams) { // select track by id
+ i = id;
+ newid = pstreams[i];
+ } else // no sound
+ i = -1;
+
if (i == curridx) {
- *(int *) arg = curridx;
+ *(int *) arg = curridx < 0 ? -2 : curridx;
return DEMUXER_CTRL_OK;
} else {
ds_free_packs(ds);