summaryrefslogtreecommitdiff
path: root/plugins/sndfile
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-13 21:28:25 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-13 21:28:25 +0100
commitaeb9ba06fb769a92aab45e4afb2078d766d2d842 (patch)
tree816da8b6c4986860094db17340a043eab82a55db /plugins/sndfile
parent131ad1a8f9aeebee3a7560e09c73cdbba8573feb (diff)
parent18e11ba9a8ccc8526fe051c3c3b57453455c1b39 (diff)
Merge branch 'master' into devel
Conflicts: configure.ac deadbeef.h plugins/mpgmad/mpgmad.c
Diffstat (limited to 'plugins/sndfile')
-rw-r--r--plugins/sndfile/sndfile.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c
index 72864c56..cbfbeaf8 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;
}