diff options
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 11 | ||||
-rw-r--r-- | player/misc.c | 6 | ||||
-rw-r--r-- | player/playloop.c | 9 |
3 files changed, 13 insertions, 13 deletions
diff --git a/player/command.c b/player/command.c index 9c690d38ae..4619062bf5 100644 --- a/player/command.c +++ b/player/command.c @@ -206,12 +206,12 @@ static int mp_property_file_size(m_option_t *prop, int action, void *arg, if (!mpctx->stream) return M_PROPERTY_UNAVAILABLE; - int64_t size = mpctx->stream->end_pos; + int64_t size; + if (stream_control(mpctx->stream, STREAM_CTRL_GET_SIZE, &size) != STREAM_OK) + return M_PROPERTY_UNAVAILABLE; switch (action) { case M_PROPERTY_GET: { - if (size <= 0) - break; *(int64_t *)arg = size; return M_PROPERTY_OK; } @@ -301,10 +301,7 @@ static int mp_property_stream_pos(m_option_t *prop, int action, void *arg, static int mp_property_stream_end(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - struct stream *stream = mpctx->stream; - if (!stream) - return M_PROPERTY_UNAVAILABLE; - return m_property_int64_ro(prop, action, arg, stream->end_pos); + return mp_property_file_size(prop, action, arg, mpctx); } // Does some magic to handle "<name>/full" as time formatted with milliseconds. diff --git a/player/misc.c b/player/misc.c index e3cf70f81e..6eae646242 100644 --- a/player/misc.c +++ b/player/misc.c @@ -169,14 +169,16 @@ void stream_dump(struct MPContext *mpctx) stream_t *stream = mpctx->stream; assert(stream && filename); + int64_t size = 0; + stream_control(stream, STREAM_CTRL_GET_SIZE, &size); + stream_set_capture_file(stream, filename); while (mpctx->stop_play == KEEP_PLAYING && !stream->eof) { if (!opts->quiet && ((stream->pos / (1024 * 1024)) % 2) == 1) { uint64_t pos = stream->pos; - uint64_t end = stream->end_pos; MP_MSG(mpctx, MSGL_STATUS, "Dumping %lld/%lld...", - (long long int)pos, (long long int)end); + (long long int)pos, (long long int)size); } stream_fill_buffer(stream); for (;;) { diff --git a/player/playloop.c b/player/playloop.c index dea78c5571..964f112b6d 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -472,11 +472,12 @@ double get_current_pos_ratio(struct MPContext *mpctx, bool use_range) ans = MPCLAMP((pos - start) / len, 0, 1); } else { struct stream *s = demuxer->stream; - int64_t size = s->end_pos; - int64_t fpos = demuxer->filepos >= 0 ? - demuxer->filepos : stream_tell(demuxer->stream); - if (size > 0) + int64_t size; + if (stream_control(s, STREAM_CTRL_GET_SIZE, &size) > 0 && size > 0) { + int64_t fpos = + demuxer->filepos >= 0 ? demuxer->filepos : stream_tell(s); ans = MPCLAMP(fpos / (double)size, 0, 1); + } } if (use_range) { if (mpctx->opts->play_frames > 0) |