From e01bbad7bb9fd38af758a767af6f9df572f7c0e8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 27 Jan 2020 20:48:49 +0100 Subject: [PATCH] lib/xiph/OggVisitor: update the OggStreamState offset --- src/decoder/plugins/OggDecoder.cxx | 2 +- src/lib/xiph/OggVisitor.cxx | 3 ++- src/lib/xiph/OggVisitor.hxx | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/decoder/plugins/OggDecoder.cxx b/src/decoder/plugins/OggDecoder.cxx index 2dec9913a..871946866 100644 --- a/src/decoder/plugins/OggDecoder.cxx +++ b/src/decoder/plugins/OggDecoder.cxx @@ -72,7 +72,7 @@ inline void OggDecoder::SeekByte(offset_type offset) { input_stream.LockSeek(offset); - PostSeek(); + PostSeek(offset); } void diff --git a/src/lib/xiph/OggVisitor.cxx b/src/lib/xiph/OggVisitor.cxx index f52bf7e5a..153d20b7d 100644 --- a/src/lib/xiph/OggVisitor.cxx +++ b/src/lib/xiph/OggVisitor.cxx @@ -94,9 +94,10 @@ OggVisitor::Visit() } void -OggVisitor::PostSeek() +OggVisitor::PostSeek(uint64_t offset) { sync.Reset(); + sync.SetOffset(offset); /* reset the stream to clear any previous partial packet data */ diff --git a/src/lib/xiph/OggVisitor.hxx b/src/lib/xiph/OggVisitor.hxx index 3f72ebdf8..fd21313a6 100644 --- a/src/lib/xiph/OggVisitor.hxx +++ b/src/lib/xiph/OggVisitor.hxx @@ -53,12 +53,18 @@ public: return stream.GetSerialNo(); } + uint64_t GetStartOffset() const noexcept { + return sync.GetStartOffset(); + } + void Visit(); /** * Call this method after seeking the #Reader. + * + * @param offset the current #Reader offset */ - void PostSeek(); + void PostSeek(uint64_t offset); private: void EndStream();