Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/x264
  • EwoutH/x264
  • gramner/x264
  • BugMaster/x264
  • MaskRay/x264
  • thresh/x264
  • tpm/x264
  • wolfired/x264
  • ifb/x264
  • robinstorm/x264
  • ltnokiago/x264
  • janne/x264
  • Kromjunya/x264
  • trisnaayu0596/x264
  • felipegarcia1402/x264
  • coder2004/x264
  • philou/x264
  • walagnatalia/x264
  • DonDiego/x264
  • JHammler/x264
  • qyot27/x264
  • dwbuiten/x264
  • Kagami/x264
  • andriy-andreyev/x264
  • gxw/x264
  • trofi/x264
  • kierank/x264
  • aureliendavid/x264
  • galad/x264
  • roommini/x264
  • ocrete/x264
  • mstorsjo/x264
  • yinsj0116/x264
  • mamonet/x264
  • 1div0/x264
  • ko1265/x264
  • sergiomb2/x264
  • xutongda/x264
  • wenzhiwu/x264
  • arrowd/x264
  • FranceBB/x264
  • ziemek99/x264
  • longervision/x264
  • xopok/x264
  • jbk/x264
  • szatmary/x264
  • pekdon/x264
  • Jiangguyu/x264
  • jrtc27/x264
  • kankanol1/x264
  • gxwLite/x264
  • brad/x264
  • Gc6026/x264
  • jdek/x264
  • appcrash/x264
  • tguillem/x264
  • As/x264
  • wevian/x264
  • wangluls/x264
  • RellikJaeger/x264
  • hum/x264
  • rogerhardiman/x264
  • jankowalski12611/x264
  • zhijie1996/x264
  • yinshiyou/x264
  • Freed-Wu/x264
  • yajcoca/x264
  • bUd/x264
  • chienvannguyen2020/x264
  • nurbinakhatun386/x264
  • Siberiawind/x-264-meson
  • HecaiYuan/x264
  • david.chen/x264
  • Ytsejam76/x264
  • robUx4/x264
  • zhaoshiz/x-264-arm64ec
  • yintong.ustc/x-264-bd-ventana
  • nekobasu/x264
  • Courmisch/x264
  • BD-qjy/x264
  • quink/x264
  • markos/x264
