From 13482fb397ce6bbcec8a9342015f21d48fb7efe6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 19 Aug 2012 18:07:06 +0200 Subject: core: refactor MPContext.demuxer field accesses Whenever the demuxer is accessed to retrieve metadata, use the newly introduced master_demuxer field instead. If a timeline is used, the master_demuxer will still refer to the main file, instead to segments. Instead of mpctx->demuxer->stream, access mpctx->stream; even though they are the same, the code becomes shorter. For the TV code, introduce a function get_tvh() to access the TV handle, instead of duplicating the code all over the place. Often the demuxer field is checked to determine whether something is currently played; prefer other methods over that. Note that the code before always accessed the current timeline segment, and would e.g. read file metadata of the current segment. Now it always returns metadata for the master file. This may have various wanted and unwanted effects. --- mp_core.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mp_core.h') diff --git a/mp_core.h b/mp_core.h index 47d7d6cbbb..6eea692acd 100644 --- a/mp_core.h +++ b/mp_core.h @@ -115,6 +115,11 @@ typedef struct MPContext { struct demux_stream *d_audio; struct demux_stream *d_video; struct demux_stream *d_sub; + + // Uses: accessing metadata (consider ordered chapters case, where the main + // demuxer defines metadata), or special purpose demuxers like TV. + struct demuxer *master_demuxer; + mixer_t mixer; struct ao *ao; struct vo *video_out; -- cgit v1.2.3