summaryrefslogtreecommitdiff
path: root/libavformat/os_support.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-24 03:38:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-24 03:41:22 +0200
commit7b376b398a464a5825ede8b10d5f605c526c7399 (patch)
treee254c50f44e8befc83e4dde353ff3cd6189f2061 /libavformat/os_support.c
parentc225615bf2da206775c5ff2b56d648cf50d38756 (diff)
parentb1ac139d89b9fc55b70ad3411af2f75fe8b17805 (diff)
Merge remote branch 'qatar/master'
* qatar/master: Handle unicode file names on windows rtp: Rename the open/close functions to alloc/free Lowercase all ff* program names. Refer to ff* tools by their lowercase names. NOT Pulled Replace more FFmpeg instances by Libav or ffmpeg. Replace `` by $() syntax in shell scripts. patcheck: Allow overiding grep program(s) through environment variables. NOT Pulled Remove stray libavcore and _g binary references. vorbis: Rename decoder/encoder files to follow general file naming scheme. aacenc: Fix whitespace after last commit. cook: Fix small typo in av_log_ask_for_sample message. aacenc: Finish 3GPP psymodel analysis for non mid/side cases. Remove RDFT dependency from AAC decoder. Add some debug log messages to AAC extradata Fix mov debug (u)int64_t format strings. bswap: use native types for av_bwap16(). doc: FLV muxing is supported. applehttp: Handle AES-128 encrypted streams Add a protocol handler for AES CBC decryption with PKCS7 padding doc: Mention that DragonFly BSD requires __BSD_VISIBLE set Conflicts: ffplay.c ffprobe.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/os_support.c')
-rw-r--r--libavformat/os_support.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 0b7b59e77d..8afa628515 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -28,6 +28,34 @@
#include "avformat.h"
#include "os_support.h"
+#if defined(_WIN32) && !defined(__MINGW32CE__)
+#include <windows.h>
+
+#undef open
+int ff_win32_open(const char *filename_utf8, int oflag, int pmode)
+{
+ int fd;
+ int num_chars;
+ wchar_t *filename_w;
+
+ /* convert UTF-8 to wide chars */
+ num_chars = MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, NULL, 0);
+ if (num_chars <= 0)
+ return -1;
+ filename_w = av_mallocz(sizeof(wchar_t) * num_chars);
+ MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, filename_w, num_chars);
+
+ fd = _wopen(filename_w, oflag, pmode);
+ av_freep(&filename_w);
+
+ /* filename maybe be in CP_ACP */
+ if (fd == -1 && !(oflag & O_CREAT))
+ return open(filename_utf8, oflag, pmode);
+
+ return fd;
+}
+#endif
+
#if CONFIG_NETWORK
#include <fcntl.h>
#include <unistd.h>