82 results
Show changes
Commits on Source (3)
......@@ -7,6 +7,7 @@ vpath %.h $(SRCPATH)
vpath %.S $(SRCPATH)
vpath %.asm $(SRCPATH)
vpath %.rc $(SRCPATH)
vpath %.manifest $(SRCPATH)
CFLAGS += $(CFLAGSPROF)
LDFLAGS += $(LDFLAGSPROF)
......@@ -312,7 +313,7 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK_8) $(OBJCHK_10) $(OBJEXA
%.dll.o: %.rc x264.h
$(RC) $(RCFLAGS)$@ -DDLL $<
%.o: %.rc x264.h
%.o: %.rc x264.h x264res.manifest
$(RC) $(RCFLAGS)$@ $<
.depend: config.mak
......
......@@ -116,30 +116,65 @@ static inline int x264_snprintf( char *s, size_t n, const char *fmt, ... )
#endif
#ifdef _WIN32
#define utf8_to_utf16( utf8, utf16 )\
MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, utf8, -1, utf16, sizeof(utf16)/sizeof(wchar_t) )
/* Functions for dealing with Unicode on Windows. */
static inline FILE *x264_fopen( const char *filename, const char *mode )
static inline wchar_t *x264_utf8_to_utf16( const char *utf8 )
{
wchar_t filename_utf16[MAX_PATH];
wchar_t mode_utf16[16];
if( utf8_to_utf16( filename, filename_utf16 ) && utf8_to_utf16( mode, mode_utf16 ) )
return _wfopen( filename_utf16, mode_utf16 );
int len = MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, utf8, -1, NULL, 0 );
if( len )
{
wchar_t *utf16 = malloc( len * sizeof( wchar_t ) );
if( utf16 )
{
if( MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, utf8, -1, utf16, len ) )
return utf16;
free( utf16 );
}
}
return NULL;
}
static inline wchar_t *x264_utf8_to_utf16_try_buf( const char *utf8, wchar_t *buf_utf16, int buf_len ) {
if( MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, utf8, -1, buf_utf16, buf_len ) )
return buf_utf16;
return x264_utf8_to_utf16( utf8 );
}
#define x264_fopen( filename, mode ) x264_fopen_internal( filename, L##mode )
static inline FILE *x264_fopen_internal( const char *filename, const wchar_t *mode_utf16 )
{
FILE *f = NULL;
wchar_t filename_buf[MAX_PATH];
wchar_t *filename_utf16 = x264_utf8_to_utf16_try_buf( filename, filename_buf, MAX_PATH );
if( filename_utf16 )
{
f = _wfopen( filename_utf16, mode_utf16 );
if( filename_utf16 != filename_buf )
free( filename_utf16 );
}
return f;
}
static inline int x264_rename( const char *oldname, const char *newname )
{
wchar_t oldname_utf16[MAX_PATH];
wchar_t newname_utf16[MAX_PATH];
if( utf8_to_utf16( oldname, oldname_utf16 ) && utf8_to_utf16( newname, newname_utf16 ) )
int ret = -1;
wchar_t oldname_buf[MAX_PATH];
wchar_t *oldname_utf16 = x264_utf8_to_utf16_try_buf( oldname, oldname_buf, MAX_PATH );
if( oldname_utf16 )
{
/* POSIX says that rename() removes the destination, but Win32 doesn't. */
_wunlink( newname_utf16 );
return _wrename( oldname_utf16, newname_utf16 );
wchar_t newname_buf[MAX_PATH];
wchar_t *newname_utf16 = x264_utf8_to_utf16_try_buf( newname, newname_buf, MAX_PATH );
if( newname_utf16 )
{
/* POSIX says that rename() removes the destination, but Win32 doesn't. */
_wunlink( newname_utf16 );
ret = _wrename( oldname_utf16, newname_utf16 );
if( newname_utf16 != newname_buf )
free( newname_utf16 );
}
if( oldname_utf16 != oldname_buf )
free( oldname_utf16 );
}
return -1;
return ret;
}
#define x264_struct_stat struct _stati64
......@@ -147,10 +182,16 @@ static inline int x264_rename( const char *oldname, const char *newname )
static inline int x264_stat( const char *path, x264_struct_stat *buf )
{
wchar_t path_utf16[MAX_PATH];
if( utf8_to_utf16( path, path_utf16 ) )
return _wstati64( path_utf16, buf );
return -1;
int ret = -1;
wchar_t path_buf[MAX_PATH];
wchar_t *path_utf16 = x264_utf8_to_utf16_try_buf( path, path_buf, MAX_PATH );
if( path_utf16 )
{
ret = _wstati64( path_utf16, buf );
if( path_utf16 != path_buf )
free( path_utf16 );
}
return ret;
}
#else
#define x264_fopen fopen
......@@ -197,18 +238,43 @@ static inline int x264_vfprintf( FILE *stream, const char *format, va_list arg )
return vfprintf( stream, format, arg );
}
static inline int x264_is_pipe( const char *path )
static inline int x264_is_regular_file_path( const char *path )
{
wchar_t path_utf16[MAX_PATH];
if( utf8_to_utf16( path, path_utf16 ) )
return WaitNamedPipeW( path_utf16, 0 );
return 0;
int ret = -1;
wchar_t path_buf[MAX_PATH];
wchar_t *path_utf16 = x264_utf8_to_utf16_try_buf( path, path_buf, MAX_PATH );
if( path_utf16 )
{
x264_struct_stat buf;
if( _wstati64( path_utf16, &buf ) )
ret = !WaitNamedPipeW( path_utf16, 0 );
else
ret = S_ISREG( buf.st_mode );
if( path_utf16 != path_buf )
free( path_utf16 );
}
return ret;
}
#else
#define x264_vfprintf vfprintf
#define x264_is_pipe(x) 0
static inline int x264_is_regular_file_path( const char *filename )
{
x264_struct_stat file_stat;
if( x264_stat( filename, &file_stat ) )
return 1;
return S_ISREG( file_stat.st_mode );
}
#endif
static inline int x264_is_regular_file( FILE *filehandle )
{
x264_struct_stat file_stat;
if( x264_fstat( fileno( filehandle ), &file_stat ) )
return 1;
return S_ISREG( file_stat.st_mode );
}
#define x264_glue3_expand(x,y,z) x##_##y##_##z
#define x264_glue3(x,y,z) x264_glue3_expand(x,y,z)
......@@ -510,20 +576,4 @@ static ALWAYS_INLINE void x264_prefetch( void *p )
#define x264_lower_thread_priority(p)
#endif
static inline int x264_is_regular_file( FILE *filehandle )
{
x264_struct_stat file_stat;
if( x264_fstat( fileno( filehandle ), &file_stat ) )
return 1;
return S_ISREG( file_stat.st_mode );
}
static inline int x264_is_regular_file_path( const char *filename )
{
x264_struct_stat file_stat;
if( x264_stat( filename, &file_stat ) )
return !x264_is_pipe( filename );
return S_ISREG( file_stat.st_mode );
}
#endif /* X264_OSDEP_H */
......@@ -253,6 +253,52 @@ static float get_avs_version( avs_hnd_t *h )
#endif
}
#ifdef _WIN32
static char *utf16_to_ansi( const wchar_t *utf16 )
{
BOOL invalid;
int len = WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, utf16, -1, NULL, 0, NULL, &invalid );
if( len && !invalid )
{
char *ansi = malloc( len * sizeof( char ) );
if( ansi )
{
if( WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, utf16, -1, ansi, len, NULL, &invalid ) && !invalid )
return ansi;
free( ansi );
}
}
return NULL;
}
static char *utf8_to_ansi( const char *filename )
{
char *ansi = NULL;
wchar_t *filename_utf16 = x264_utf8_to_utf16( filename );
if( filename_utf16 )
{
/* Check if the filename already is valid ANSI. */
if( !(ansi = utf16_to_ansi( filename_utf16 )) )
{
/* Check for a legacy 8.3 short filename. */
int len = GetShortPathNameW( filename_utf16, NULL, 0 );
if( len )
{
wchar_t *short_utf16 = malloc( len * sizeof( wchar_t ) );
if( short_utf16 )
{
if( GetShortPathNameW( filename_utf16, short_utf16, len ) )
ansi = utf16_to_ansi( short_utf16 );
free( short_utf16 );
}
}
}
free( filename_utf16 );
}
return ansi;
}
#endif
static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, cli_input_opt_t *opt )
{
FILE *fh = x264_fopen( psz_filename, "r" );
......@@ -279,8 +325,8 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
#ifdef _WIN32
/* Avisynth doesn't support Unicode filenames. */
char ansi_filename[MAX_PATH];
FAIL_IF_ERROR( !x264_ansi_filename( psz_filename, ansi_filename, MAX_PATH, 0 ), "invalid ansi filename\n" );
char *ansi_filename = utf8_to_ansi( psz_filename );
FAIL_IF_ERROR( !ansi_filename, "invalid ansi filename\n" );
AVS_Value arg = avs_new_value_string( ansi_filename );
#else
AVS_Value arg = avs_new_value_string( psz_filename );
......@@ -292,6 +338,9 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
if( !strcasecmp( filename_ext, "avs" ) )
{
res = h->func.avs_invoke( h->env, "Import", arg, NULL );
#ifdef _WIN32
free( ansi_filename );
#endif
FAIL_IF_ERROR( avs_is_error( res ), "%s\n", avs_as_error( res ) );
/* check if the user is using a multi-threaded script and apply distributor if necessary.
adapted from avisynth's vfw interface */
......@@ -332,6 +381,9 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
}
x264_cli_printf( X264_LOG_INFO, "failed\n" );
}
#ifdef _WIN32
free( ansi_filename );
#endif
FAIL_IF_ERROR( !filter[i], "unable to find source filter to open `%s'\n", psz_filename );
}
FAIL_IF_ERROR( !avs_is_clip( res ), "`%s' didn't return a video clip\n", psz_filename );
......
......@@ -27,10 +27,6 @@
#include "output.h"
#include <gpac/isomedia.h>
#ifdef _WIN32
#include <windows.h>
#endif
typedef struct
{
GF_ISOFile *p_file;
......@@ -181,15 +177,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, cli_output_opt_t *opt
if( !p_mp4 )
return -1;
#ifdef _WIN32
/* GPAC doesn't support Unicode filenames. */
char ansi_filename[MAX_PATH];
FAIL_IF_ERR( !x264_ansi_filename( psz_filename, ansi_filename, MAX_PATH, 1 ), "mp4", "invalid ansi filename\n" );
p_mp4->p_file = gf_isom_open( ansi_filename, GF_ISOM_OPEN_WRITE, NULL );
#else
p_mp4->p_file = gf_isom_open( psz_filename, GF_ISOM_OPEN_WRITE, NULL );
#endif
p_mp4->b_dts_compress = opt->use_dts_compress;
if( !(p_mp4->p_sample = gf_isom_sample_new()) )
......
......@@ -80,44 +80,10 @@ static wchar_t org_console_title[CONSOLE_TITLE_SIZE] = L"";
void x264_cli_set_console_title( const char *title )
{
wchar_t title_utf16[CONSOLE_TITLE_SIZE];
if( utf8_to_utf16( title, title_utf16 ) )
if( MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, title, -1, title_utf16, CONSOLE_TITLE_SIZE ) )
SetConsoleTitleW( title_utf16 );
}
static int utf16_to_ansi( const wchar_t *utf16, char *ansi, int size )
{
int invalid;
return WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, utf16, -1, ansi, size, NULL, &invalid ) && !invalid;
}
/* Some external libraries doesn't support Unicode in filenames,
* as a workaround we can try to get an ANSI filename instead. */
int x264_ansi_filename( const char *filename, char *ansi_filename, int size, int create_file )
{
wchar_t filename_utf16[MAX_PATH];
if( utf8_to_utf16( filename, filename_utf16 ) )
{
if( create_file )
{
/* Create the file using the Unicode filename if it doesn't already exist. */
FILE *fh = _wfopen( filename_utf16, L"ab" );
if( fh )
fclose( fh );
}
/* Check if the filename already is valid ANSI. */
if( utf16_to_ansi( filename_utf16, ansi_filename, size ) )
return 1;
/* Check for a legacy 8.3 short filename. */
int short_length = GetShortPathNameW( filename_utf16, filename_utf16, MAX_PATH );
if( short_length > 0 && short_length < MAX_PATH )
if( utf16_to_ansi( filename_utf16, ansi_filename, size ) )
return 1;
}
return 0;
}
/* Retrieve command line arguments as UTF-8. */
static int get_argv_utf8( int *argc_ptr, char ***argv_ptr )
{
......@@ -354,7 +320,7 @@ static void print_version_info( void )
printf( "(ffmpegsource %d.%d.%d.%d)\n", FFMS_VERSION >> 24, (FFMS_VERSION & 0xff0000) >> 16, (FFMS_VERSION & 0xff00) >> 8, FFMS_VERSION & 0xff );
#endif
#if HAVE_GPAC
printf( "(gpac " GPAC_FULL_VERSION ")\n" );
printf( "(gpac " GPAC_VERSION ")\n" );
#endif
#if HAVE_LSMASH
printf( "(lsmash %d.%d.%d)\n", LSMASH_VERSION_MAJOR, LSMASH_VERSION_MINOR, LSMASH_VERSION_MICRO );
......
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="VideoLAN.x264" version="1.0.0.0"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>
......@@ -35,6 +35,10 @@
#define str(s) #s
#define xstr(s) str(s)
#ifndef DLL
1 RT_MANIFEST "x264res.manifest"
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, X264_BUILD, X264_REV, X264_REV_DIFF
PRODUCTVERSION 0, X264_BUILD, X264_REV, X264_REV_DIFF
......