[x264-devel] Fix input support from named pipes in Windows
Anton Mitrofanov
git at videolan.org
Tue Jan 21 22:51:24 CET 2014
x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Fri Jan 3 20:06:06 2014 +0400| [de0bc3697eeb260d73f96c3da2102389a33e6d4a] | committer: Jason Garrett-Glaser
Fix input support from named pipes in Windows
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=de0bc3697eeb260d73f96c3da2102389a33e6d4a
---
common/osdep.c | 8 ++++++++
common/osdep.h | 10 ++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/common/osdep.c b/common/osdep.c
index 7564f65..bc3692a 100644
--- a/common/osdep.c
+++ b/common/osdep.c
@@ -199,4 +199,12 @@ int x264_vfprintf( FILE *stream, const char *format, va_list arg )
}
return vfprintf( stream, format, arg );
}
+
+int x264_is_pipe( const char *path )
+{
+ wchar_t path_utf16[MAX_PATH];
+ if( utf8_to_utf16( path, path_utf16 ) )
+ return WaitNamedPipeW( path_utf16, 0 );
+ return 0;
+}
#endif
diff --git a/common/osdep.h b/common/osdep.h
index 054953d..ea6eb08 100644
--- a/common/osdep.h
+++ b/common/osdep.h
@@ -78,6 +78,7 @@ int x264_rename( const char *oldname, const char *newname );
#define x264_fstat _fstati64
int x264_stat( const char *path, x264_struct_stat *buf );
int x264_vfprintf( FILE *stream, const char *format, va_list arg );
+int x264_is_pipe( const char *path );
#else
#define x264_fopen fopen
#define x264_rename rename
@@ -85,6 +86,7 @@ int x264_vfprintf( FILE *stream, const char *format, va_list arg );
#define x264_fstat fstat
#define x264_stat stat
#define x264_vfprintf vfprintf
+#define x264_is_pipe(x) 0
#endif
#ifdef __ICL
@@ -377,19 +379,19 @@ static ALWAYS_INLINE void x264_prefetch( void *p )
#define x264_lower_thread_priority(p)
#endif
-static inline uint8_t x264_is_regular_file( FILE *filehandle )
+static inline int x264_is_regular_file( FILE *filehandle )
{
x264_struct_stat file_stat;
if( x264_fstat( fileno( filehandle ), &file_stat ) )
- return -1;
+ return 1;
return S_ISREG( file_stat.st_mode );
}
-static inline uint8_t x264_is_regular_file_path( const char *filename )
+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 !x264_is_pipe( filename );
return S_ISREG( file_stat.st_mode );
}
More information about the x264-devel
mailing list