2015-02-17 22:46:12 +00:00
|
|
|
#ifndef MP_TIMELINE_H_
|
|
|
|
#define MP_TIMELINE_H_
|
|
|
|
|
2020-02-15 17:09:28 +00:00
|
|
|
#include "common/common.h"
|
|
|
|
|
demux_edl, cue, mkv: clean up timeline stuff slightly
Remove the singly linked list hack, replace it with a slightly more
proper data structure. This probably gets rid of a few minor bugs along
the way, caused by the awkward nonsensical sharing/duplication of some
fields.
Another change (because I'm touching everything related to timeline
anyway) is that I'm removing the special semantics for parts[num_parts].
This is now strictly out of bounds, and instead of using the start time
of the next/beyond-last part, there is an end time field now.
Unfortunately, this also requires touching the code for cue and mkv
ordered chapters. From some superficial testing, they still seem to
mostly work.
One observable change is that the "no_chapters" header is per-stream
now, which is arguably more correct, and getting the old behavior would
require adding code to handle it as special-case, so just adjust
ytdl_hook.lua to the new behavior.
2019-01-11 12:52:29 +00:00
|
|
|
// Single segment in a timeline.
|
2015-02-17 22:46:12 +00:00
|
|
|
struct timeline_part {
|
demux_edl, cue, mkv: clean up timeline stuff slightly
Remove the singly linked list hack, replace it with a slightly more
proper data structure. This probably gets rid of a few minor bugs along
the way, caused by the awkward nonsensical sharing/duplication of some
fields.
Another change (because I'm touching everything related to timeline
anyway) is that I'm removing the special semantics for parts[num_parts].
This is now strictly out of bounds, and instead of using the start time
of the next/beyond-last part, there is an end time field now.
Unfortunately, this also requires touching the code for cue and mkv
ordered chapters. From some superficial testing, they still seem to
mostly work.
One observable change is that the "no_chapters" header is per-stream
now, which is arguably more correct, and getting the old behavior would
require adding code to handle it as special-case, so just adjust
ytdl_hook.lua to the new behavior.
2019-01-11 12:52:29 +00:00
|
|
|
// (end time must match with start time of the next part)
|
|
|
|
double start, end;
|
2015-02-17 22:46:12 +00:00
|
|
|
double source_start;
|
2017-01-30 18:38:43 +00:00
|
|
|
char *url;
|
2015-02-17 22:46:12 +00:00
|
|
|
struct demuxer *source;
|
|
|
|
};
|
|
|
|
|
demux_edl, cue, mkv: clean up timeline stuff slightly
Remove the singly linked list hack, replace it with a slightly more
proper data structure. This probably gets rid of a few minor bugs along
the way, caused by the awkward nonsensical sharing/duplication of some
fields.
Another change (because I'm touching everything related to timeline
anyway) is that I'm removing the special semantics for parts[num_parts].
This is now strictly out of bounds, and instead of using the start time
of the next/beyond-last part, there is an end time field now.
Unfortunately, this also requires touching the code for cue and mkv
ordered chapters. From some superficial testing, they still seem to
mostly work.
One observable change is that the "no_chapters" header is per-stream
now, which is arguably more correct, and getting the old behavior would
require adding code to handle it as special-case, so just adjust
ytdl_hook.lua to the new behavior.
2019-01-11 12:52:29 +00:00
|
|
|
// 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;
|
2020-02-15 17:09:28 +00:00
|
|
|
bool dash, no_clip, delay_open;
|
|
|
|
|
|
|
|
// If non-NULL, _some_ fields are used. If delay_open==true, this must be
|
|
|
|
// set, and the codec info is used.
|
|
|
|
struct sh_stream *sh_meta;
|
demux_edl, cue, mkv: clean up timeline stuff slightly
Remove the singly linked list hack, replace it with a slightly more
proper data structure. This probably gets rid of a few minor bugs along
the way, caused by the awkward nonsensical sharing/duplication of some
fields.
Another change (because I'm touching everything related to timeline
anyway) is that I'm removing the special semantics for parts[num_parts].
This is now strictly out of bounds, and instead of using the start time
of the next/beyond-last part, there is an end time field now.
Unfortunately, this also requires touching the code for cue and mkv
ordered chapters. From some superficial testing, they still seem to
mostly work.
One observable change is that the "no_chapters" header is per-stream
now, which is arguably more correct, and getting the old behavior would
require adding code to handle it as special-case, so just adjust
ytdl_hook.lua to the new behavior.
2019-01-11 12:52:29 +00:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
};
|
|
|
|
|
2015-02-17 22:46:12 +00:00
|
|
|
struct timeline {
|
|
|
|
struct mpv_global *global;
|
|
|
|
struct mp_log *log;
|
2015-02-20 21:08:02 +00:00
|
|
|
struct mp_cancel *cancel;
|
2015-02-17 22:46:12 +00:00
|
|
|
|
2019-10-08 21:55:05 +00:00
|
|
|
bool is_network, is_streaming;
|
stream, demux: redo origin policy thing
mpv has a very weak and very annoying policy that determines whether a
playlist should be used or not. For example, if you play a remote
playlist, you usually don't want it to be able to read local filesystem
entries. (Although for a media player the impact is small I guess.)
It's weak and annoying as in that it does not prevent certain cases
which could be interpreted as bad in some cases, such as allowing
playlists on the local filesystem to reference remote URLs. It probably
barely makes sense, but we just want to exclude some other "definitely
not a good idea" things, all while playlists generally just work, so
whatever.
The policy is:
- from the command line anything is played
- local playlists can reference anything except "unsafe" streams
("unsafe" means special stream inputs like libavfilter graphs)
- remote playlists can reference only remote URLs
- things like "memory://" and archives are "transparent" to this
This commit does... something. It replaces the weird stream flags with a
slightly clearer "origin" value, which is now consequently passed down
and used everywhere. It fixes some deviations from the described policy.
I wanted to force archives to reference only content within them, but
this would probably have been more complicated (or required different
abstractions), and I'm too lazy to figure it out, so archives are now
"transparent" (playlists within archives behave the same outside).
There may be a lot of bugs in this.
This is unfortunately a very noisy commit because:
- every stream open call now needs to pass the origin
- so does every demuxer open call (=> params param. gets mandatory)
- most stream were changed to provide the "origin" value
- the origin value needed to be passed along in a lot of places
- I was too lazy to split the commit
Fixes: #7274
2019-12-20 08:41:42 +00:00
|
|
|
int stream_origin;
|
2019-01-11 13:10:41 +00:00
|
|
|
const char *format;
|
|
|
|
|
demux_edl, cue, mkv: clean up timeline stuff slightly
Remove the singly linked list hack, replace it with a slightly more
proper data structure. This probably gets rid of a few minor bugs along
the way, caused by the awkward nonsensical sharing/duplication of some
fields.
Another change (because I'm touching everything related to timeline
anyway) is that I'm removing the special semantics for parts[num_parts].
This is now strictly out of bounds, and instead of using the start time
of the next/beyond-last part, there is an end time field now.
Unfortunately, this also requires touching the code for cue and mkv
ordered chapters. From some superficial testing, they still seem to
mostly work.
One observable change is that the "no_chapters" header is per-stream
now, which is arguably more correct, and getting the old behavior would
require adding code to handle it as special-case, so just adjust
ytdl_hook.lua to the new behavior.
2019-01-11 12:52:29 +00:00
|
|
|
// main source, and all other sources (this usually only has special meaning
|
|
|
|
// for memory management; mostly compensates for the lack of refcounting)
|
2015-02-17 22:46:12 +00:00
|
|
|
struct demuxer *demuxer;
|
|
|
|
struct demuxer **sources;
|
|
|
|
int num_sources;
|
|
|
|
|
demux_edl, cue, mkv: clean up timeline stuff slightly
Remove the singly linked list hack, replace it with a slightly more
proper data structure. This probably gets rid of a few minor bugs along
the way, caused by the awkward nonsensical sharing/duplication of some
fields.
Another change (because I'm touching everything related to timeline
anyway) is that I'm removing the special semantics for parts[num_parts].
This is now strictly out of bounds, and instead of using the start time
of the next/beyond-last part, there is an end time field now.
Unfortunately, this also requires touching the code for cue and mkv
ordered chapters. From some superficial testing, they still seem to
mostly work.
One observable change is that the "no_chapters" header is per-stream
now, which is arguably more correct, and getting the old behavior would
require adding code to handle it as special-case, so just adjust
ytdl_hook.lua to the new behavior.
2019-01-11 12:52:29 +00:00
|
|
|
// Description of timeline ranges, possibly multiple parallel ones.
|
|
|
|
struct timeline_par **pars;
|
|
|
|
int num_pars;
|
2015-02-17 22:46:12 +00:00
|
|
|
|
|
|
|
struct demux_chapter *chapters;
|
|
|
|
int num_chapters;
|
|
|
|
|
demux_edl, cue, mkv: clean up timeline stuff slightly
Remove the singly linked list hack, replace it with a slightly more
proper data structure. This probably gets rid of a few minor bugs along
the way, caused by the awkward nonsensical sharing/duplication of some
fields.
Another change (because I'm touching everything related to timeline
anyway) is that I'm removing the special semantics for parts[num_parts].
This is now strictly out of bounds, and instead of using the start time
of the next/beyond-last part, there is an end time field now.
Unfortunately, this also requires touching the code for cue and mkv
ordered chapters. From some superficial testing, they still seem to
mostly work.
One observable change is that the "no_chapters" header is per-stream
now, which is arguably more correct, and getting the old behavior would
require adding code to handle it as special-case, so just adjust
ytdl_hook.lua to the new behavior.
2019-01-11 12:52:29 +00:00
|
|
|
// global tags, attachments, editions
|
|
|
|
struct demuxer *meta;
|
2015-02-17 22:46:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct timeline *timeline_load(struct mpv_global *global, struct mp_log *log,
|
|
|
|
struct demuxer *demuxer);
|
|
|
|
void timeline_destroy(struct timeline *tl);
|
|
|
|
|
|
|
|
#endif
|