summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-01-11 12:07:55 +0100
committerwm4 <wm4@nowhere>2019-09-19 20:37:04 +0200
commit19422f0eea7fbc4c9c02ac16d832a667f4a1be7c (patch)
treea9d1768ed7e65f65331b2fb7806e97a2321c7a4c /demux
parent7498fa0b3d50d9a8b0f63568b5c5dd88795b596d (diff)
downloadmpv-19422f0eea7fbc4c9c02ac16d832a667f4a1be7c.tar.bz2
mpv-19422f0eea7fbc4c9c02ac16d832a667f4a1be7c.tar.xz
demux_edl: add no_clip
Used by the next commit. It mostly exposes part of mp4_dash functionality. It actually makes little sense other than for ytdl special-use. See next commit.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_edl.c5
-rw-r--r--demux/demux_timeline.c13
-rw-r--r--demux/timeline.h2
3 files changed, 12 insertions, 8 deletions
diff --git a/demux/demux_edl.c b/demux/demux_edl.c
index 882af417e7..bfd5cb6dad 100644
--- a/demux/demux_edl.c
+++ b/demux/demux_edl.c
@@ -46,7 +46,7 @@ struct tl_part {
struct tl_parts {
bool disable_chapters;
- bool dash;
+ bool dash, no_clip;
char *init_fragment_url;
struct tl_part *parts;
int num_parts;
@@ -150,6 +150,8 @@ static struct tl_parts *parse_edl(bstr str)
tl->dash = true;
if (f_init.len)
tl->init_fragment_url = bstrto0(tl, f_init);
+ } else if (bstr_equals0(f_type, "no_clip")) {
+ tl->no_clip = true;
} else if (bstr_equals0(f_type, "new_stream")) {
struct tl_parts *ntl = talloc_zero(tl, struct tl_parts);
tl->next = ntl;
@@ -238,6 +240,7 @@ static void build_timeline(struct timeline *tl, struct tl_parts *parts)
{
tl->track_layout = NULL;
tl->dash = parts->dash;
+ tl->no_clip = parts->no_clip;
if (parts->init_fragment_url && parts->init_fragment_url[0]) {
MP_VERBOSE(tl, "Opening init fragment...\n");
diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c
index 33e5cbb7fd..b61fb11c28 100644
--- a/demux/demux_timeline.c
+++ b/demux/demux_timeline.c
@@ -56,7 +56,7 @@ struct virtual_stream {
struct virtual_source {
struct timeline *tl;
- bool dash;
+ bool dash, no_clip;
struct segment **segments;
int num_segments;
@@ -235,9 +235,9 @@ static void switch_segment(struct demuxer *demuxer, struct virtual_source *src,
if (!new->d)
return;
reselect_streams(demuxer);
- if (!src->dash)
+ if (!src->no_clip)
demux_set_ts_offset(new->d, new->start - new->d_start);
- if (!src->dash || !init)
+ if (!src->no_clip || !init)
demux_seek(new->d, start_pts, flags);
for (int n = 0; n < src->num_streams; n++) {
@@ -304,7 +304,7 @@ static bool d_read_packet(struct demuxer *demuxer, struct demux_packet **out_pkt
assert(seg && seg->d);
struct demux_packet *pkt = demux_read_any_packet(seg->d);
- if (!pkt || (!src->dash && pkt->pts >= seg->end))
+ if (!pkt || (!src->no_clip && pkt->pts >= seg->end))
src->eos_packets += 1;
update_slave_stats(demuxer, seg->d);
@@ -351,7 +351,7 @@ static bool d_read_packet(struct demuxer *demuxer, struct demux_packet **out_pkt
if (pkt->stream < 0 || pkt->stream >= seg->num_stream_map)
goto drop;
- if (!src->dash) {
+ if (!src->no_clip) {
pkt->segmented = true;
if (!pkt->codec)
pkt->codec = demux_get_stream(seg->d, pkt->stream)->codec;
@@ -370,7 +370,7 @@ static bool d_read_packet(struct demuxer *demuxer, struct demux_packet **out_pkt
if (pkt->pos >= 0)
pkt->pos |= (seg->index & 0x7FFFULL) << 48;
- if (pkt->pts != MP_NOPTS_VALUE && !src->dash && pkt->pts >= seg->end) {
+ if (pkt->pts != MP_NOPTS_VALUE && !src->no_clip && pkt->pts >= seg->end) {
// Trust the keyframe flag. Might not always be a good idea, but will
// be sufficient at least with mkv. The problem is that this flag is
// not well-defined in libavformat and is container-dependent.
@@ -475,6 +475,7 @@ static void add_tl(struct demuxer *demuxer, struct timeline *tl)
*src = (struct virtual_source){
.tl = tl,
.dash = tl->dash,
+ .no_clip = tl->no_clip || tl->dash,
.dts = MP_NOPTS_VALUE,
};
diff --git a/demux/timeline.h b/demux/timeline.h
index 69d93a4a2e..0940592aea 100644
--- a/demux/timeline.h
+++ b/demux/timeline.h
@@ -17,7 +17,7 @@ struct timeline {
struct demuxer *demuxer;
bstr init_fragment;
- bool dash;
+ bool dash, no_clip;
// All referenced files.
struct demuxer **sources;