Index: Changelog =================================================================== --- Changelog (revision 20337) +++ Changelog (working copy) @@ -41,6 +41,7 @@ - Atrac1 decoder - MD STUDIO audio demuxer - RF64 support in WAV demuxer +- support for Unicode filenames on Windows Index: configure =================================================================== --- configure (revision 20337) +++ configure (working copy) @@ -107,6 +107,7 @@ echo " --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)" echo " --enable-hardcoded-tables use hardcoded tables instead of runtime generation" echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers" + echo " --enable-win-unicode use UTF8 filenames on Windows (breaks commandline tools)" echo " --enable-beos-netserver enable BeOS netserver" echo " --disable-encoder=NAME disable encoder NAME" echo " --enable-encoder=NAME enable encoder NAME" @@ -856,6 +857,7 @@ vaapi vdpau version3 + win_unicode x11grab zlib " Index: doc/APIchanges =================================================================== --- doc/APIchanges (revision 20337) +++ doc/APIchanges (working copy) @@ -12,6 +12,11 @@ API changes, most recent first: +2009-07-xx - rxxxxx - lavf 52.40.0 - Windows Unicode support + Added optional support for Unicode filenames on Windows. To enable this, + pass --enable-win-unicode to configure; you must then use UTF-8 filenames + when calling lavf functions. + 2009-10-19 - r20302 - lavfi 1.3.0 - avfilter_make_format_list() Change the interface of avfilter_make_format_list() from avfilter_make_format_list(int n, ...) to Index: libavformat/avformat.h =================================================================== --- libavformat/avformat.h (revision 20337) +++ libavformat/avformat.h (working copy) @@ -22,8 +22,8 @@ #define AVFORMAT_AVFORMAT_H #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 39 -#define LIBAVFORMAT_VERSION_MICRO 2 +#define LIBAVFORMAT_VERSION_MINOR 40 +#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ Index: libavformat/os_support.c =================================================================== --- libavformat/os_support.c (revision 20337) +++ libavformat/os_support.c (working copy) @@ -30,6 +30,36 @@ #include #include "os_support.h" +#if CONFIG_WIN_UNICODE +#define WIN32_LEAN_AND_MEAN +#include +#include + +static wchar_t *dup_char_to_wchar(const char *s) +{ + wchar_t *w; + int l; + if (!(l = MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,s,-1,0,0))) + return NULL; + if (!(w = av_malloc(l*sizeof(wchar_t)))) + return NULL; + if (MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,s,-1,w,l) <= 0) + av_freep(&w); + return w; +} + +int ff_winutf8_open(const char *fname, int oflags, int pmode) +{ + wchar_t *wfname = dup_char_to_wchar(fname); + if (wfname) { + int ret = _wopen(wfname, oflags, pmode); + av_free(wfname); + return ret; + } + return -1; +} +#endif /* CONFIG_WIN_UNICODE */ + #if CONFIG_NETWORK #if !HAVE_POLL_H #if HAVE_WINSOCK2_H Index: libavformat/os_support.h =================================================================== --- libavformat/os_support.h (revision 20337) +++ libavformat/os_support.h (working copy) @@ -32,6 +32,10 @@ #if defined(__MINGW32__) && !defined(__MINGW32CE__) # include # define lseek(f,p,w) _lseeki64((f), (p), (w)) +# if CONFIG_WIN_UNICODE +# define open(fn,of,pm) ff_winutf8_open(fn, of, pm) +int ff_winutf8_open(const char *fname, int oflags, int pmode); +# endif /* CONFIG_WIN_UNICODE */ #endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */ static inline int is_dos_path(const char *path)