diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-13 20:01:28 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-13 20:01:28 +0100 |
commit | 18e11ba9a8ccc8526fe051c3c3b57453455c1b39 (patch) | |
tree | d57f5847d42351bf5085c22726e0642c8d739526 /plugins/sndfile | |
parent | bdfa962b2a5ea20b934dbe030b7fe23832f6ee7c (diff) |
fixed sndfile seeking
Diffstat (limited to 'plugins/sndfile')
-rw-r--r-- | plugins/sndfile/sndfile.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c index 99f717cc..e6dfb7ce 100644 --- a/plugins/sndfile/sndfile.c +++ b/plugins/sndfile/sndfile.c @@ -62,7 +62,11 @@ sf_vfs_write (const void *ptr, sf_count_t count, void *user_data) { static sf_count_t sf_vfs_seek (sf_count_t offset, int whence, void *user_data) { sndfilectx_t *ctx = user_data; - return deadbeef->fseek (ctx->file, offset, whence); + int ret = deadbeef->fseek (ctx->file, offset, whence); + if (!ret) { + return offset; + } + return -1; } static sf_count_t @@ -174,7 +178,11 @@ sndfile_read_float32 (char *bytes, int size) { static int sndfile_seek_sample (int sample) { - sfctx.currentsample = sf_seek (sfctx.ctx, sample + sfctx.startsample, SEEK_SET); + int ret = sf_seek (sfctx.ctx, sample + sfctx.startsample, SEEK_SET); + if (ret < 0) { + return -1; + } + sfctx.currentsample = ret; plugin.info.readpos = (float)(sfctx.currentsample - sfctx.startsample) / plugin.info.samplerate; return 0; } |