summaryrefslogtreecommitdiff
path: root/plugins/wavpack
diff options
context:
space:
mode:
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;