From 7387766445f7aae47a4e8095128ea9b688299091 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 9 Mar 2016 23:34:04 +0100 Subject: command: change stream-pos semantics Changing the byte stream position without cooperation of the demuxer seems a bit insane, and is certainly useless. A user should do factor seeks instead. For formats like ts, this will actually translate to byte seeks, while treating the rest of the playback chain a bit more gracefully. With this argument, remove write access to this property. If someone really complains, proper byte seeks could be added as seek mode (although I'm going to need a convincing argument for this). Read access changes too, but in a more subtle way. --- player/command.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 42938af140..fe2eb3eb22 100644 --- a/player/command.c +++ b/player/command.c @@ -458,24 +458,14 @@ static int mp_property_file_format(void *ctx, struct m_property *prop, return m_property_strdup_ro(action, arg, name); } -/// Position in the stream (RW) static int mp_property_stream_pos(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; struct demuxer *demuxer = mpctx->demuxer; - if (!demuxer) + if (!demuxer || demuxer->filepos < 0) return M_PROPERTY_UNAVAILABLE; - demux_pause(demuxer); - int r; - if (action == M_PROPERTY_SET) { - stream_seek(demuxer->stream, *(int64_t *) arg); - r = M_PROPERTY_OK; - } else { - r = m_property_int64_ro(action, arg, stream_tell(demuxer->stream)); - } - demux_unpause(demuxer); - return r; + return m_property_int64_ro(action, arg, demuxer->filepos); } /// Stream end offset (RO) -- cgit v1.2.3