aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorOka Motofumi <chikuzen.mo@gmail.com>2012-05-31 02:14:43 +0900
committerMartin Storsjö <martin@martin.st>2012-05-31 22:39:08 +0300
commit5c742005fb7854dcfaa9f0efb65fd36a63ceaa2b (patch)
treec780403b79bcb8fdf19c7d26ea7ab3b4d1d5b464 /libavformat
parent0fcf3013c4aa4f70c39899b7b3bd8c451fe2e493 (diff)
downloadffmpeg-5c742005fb7854dcfaa9f0efb65fd36a63ceaa2b.tar.gz
avisynth: Make sure the filename passed to avisynth is in the right code page
avisynth is a non-unicode application and cannot accept UTF-8 characters. Therefore, the input filename should be converted to the correct code page that it expects. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avisynth.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 3b695a9a0a..c4c523dc8a 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -49,10 +49,15 @@ static int avisynth_read_header(AVFormatContext *s)
DWORD id;
AVStream *st;
AVISynthStream *stream;
+ wchar_t filename_wchar[1024] = { 0 };
+ char filename_char[1024] = { 0 };
AVIFileInit();
- res = AVIFileOpen(&avs->file, s->filename, OF_READ|OF_SHARE_DENY_WRITE, NULL);
+ /* avisynth can't accept UTF-8 filename */
+ MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wchar, 1024);
+ WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wchar, -1, filename_char, 1024, NULL, NULL);
+ res = AVIFileOpen(&avs->file, filename_char, OF_READ|OF_SHARE_DENY_WRITE, NULL);
if (res != S_OK)
{
av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res);