summaryrefslogtreecommitdiff
path: root/libs/audiographer
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-01-27 22:57:31 +0100
committerRobin Gareus <robin@gareus.org>2016-01-27 22:58:59 +0100
commitb985f87a77a11594eb932c20d7374aa8ef9617e7 (patch)
tree800744ec2e59382889e588ae3aff6d6de7c0bc4d /libs/audiographer
parentc61e5dbc18c40f3efbac89744ba6742a972da243 (diff)
Use proper UTF8 file-names during export.
Diffstat (limited to 'libs/audiographer')
-rw-r--r--libs/audiographer/private/sndfile.hh31
1 files changed, 29 insertions, 2 deletions
diff --git a/libs/audiographer/private/sndfile.hh b/libs/audiographer/private/sndfile.hh
index 02e8651f60..8b7e1928e4 100644
--- a/libs/audiographer/private/sndfile.hh
+++ b/libs/audiographer/private/sndfile.hh
@@ -52,6 +52,13 @@
#ifndef SNDFILE_HH
#define SNDFILE_HH
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <glib.h>
+#include "pbd/gstdio_compat.h"
+
#include <sndfile.h>
#include <string>
@@ -182,7 +189,17 @@ SndfileHandle::SndfileHandle (const char *path, int mode, int fmt, int chans, in
p->sfinfo.sections = 0 ;
p->sfinfo.seekable = 0 ;
- p->sf = sf_open (path, mode, &p->sfinfo) ;
+ bool writable = false;
+ if (mode & SFM_WRITE) {
+ writable = true;
+ }
+#ifdef PLATFORM_WINDOWS
+ int fd = g_open (path, writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444);
+#else
+ int fd = ::open (path, writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444);
+#endif
+
+ p->sf = sf_open_fd (fd, mode, &p->sfinfo, true) ;
} ;
return ;
@@ -204,7 +221,17 @@ SndfileHandle::SndfileHandle (std::string const & path, int mode, int fmt, int c
p->sfinfo.sections = 0 ;
p->sfinfo.seekable = 0 ;
- p->sf = sf_open (path.c_str (), mode, &p->sfinfo) ;
+ bool writable = false;
+ if (mode & SFM_WRITE) {
+ writable = true;
+ }
+#ifdef PLATFORM_WINDOWS
+ int fd = g_open (path.c_str(), writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444);
+#else
+ int fd = ::open (path.c_str(), writable ? O_CREAT | O_RDWR : O_RDONLY, writable ? 0644 : 0444);
+#endif
+
+ p->sf = sf_open_fd (fd, mode, &p->sfinfo, true) ;
} ;
return ;