1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 21:06:00 +00:00
mpv/demux/timeline.h
wm4 a0a089f6a4 player: use a separate context for timeline loader stuff
Instead of accessing MPContext in player/timeline/*, create a separate
context struct, which the timeline loaders fill out. It turns out that
there's not much in the way too big MPContext that these need to access.

One major PITA is managing (and closing) the set of open demuxers. The
problem is that we need a list of all demuxers to make sure no unneeded
streams are enabled.

This adds a callback to the demuxer_desc struct, with the intention of
leaving to to the demuxer to call the right loader, instead of
explicitly checking the demuxer type and dispatching manually in common
code. I also considered making the timeline part of the demuxer state,
but decided against: it's too much of a mess wrt. memory management and
threading, and also doesn't make it clear who owns the child demuxers.
With the struct timeline decoupled from the demuxer state, it's at least
somewhat clear that the child demuxers are independent from the "main"
demuxer.

The actual changes to player/timeline/* are separated in the following
commits, because they're quite verbose. Some artifacts will be removed
later as soon as there's only 1 timeline loading mechanism.
2015-02-17 23:46:12 +01:00

38 lines
943 B
C

#ifndef MP_TIMELINE_H_
#define MP_TIMELINE_H_
struct timeline_part {
double start;
double source_start;
struct demuxer *source;
};
struct timeline {
struct mpv_global *global;
struct mp_log *log;
// main source
struct demuxer *demuxer;
// All referenced files. The source file must be at sources[0].
struct demuxer **sources;
int num_sources;
// Segments to play, ordered by time. parts[num_parts] must be valid; its
// start field sets the duration, and source must be NULL.
struct timeline_part *parts;
int num_parts;
struct demux_chapter *chapters;
int num_chapters;
// Which source defines the overall track list (over the full timeline).
struct demuxer *track_layout;
};
struct timeline *timeline_load(struct mpv_global *global, struct mp_log *log,
struct demuxer *demuxer);
void timeline_destroy(struct timeline *tl);
#endif