summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c3
-rw-r--r--demux/demux.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c
index c62c0754b8..94b230a6dc 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -1176,6 +1176,7 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg)
.eof = in->last_eof,
.idle = in->idle,
.ts_range = {MP_NOPTS_VALUE, MP_NOPTS_VALUE},
+ .ts_duration = -1,
};
for (int n = 0; n < in->d_user->num_streams; n++) {
struct demux_stream *ds = in->d_user->streams[n]->ds;
@@ -1186,6 +1187,8 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg)
}
}
r->idle = (r->idle && !r->underrun) || r->eof;
+ if (r->ts_range[0] != MP_NOPTS_VALUE && r->ts_range[1] != MP_NOPTS_VALUE)
+ r->ts_duration = r->ts_range[1] - r->ts_range[0];
return DEMUXER_CTRL_OK;
}
}
diff --git a/demux/demux.h b/demux/demux.h
index d0f70c6f57..20e6b8a15e 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -60,6 +60,7 @@ enum demux_ctrl {
struct demux_ctrl_reader_state {
bool eof, underrun, idle;
double ts_range[2]; // start, end
+ double ts_duration;
};
struct demux_ctrl_stream_ctrl {