diff options
author | Max Kellermann <max@duempel.org> | 2009-11-11 21:02:52 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-11 21:02:52 +0100 |
commit | 0fb877740b84f6831d417a4afca065a3a3f86a41 (patch) | |
tree | ed93550428d832093c8c2311324871598ac177b0 /src | |
parent | 37181c91815d6807df77d6920973b924dba05f1f (diff) | |
download | mpd-0fb877740b84f6831d417a4afca065a3a3f86a41.tar.gz mpd-0fb877740b84f6831d417a4afca065a3a3f86a41.tar.xz mpd-0fb877740b84f6831d417a4afca065a3a3f86a41.zip |
decoder/flac: check "seekable" in libFLAC callbacks
Return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED if this input
stream does not support seeking.
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/flac_plugin.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 2d14ab9df..427d2c4d9 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -69,6 +69,9 @@ flac_seek_cb(G_GNUC_UNUSED const FLAC__StreamDecoder *fd, { struct flac_data *data = (struct flac_data *) fdata; + if (!data->input_stream->seekable) + return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; + if (!input_stream_seek(data->input_stream, offset, SEEK_SET)) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; @@ -81,6 +84,9 @@ flac_tell_cb(G_GNUC_UNUSED const FLAC__StreamDecoder *fd, { struct flac_data *data = (struct flac_data *) fdata; + if (!data->input_stream->seekable) + return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; + *offset = (long)(data->input_stream->offset); return FLAC__STREAM_DECODER_TELL_STATUS_OK; |