diff options
author | wm4 <wm4@nowhere> | 2013-12-25 11:24:37 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-25 11:32:29 +0100 |
commit | f7516094500c543349fde0498c41bfcc72f21d2c (patch) | |
tree | 4dc354a22652547a8573bd45218fd43ec387e8d1 /player | |
parent | 3720b3f17d4951ab839418b5cbfd1a85eb74adba (diff) | |
download | mpv-f7516094500c543349fde0498c41bfcc72f21d2c.tar.bz2 mpv-f7516094500c543349fde0498c41bfcc72f21d2c.tar.xz |
player: fix initial selection with --secondary-sid
Also, make sure that a track can't be selected twice. While this might
work in some situations, it certainly won't work with subtitles demuxed
from a stream.
Fixes #425.
Diffstat (limited to 'player')
-rw-r--r-- | player/loadfile.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/player/loadfile.c b/player/loadfile.c index 99b669f109..251112975f 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -607,6 +607,12 @@ void mp_switch_track_n(struct MPContext *mpctx, int order, enum stream_type type if (track == current) return; + if (track && track->selected) { + // Track has been selected in a different order parameter. + MP_ERR(mpctx, "Track %d is already selected.\n", track->user_tid); + return; + } + if (order == 0) { if (type == STREAM_VIDEO) { int uninit = INITIALIZED_VCODEC; @@ -1193,9 +1199,21 @@ goto_reopen_demuxer: ; mpctx->current_track[0][STREAM_SUB] = select_track(mpctx, STREAM_SUB, mpctx->opts->sub_id, mpctx->opts->sub_lang); - for (int t = 0; t < mpctx->num_tracks; t++) { - struct track *track = mpctx->tracks[t]; - track->selected = track == mpctx->current_track[0][track->type]; + mpctx->current_track[1][STREAM_SUB] = + select_track(mpctx, STREAM_SUB, mpctx->opts->sub2_id, NULL); + for (int t = 0; t < STREAM_TYPE_COUNT; t++) { + for (int i = 0; i < NUM_PTRACKS; i++) { + struct track *track = mpctx->current_track[i][t]; + if (track) { + if (track->selected) { + MP_ERR(mpctx, "Track %d can't be selected twice.\n", + track->user_tid); + mpctx->current_track[i][t] = NULL; + } else { + track->selected = true; + } + } + } } reselect_demux_streams(mpctx); |