From 33be4fc94b2c9bc7cbd08e01df0c7d93853300d6 Mon Sep 17 00:00:00 2001 From: Mark Kendall Date: Sun, 12 Jun 2011 18:14:13 +0800 Subject: [PATCH] Disallow seeking in http:// streams. Seeking backwards in http streams will always fail and seeking forward only works on a small minority of files, with no obvious rationale for success. Attempting to allow seeking will almost certainly lead to a raft of user issues once UPnP Media Server support is added. A further fix is needed to disable rewinding and limit fast forward to 3x or less (i.e. avoid actually seeking). Refs #9722 --- mythtv/libs/libmythtv/ringbuffer.h | 5 +++-- mythtv/libs/libmythtv/streamingringbuffer.h | 3 ++- mythtv/libs/libmythtv/tv_play.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/mythtv/libs/libmythtv/ringbuffer.h b/mythtv/libs/libmythtv/ringbuffer.h index dd054c99bc3..63d6864e8f0 100644 --- a/mythtv/libs/libmythtv/ringbuffer.h +++ b/mythtv/libs/libmythtv/ringbuffer.h @@ -69,8 +69,9 @@ class MTV_PUBLIC RingBuffer : protected QThread bool IsNearEnd(double fps, uint vvf) const; /// \brief Returns true if open for either reading or writing. virtual bool IsOpen(void) const = 0; - virtual bool IsStreamed(void) { return LiveMode(); } - virtual int BestBufferSize(void) { return 32768; } + virtual bool IsStreamed(void) { return LiveMode(); } + virtual bool IsSeekingAllowed(void) { return true; } + virtual int BestBufferSize(void) { return 32768; } static QString BitrateToString(uint64_t rate); // DVD and bluray methods diff --git a/mythtv/libs/libmythtv/streamingringbuffer.h b/mythtv/libs/libmythtv/streamingringbuffer.h index 71312d98324..9ad82551ea9 100644 --- a/mythtv/libs/libmythtv/streamingringbuffer.h +++ b/mythtv/libs/libmythtv/streamingringbuffer.h @@ -19,7 +19,8 @@ class StreamingRingBuffer : public RingBuffer uint retry_ms = kDefaultOpenTimeout); virtual long long Seek(long long pos, int whence, bool has_lock); virtual long long GetRealFileSize(void) const; - virtual bool IsStreamed(void) { return true; } + virtual bool IsStreamed(void) { return true; } + virtual bool IsSeekingAllowed(void) { return false; } protected: virtual int safe_read(void *data, uint sz); diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp index 807b09c351f..0b81a1974d7 100644 --- a/mythtv/libs/libmythtv/tv_play.cpp +++ b/mythtv/libs/libmythtv/tv_play.cpp @@ -5456,6 +5456,12 @@ bool TV::DoPlayerSeek(PlayerContext *ctx, float time) return false; } + if (!ctx->buffer->IsSeekingAllowed()) + { + ctx->UnlockDeletePlayer(__FILE__, __LINE__); + return false; + } + if (ctx == GetPlayer(ctx, 0)) PauseAudioUntilBuffered(ctx);