View Single Post
Old 8th October 2020, 09:45   #19  |  Link
Kurtnoise
Swallowed in the Sea
 
Kurtnoise's Avatar
 
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,191
Quote:
Originally Posted by LigH View Post
@Kurtnoise: Is your magic available as patch, or may it not even work with GCC?
here is the pach I did :
Code:
Index: xvidcore/examples/xvid_encraw.c
===================================================================
--- xvidcore/examples/xvid_encraw.c	(revision 2196)
+++ xvidcore/examples/xvid_encraw.c	(working copy)
@@ -38,6 +38,14 @@
  *  Use ./xvid_encraw -help for a list of options
  *	
  ************************************************************************/
+#ifdef _WIN32
+/* The following two defines must be located before the inclusion of any system header files. */
+#define WINVER       0x0500
+#define _WIN32_WINNT 0x0500
+#include <windows.h>
+#include <io.h>       /* _setmode() */
+#include <fcntl.h>    /* _O_BINARY */
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -350,6 +358,7 @@
 	double totalenctime = 0.;
 	float totalPSNR[3] = {0., 0., 0.};
 
+	FILE *in_file = stdin;
 	FILE *statsfile;
 	frame_stats_t framestats[7];
 
@@ -991,6 +1000,12 @@
 		  if (avi_in_stream) AVIStreamRelease(avi_in_stream);
 		  AVIFileExit();
       }
+	  else if (ARG_INPUTFILE == NULL || strcmp(ARG_INPUTFILE, "stdin") == 0) {
+#ifdef _WIN32
+    _setmode(_fileno(stdin), _O_BINARY);
+#endif
+		in_file = stdin;		  
+	  }		  
       else
 #endif
 		{
Yes it works w/ gcc.

Sources including this patch are available in the package linked previously...
Kurtnoise is offline   Reply With Quote