diff options
author | Max Kellermann <max@duempel.org> | 2013-10-17 09:43:55 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-17 10:45:10 +0200 |
commit | 05de2e998c7df2757ae63ce6a053e27eca3d13ca (patch) | |
tree | 2c85c43cb69dc2dc7086bfddc66090928cd0d93f /src/input | |
parent | 24780d99e61af44141e8f0d0d0776a1c994e6770 (diff) | |
download | mpd-05de2e998c7df2757ae63ce6a053e27eca3d13ca.tar.gz mpd-05de2e998c7df2757ae63ce6a053e27eca3d13ca.tar.xz mpd-05de2e998c7df2757ae63ce6a053e27eca3d13ca.zip |
InputStream: use int64_t instead of goffset
Decouple some more from GLib.
Diffstat (limited to '')
-rw-r--r-- | src/input/CdioParanoiaInputPlugin.cxx | 2 | ||||
-rw-r--r-- | src/input/CurlInputPlugin.cxx | 7 | ||||
-rw-r--r-- | src/input/FfmpegInputPlugin.cxx | 5 | ||||
-rw-r--r-- | src/input/FileInputPlugin.cxx | 5 | ||||
-rw-r--r-- | src/input/RewindInputPlugin.cxx | 8 |
5 files changed, 17 insertions, 10 deletions
diff --git a/src/input/CdioParanoiaInputPlugin.cxx b/src/input/CdioParanoiaInputPlugin.cxx index d441ed818..654a6dc4a 100644 --- a/src/input/CdioParanoiaInputPlugin.cxx +++ b/src/input/CdioParanoiaInputPlugin.cxx @@ -250,7 +250,7 @@ input_cdio_open(const char *uri, static bool input_cdio_seek(struct input_stream *is, - goffset offset, int whence, Error &error) + InputPlugin::offset_type offset, int whence, Error &error) { CdioParanoiaInputStream *cis = (CdioParanoiaInputStream *)is; diff --git a/src/input/CurlInputPlugin.cxx b/src/input/CurlInputPlugin.cxx index 5a89fc1fd..6f11153ec 100644 --- a/src/input/CurlInputPlugin.cxx +++ b/src/input/CurlInputPlugin.cxx @@ -780,7 +780,7 @@ input_curl_read(struct input_stream *is, void *ptr, size_t size, if (c->icy.IsDefined()) copy_icy_tag(c); - is->offset += (goffset)nbytes; + is->offset += (InputPlugin::offset_type)nbytes; if (c->paused && curl_total_buffer_size(c) < CURL_RESUME_AT) { c->base.mutex.unlock(); @@ -977,7 +977,8 @@ input_curl_easy_init(struct input_curl *c, Error &error) } static bool -input_curl_seek(struct input_stream *is, goffset offset, int whence, +input_curl_seek(struct input_stream *is, InputPlugin::offset_type offset, + int whence, Error &error) { struct input_curl *c = (struct input_curl *)is; @@ -1022,7 +1023,7 @@ input_curl_seek(struct input_stream *is, goffset offset, int whence, while (offset > is->offset && !c->buffers.empty()) { auto &buffer = c->buffers.front(); size_t length = buffer.Available(); - if (offset - is->offset < (goffset)length) + if (offset - is->offset < (InputPlugin::offset_type)length) length = offset - is->offset; const bool empty = !buffer.Consume(length); diff --git a/src/input/FfmpegInputPlugin.cxx b/src/input/FfmpegInputPlugin.cxx index e6eeaa8fc..0d9cf6b8f 100644 --- a/src/input/FfmpegInputPlugin.cxx +++ b/src/input/FfmpegInputPlugin.cxx @@ -34,6 +34,8 @@ extern "C" { #include <libavformat/avformat.h> } +#include <glib.h> + struct FfmpegInputStream { struct input_stream base; @@ -146,7 +148,8 @@ input_ffmpeg_eof(struct input_stream *is) } static bool -input_ffmpeg_seek(struct input_stream *is, goffset offset, int whence, +input_ffmpeg_seek(struct input_stream *is, InputPlugin::offset_type offset, + int whence, Error &error) { FfmpegInputStream *i = (FfmpegInputStream *)is; diff --git a/src/input/FileInputPlugin.cxx b/src/input/FileInputPlugin.cxx index 221dbff84..f52b1cd14 100644 --- a/src/input/FileInputPlugin.cxx +++ b/src/input/FileInputPlugin.cxx @@ -97,12 +97,13 @@ input_file_open(const char *filename, } static bool -input_file_seek(struct input_stream *is, goffset offset, int whence, +input_file_seek(struct input_stream *is, InputPlugin::offset_type offset, + int whence, Error &error) { FileInputStream *fis = (FileInputStream *)is; - offset = (goffset)lseek(fis->fd, (off_t)offset, whence); + offset = (InputPlugin::offset_type)lseek(fis->fd, (off_t)offset, whence); if (offset < 0) { error.SetErrno("Failed to seek"); return false; diff --git a/src/input/RewindInputPlugin.cxx b/src/input/RewindInputPlugin.cxx index 2088d8eea..567fb6888 100644 --- a/src/input/RewindInputPlugin.cxx +++ b/src/input/RewindInputPlugin.cxx @@ -164,7 +164,7 @@ input_rewind_read(struct input_stream *is, void *ptr, size_t size, size_t nbytes = r->input->Read(ptr, size, error); - if (r->input->offset > (goffset)sizeof(r->buffer)) + if (r->input->offset > (InputPlugin::offset_type)sizeof(r->buffer)) /* disable buffering */ r->tail = 0; else if (r->tail == (size_t)is->offset) { @@ -191,14 +191,16 @@ input_rewind_eof(struct input_stream *is) } static bool -input_rewind_seek(struct input_stream *is, goffset offset, int whence, +input_rewind_seek(struct input_stream *is, InputPlugin::offset_type offset, + int whence, Error &error) { RewindInputStream *r = (RewindInputStream *)is; assert(is->ready); - if (whence == SEEK_SET && r->tail > 0 && offset <= (goffset)r->tail) { + if (whence == SEEK_SET && r->tail > 0 && + offset <= (InputPlugin::offset_type)r->tail) { /* buffered seek */ assert(!r->ReadingFromBuffer() || |