summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-05-31 18:40:24 +0200
committerMax Kellermann <max@musicpd.org>2020-09-07 21:13:28 +0200
commitb2ae5298a765f83dd142564adfdcaf5b2d34ff52 (patch)
tree0005bc6ceb72c43bfa2a28e385cf7ae10fed9bda
parent17dd21ac7fc0667121f72e6ddc0a2b90d33b28ad (diff)
archive/iso9660: implement seeking
-rw-r--r--NEWS1
-rw-r--r--src/archive/plugins/Iso9660ArchivePlugin.cxx8
2 files changed, 9 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index b80e5b19c..207c28226 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ ver 0.21.26 (not yet released)
- bzip2: fix crash on corrupt bzip2 file
- bzip2: flush output at end of input file
- iso9660: fix unaligned reads
+ - iso9660: support seeking
- zzip: fix crash on corrupt ZIP file
* decoder
- sndfile: fix lost samples at end of file
diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx
index f81f6fd98..be319d2a7 100644
--- a/src/archive/plugins/Iso9660ArchivePlugin.cxx
+++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx
@@ -198,12 +198,20 @@ public:
lsn(_lsn)
{
size = _size;
+ seekable = true;
SetReady();
}
/* virtual methods from InputStream */
bool IsEOF() noexcept override;
size_t Read(void *ptr, size_t size) override;
+
+ void Seek(offset_type new_offset) override {
+ if (new_offset > size)
+ throw std::runtime_error("Invalid seek offset");
+
+ offset = new_offset;
+ }
};
InputStreamPtr