[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec xvidff.c,1.4,1.5
Michael Niedermayer CVS
michael
Sat Aug 6 11:46:06 CEST 2005
Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv17722
Modified Files:
xvidff.c
Log Message:
mkstemp on win32 workaround by (Ivan Wong: email, ivanwong info)
Index: xvidff.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/xvidff.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xvidff.c 30 Apr 2005 21:43:57 -0000 1.4
+++ xvidff.c 6 Aug 2005 09:46:04 -0000 1.5
@@ -27,6 +27,9 @@
#include <unistd.h>
#include "common.h"
#include "avcodec.h"
+#ifdef CONFIG_WIN32
+#include <fcntl.h>
+#endif
/**
* Buffer management macros.
@@ -226,6 +229,26 @@
rc2pass2.version = XVID_VERSION;
rc2pass2.bitrate = avctx->bit_rate;
+#ifdef CONFIG_WIN32 /* Ugly work around */
+ {
+ char *tempname;
+
+ tempname = tempnam(".", "xvidff");
+ fd = -1;
+ if( tempname &&
+ (fd = open(tempname, _O_RDWR | _O_BINARY)) != -1 ) {
+ x->twopassfile = av_strdup(tempname);
+#undef free
+ free(tempname);
+#define free please_use_av_free
+ if( x->twopassfile == NULL ) {
+ av_log(avctx, AV_LOG_ERROR,
+ "XviD: Cannot allocate 2-pass buffer\n");
+ return -1;
+ }
+ }
+ }
+#else
x->twopassfile = av_malloc(BUFFER_SIZE);
if( x->twopassfile == NULL ) {
av_log(avctx, AV_LOG_ERROR,
@@ -238,6 +261,7 @@
strcpy(x->twopassfile, "./xvidff.XXXXXX");
fd = mkstemp(x->twopassfile);
}
+#endif
if( fd == -1 ) {
av_log(avctx, AV_LOG_ERROR,
"XviD: Cannot write 2-pass pipe\n");
More information about the ffmpeg-cvslog
mailing list