summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-23 12:03:26 +0200
committerwm4 <wm4@nowhere>2014-10-23 12:03:26 +0200
commit41c91d87d6985bba834f082efd5970e68fef3691 (patch)
treef2e64347dfc04fba5a6033f2426b90fd0915ae6a /player
parentdf6435be5024f89b3066d176fbfc304984c750f7 (diff)
downloadmpv-41c91d87d6985bba834f082efd5970e68fef3691.tar.bz2
mpv-41c91d87d6985bba834f082efd5970e68fef3691.tar.xz
command: return error on invalid/absent IDs with ff-sid/ff-aid
Instead of just disabling the stream. Also, check if the selected track has the right type, or we'd crash.
Diffstat (limited to 'player')
-rw-r--r--player/command.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c
index c9f7f18d22..77645d3755 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1683,13 +1683,17 @@ static int property_switch_track_ff(void *ctx, struct m_property *prop,
*(int *) arg = track ? track->ff_index : -2;
return M_PROPERTY_OK;
case M_PROPERTY_SET: {
+ int id = *(int *)arg;
track = NULL;
for (int n = 0; n < mpctx->num_tracks; n++) {
- if (mpctx->tracks[n]->ff_index == *(int *)arg) {
- track = mpctx->tracks[n];
+ struct track *cur = mpctx->tracks[n];
+ if (cur->type == type && cur->ff_index == id) {
+ track = cur;
break;
}
}
+ if (!track && id >= 0)
+ return M_PROPERTY_ERROR;
mp_switch_track_n(mpctx, 0, type, track);
return M_PROPERTY_OK;
}