Check to see if input file is a pipe without opening it.
{
struct stat file_stat;
if( fstat( fileno( filehandle ), &file_stat ) )
- return 0;
+ return -1;
+ return S_ISREG( file_stat.st_mode );
+}
+
+static inline uint8_t x264_is_regular_file_path( const char *filename )
+{
+ struct stat file_stat;
+ if( stat( filename, &file_stat ) )
+ return -1;
return S_ISREG( file_stat.st_mode );
}
int b_auto = !strcasecmp( demuxer, "auto" );
if( !b_regular && b_auto )
ext = "yuv";
+ b_regular = b_regular && x264_is_regular_file_path( filename );
if( b_regular )
{
FILE *f = fopen( filename, "r" );