mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-10-31 20:42:49 +08:00 
			
		
		
		
	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>
This commit is contained in:
		 Oka Motofumi
					Oka Motofumi
				
			
				
					committed by
					
						 Martin Storsjö
						Martin Storsjö
					
				
			
			
				
	
			
			
			 Martin Storsjö
						Martin Storsjö
					
				
			
						parent
						
							0fcf3013c4
						
					
				
				
					commit
					5c742005fb
				
			| @@ -49,10 +49,15 @@ static int avisynth_read_header(AVFormatContext *s) | |||||||
|   DWORD id; |   DWORD id; | ||||||
|   AVStream *st; |   AVStream *st; | ||||||
|   AVISynthStream *stream; |   AVISynthStream *stream; | ||||||
|  |   wchar_t filename_wchar[1024] = { 0 }; | ||||||
|  |   char filename_char[1024] = { 0 }; | ||||||
|  |  | ||||||
|   AVIFileInit(); |   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) |   if (res != S_OK) | ||||||
|     { |     { | ||||||
|       av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res); |       av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user