Fix problems loading files into SndfileDecoder when
authorCarl Hetherington <cth@carlh.net>
Wed, 26 Feb 2014 22:26:41 +0000 (22:26 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 26 Feb 2014 22:26:41 +0000 (22:26 +0000)
they have non-ASCII names.

Reported-by: José Luis Rodríguez García
ChangeLog
src/lib/sndfile_decoder.cc

index e9607abbf1c1b7940e9b2c7621553b8346076163..c08d896359635927b15cfcad5f2a22cf329c07e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-26  Carl Hetherington  <cth@carlh.net>
+
+       * Fix failure to load sound files with
+       non-ASCII paths.
+
 2014-02-23  Carl Hetherington  <cth@carlh.net>
 
        * Version 1.64.16 released.
index e10f4f568430d08dd86d1d5db38d2116606fbbbb..f66a7c7dc9dd363f649f2c71632a9a5057d78949 100644 (file)
 */
 
 #include <iostream>
+#ifdef DCPOMATIC_WINDOWS
+#include <windows.h>
+#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
+#endif
 #include <sndfile.h>
 #include "sndfile_content.h"
 #include "sndfile_decoder.h"
@@ -40,7 +44,14 @@ SndfileDecoder::SndfileDecoder (shared_ptr<const Film> f, shared_ptr<const Sndfi
        , _deinterleave_buffer (0)
 {
        _info.format = 0;
+
+       /* Here be monsters.  See fopen_boost for similar shenanigans */
+#ifdef DCPOMATIC_WINDOWS
+       _sndfile = sf_wchar_open (_sndfile_content->path(0).c_str(), SFM_READ, &_info);
+#else  
        _sndfile = sf_open (_sndfile_content->path(0).string().c_str(), SFM_READ, &_info);
+#endif
+       
        if (!_sndfile) {
                throw DecodeError (_("could not open audio file for reading"));
        }