[Flac-dev] FLAC C API / Visual Studio 2008 FILE* Issue

Erik de Castro Lopo mle+la at mega-nerd.com
Tue Jan 5 14:38:59 PST 2010


Ivailo Karamanolev wrote:

> I am currently learning the FLAC C API and had the code working with
> FLAC__stream_decoder_init_file. However, since I'd need the Unicode filename
> support, I tried _wfopen_s in combination with
> FLAC__stream_decoder_init_FILE, however I get a runtime crash as sonn as I
> call FLAC__stream_decoder_process_until_end_of_stream. The same code
> (partially taken from the examples) is working perfectly with the function
> accepting filename and crashing with the one accepting FILE*. I have tried
> both compiling the library myself and using the precompiled
> flac-1.2.1-devel-win. Can someone try if it is working for him (the FILE*)
> version and if yes - send back the source code?
> I work in Windows 7 64bit, but I tried that also on a virtual Windows XP and
> it crashes there also.

There is a whole bunch of weird stuff in windows, this is just another instance.

If what you want to do is read/write FLAC files with windows UCS-16 filenames,
one option is to use libsndfile:

    http://www.mega-nerd.com/libsndfile/

which with version 1.0.21 has added this function:

    /* The function sf_wchar_open() is Windows Only!
    ** Open a file passing in a Windows Unicode filename. Otherwise, this is
    ** the same as sf_open().
    **
    ** In order for this to work, you need to do the following:
    **
    **		#include <windows.h>
    **		#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
    **		#including <sndfile.h>
    */
    #if ENABLE_SNDFILE_WINDOWS_PROTOTYPES
    SNDFILE* sf_wchar_open (LPCWSTR wpath, int mode, SF_INFO *sfinfo) ;
    #endif

There is a windows binary installer in the main web page (one for each of
32 and 64 bit windows).

The only downside to this is that libsndfile does not expose the all of
the features of the FLAC API to the user.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the Flac-dev mailing list