summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-09-07 21:58:46 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:04 +0200
commitb298140b07842bd3573866564ad30ddfef65638c (patch)
tree0239561d157e4c8e5fd62c73bfde6eb46bdf2047 /player
parentf77515ebafb9fdfd177671b848211824e654206f (diff)
downloadmpv-b298140b07842bd3573866564ad30ddfef65638c.tar.bz2
mpv-b298140b07842bd3573866564ad30ddfef65638c.tar.xz
demux: return stream file size differently, rip out stream ctrls
The stream size return was the only thing that still required doing STREAM_CTRLs from frontend through the demuxer layer. This can be done much easier, so rip it out. Also rip out the now unused infrastructure for STREAM_CTRLs via demuxer layer.
Diffstat (limited to 'player')
-rw-r--r--player/command.c4
-rw-r--r--player/playloop.c8
2 files changed, 4 insertions, 8 deletions
diff --git a/player/command.c b/player/command.c
index dacdbed3f8..3621fae90c 100644
--- a/player/command.c
+++ b/player/command.c
@@ -557,9 +557,7 @@ static int mp_property_file_size(void *ctx, struct m_property *prop,
if (!mpctx->demuxer)
return M_PROPERTY_UNAVAILABLE;
- int64_t size;
- if (demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_SIZE, &size) < 1)
- return M_PROPERTY_UNAVAILABLE;
+ int64_t size = mpctx->demuxer->filesize;
if (action == M_PROPERTY_PRINT) {
*(char **)arg = format_file_size(size);
diff --git a/player/playloop.c b/player/playloop.c
index 85cc9f7faf..0326e32779 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -519,11 +519,9 @@ double get_current_pos_ratio(struct MPContext *mpctx, bool use_range)
if (len > 0)
ans = MPCLAMP((pos - start) / len, 0, 1);
if (ans < 0 || demuxer->ts_resets_possible) {
- int64_t size;
- if (demux_stream_control(demuxer, STREAM_CTRL_GET_SIZE, &size) > 0) {
- if (size > 0 && demuxer->filepos >= 0)
- ans = MPCLAMP(demuxer->filepos / (double)size, 0, 1);
- }
+ int64_t size = demuxer->filesize;
+ if (size > 0 && demuxer->filepos >= 0)
+ ans = MPCLAMP(demuxer->filepos / (double)size, 0, 1);
}
if (use_range) {
if (mpctx->opts->play_frames > 0)