diff options
author | Viliam Mateicka <viliam.mateicka@gmail.com> | 2009-01-20 17:22:45 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-21 06:44:57 +0100 |
commit | 17222e95615eab116893d29a7fc78ea63b18f968 (patch) | |
tree | 0eea2bd554e8423a26d8d3a7a62689f78eb19537 /src/archive | |
parent | 1379db379d2ac5ebb878c2323622513fdca5cd82 (diff) | |
download | mpd-17222e95615eab116893d29a7fc78ea63b18f968.tar.gz mpd-17222e95615eab116893d29a7fc78ea63b18f968.tar.xz mpd-17222e95615eab116893d29a7fc78ea63b18f968.zip |
archiveapi: adding seeking support in zip archives
Diffstat (limited to '')
-rw-r--r-- | src/archive/zip_plugin.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/archive/zip_plugin.c b/src/archive/zip_plugin.c index 1aa311065..d318adc06 100644 --- a/src/archive/zip_plugin.c +++ b/src/archive/zip_plugin.c @@ -111,8 +111,8 @@ zip_setup_stream(struct archive_file *file, struct input_stream *is) is->plugin = &zip_inputplugin; //insert back reference is->archive = context; - //we are not seekable - is->seekable = false; + //we are seekable (but its not recommendent to do so) + is->seekable = true; } @@ -163,6 +163,12 @@ static bool zip_is_seek(G_GNUC_UNUSED struct input_stream *is, G_GNUC_UNUSED off_t offset, G_GNUC_UNUSED int whence) { + zip_context *context = (zip_context *) is->archive; + zzip_off_t ofs = zzip_seek(context->file, offset, whence); + if (ofs != -1) { + is->offset = ofs; + return true; + } return false; } |