mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
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.
This commit is contained in:
parent
df6435be50
commit
41c91d87d6
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user