From b796f2bb7693676056d0de98a9a95258909d799b Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 23 Dec 2013 20:14:54 +0100 Subject: player: redo demuxer stream selection Use struct track to decide what stream to select. Add a "selected" field and use that in some places instead of checking mpctx->current_track. --- player/core.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'player/core.h') diff --git a/player/core.h b/player/core.h index 5b4cc738e5..2f0622de7c 100644 --- a/player/core.h +++ b/player/core.h @@ -108,6 +108,10 @@ enum seek_type { struct track { enum stream_type type; + + // Currently used for decoding. + bool selected; + // The type specific ID, also called aid (audio), sid (subs), vid (video). // For UI purposes only; this ID doesn't have anything to do with any // IDs coming from demuxers or container files. @@ -198,8 +202,6 @@ typedef struct MPContext { // Selected tracks. NULL if no track selected. struct track *current_track[STREAM_TYPE_COUNT]; - struct sh_stream *sh[STREAM_TYPE_COUNT]; - struct dec_video *d_video; struct dec_audio *d_audio; struct dec_sub *d_sub; @@ -367,13 +369,13 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask); struct track *mp_add_subtitles(struct MPContext *mpctx, char *filename); void mp_switch_track(struct MPContext *mpctx, enum stream_type type, struct track *track); +void mp_deselect_track(struct MPContext *mpctx, struct track *track); struct track *mp_track_by_tid(struct MPContext *mpctx, enum stream_type type, int tid); bool timeline_set_part(struct MPContext *mpctx, int i, bool force); double timeline_set_from_time(struct MPContext *mpctx, double pts, bool *need_reset); -struct sh_stream *init_demux_stream(struct MPContext *mpctx, - enum stream_type type); -void cleanup_demux_stream(struct MPContext *mpctx, enum stream_type type); +struct sh_stream *init_demux_stream(struct MPContext *mpctx, struct track *track); +void reselect_demux_streams(struct MPContext *mpctx); void add_demuxer_tracks(struct MPContext *mpctx, struct demuxer *demuxer); bool mp_remove_track(struct MPContext *mpctx, struct track *track); struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction, -- cgit v1.2.3