summaryrefslogtreecommitdiff
path: root/plugins/wavpack
diff options
context:
space:
mode:
authorGravatar David Bryant <david@wavpack.com>2010-05-28 20:18:46 -0700
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-29 09:13:06 +0200
commit4eb7cc7bc9e458ba3aa6d1338b5710d45a42927e (patch)
tree7665dd200fbb6fb967bf2e2917d7993a9c851478 /plugins/wavpack
parent57b6b29f7c7d5f984d259e3f5c4222425fa8693e (diff)
add support for WavPack correction files
Diffstat (limited to 'plugins/wavpack')
-rw-r--r--plugins/wavpack/wavpack.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c
index e2f9e43b..d0e743f4 100644
--- a/plugins/wavpack/wavpack.c
+++ b/plugins/wavpack/wavpack.c
@@ -34,7 +34,7 @@ static DB_functions_t *deadbeef;
typedef struct {
DB_fileinfo_t info;
- DB_FILE *file;
+ DB_FILE *file, *c_file;
WavpackContext *ctx;
int startsample;
int endsample;
@@ -105,8 +105,15 @@ wv_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
if (!info->file) {
return -1;
}
+
+ char *c_fname = malloc (strlen (it->fname) + 10);
+ strcpy (c_fname, it->fname);
+ strcat (c_fname, "c");
+ info->c_file = deadbeef->fopen (c_fname);
+ free (c_fname);
+
char error[80];
- info->ctx = WavpackOpenFileInputEx (&wsr, info->file, NULL, error, OPEN_2CH_MAX/*|OPEN_WVC*/, 0);
+ info->ctx = WavpackOpenFileInputEx (&wsr, info->file, info->c_file, error, OPEN_2CH_MAX, 0);
if (!info->ctx) {
fprintf (stderr, "wavpack error: %s\n", error);
return -1;
@@ -138,6 +145,10 @@ wv_free (DB_fileinfo_t *_info) {
deadbeef->fclose (info->file);
info->file = NULL;
}
+ if (info->c_file) {
+ deadbeef->fclose (info->c_file);
+ info->c_file = NULL;
+ }
if (info->ctx) {
WavpackCloseFile (info->ctx);
info->ctx = NULL;