1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-12 09:56:30 +00:00
mpv/demux/timeline.h
wm4 5cbbd25090 demux_timeline, demux_edl: correctly enable cache in pseudo-DASH mode
In pseudo-DASH mode, we may have no real streams opened until the
demuxer layer is fully loaded and playback actually starts. The only
hint that the stream is from network is, at that point, the init
segment, which is only opened as stream, and then separately as demuxer
(which is dumb but happened to fit the internal architecture better).

So just propagate the flags from the init segment stream. Seems like an
annoyance, but doesn't hurt that much I guess. (Until someone gets the
idea to pass the init segment data inline or so, but nothing does that.)

The sample link in the linked issue will probably soon switch to another
format, because that service always does this after recent uploads or
so.

Fixes: #7038
2019-10-08 23:55:05 +02:00

63 lines
1.9 KiB
C

#ifndef MP_TIMELINE_H_
#define MP_TIMELINE_H_
// Single segment in a timeline.
struct timeline_part {
// (end time must match with start time of the next part)
double start, end;
double source_start;
char *url;
struct demuxer *source;
};
// Timeline formed by a single demuxer. Multiple pars are used to get tracks
// that require a separate opened demuxer, such as separate audio tracks. (For
// example, for ordered chapters there is only a single par, because all streams
// demux from the same file at a given time, while for DASH-style video+audio,
// each track would have its own timeline.)
// Note that demuxer instances must not be shared across timeline_pars. This
// would conflict in demux_timeline.c.
// "par" is short for parallel stream.
struct timeline_par {
bstr init_fragment;
bool dash, no_clip;
// Segments to play, ordered by time.
struct timeline_part *parts;
int num_parts;
// Which source defines the overall track list (over the full timeline).
struct demuxer *track_layout;
};
struct timeline {
struct mpv_global *global;
struct mp_log *log;
struct mp_cancel *cancel;
bool is_network, is_streaming;
const char *format;
// main source, and all other sources (this usually only has special meaning
// for memory management; mostly compensates for the lack of refcounting)
struct demuxer *demuxer;
struct demuxer **sources;
int num_sources;
// Description of timeline ranges, possibly multiple parallel ones.
struct timeline_par **pars;
int num_pars;
struct demux_chapter *chapters;
int num_chapters;
// global tags, attachments, editions
struct demuxer *meta;
};
struct timeline *timeline_load(struct mpv_global *global, struct mp_log *log,
struct demuxer *demuxer);
void timeline_destroy(struct timeline *tl);
#endif