diff options
author | wm4 <wm4@nowhere> | 2015-05-26 14:01:23 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-26 14:01:23 +0200 |
commit | 88249baf5bb66e164b17bc53e10441c3c3111e45 (patch) | |
tree | 0157e34bc549da73fdcd08a7c8c1b8666d8afad0 /player/core.h | |
parent | bdcd25d3c23b49704f3abe78dc0c523f20a71d45 (diff) | |
download | mpv-88249baf5bb66e164b17bc53e10441c3c3111e45.tar.bz2 mpv-88249baf5bb66e164b17bc53e10441c3c3111e45.tar.xz |
player: fix crashes when adding external tracks before loading main file
Adding an external audio track before loading the main file didn't work
right. For one, mp_switch_track() assumes it is called after the main
file is loaded. (The difference is that decoders are only initialized
once the main file is loaded, and we avoid doing this before that for
whatever reason.)
To avoid further messiness, just allow mp_switch_track() to be called at
any time. Also make it do what mp_mark_user_track_selection() did, since
the latter requires current_track to be set. (One could probably simply
allow current_track to be set at this point, but it'd interfere with
default track selection anyway and thus would be pointless.)
Fixes #1984.
Diffstat (limited to 'player/core.h')
-rw-r--r-- | player/core.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/player/core.h b/player/core.h index 2ae6a4ae65..7c9c13c257 100644 --- a/player/core.h +++ b/player/core.h @@ -381,13 +381,12 @@ bool mp_nav_mouse_on_button(struct MPContext *mpctx); void uninit_player(struct MPContext *mpctx, unsigned int mask); struct track *mp_add_external_file(struct MPContext *mpctx, char *filename, enum stream_type filter); +#define FLAG_MARK_SELECTION 1 void mp_switch_track(struct MPContext *mpctx, enum stream_type type, - struct track *track); + struct track *track, int flags); void mp_switch_track_n(struct MPContext *mpctx, int order, - enum stream_type type, struct track *track); + enum stream_type type, struct track *track, int flags); void mp_deselect_track(struct MPContext *mpctx, struct track *track); -void mp_mark_user_track_selection(struct MPContext *mpctx, int order, - enum stream_type type); struct track *mp_track_by_tid(struct MPContext *mpctx, enum stream_type type, int tid); double timeline_set_from_time(struct MPContext *mpctx, double pts, bool *need_reset); |