summaryrefslogtreecommitdiff
path: root/libavcodec/xvidff.c
diff options
context:
space:
mode:
authorCorey Hickey <bugfood-ml@fatooh.org>2006-03-30 04:33:05 +0000
committerCorey Hickey <bugfood-ml@fatooh.org>2006-03-30 04:33:05 +0000
commit1005f542b20cb152514c9496689148fc4456f438 (patch)
treeff65aadb3a063f6a1cd0f72c2bd4f3a38afc1bae /libavcodec/xvidff.c
parent06ab9cffb25518030a1434da5958a5c07f4a7cd3 (diff)
- Add new file internal.h for common internal-use-only functions.
- Add new function av_tempfile() for creating temporary files; contains workaround for MinGW. - Make XviD stuff use av_tempfile(). Originally committed as revision 5245 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/xvidff.c')
-rw-r--r--libavcodec/xvidff.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/libavcodec/xvidff.c b/libavcodec/xvidff.c
index d44fedb2c8..c765891d35 100644
--- a/libavcodec/xvidff.c
+++ b/libavcodec/xvidff.c
@@ -27,9 +27,7 @@
#include <unistd.h>
#include "common.h"
#include "avcodec.h"
-#ifdef CONFIG_WIN32
-#include <fcntl.h>
-#endif
+#include "internal.h"
/**
* Buffer management macros.
@@ -229,39 +227,7 @@ int ff_xvid_encode_init(AVCodecContext *avctx) {
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,
- "XviD: Cannot allocate 2-pass buffer\n");
- return -1;
- }
- strcpy(x->twopassfile, "/tmp/xvidff.XXXXXX");
- fd = mkstemp(x->twopassfile);
- if(fd < 0){
- strcpy(x->twopassfile, "./xvidff.XXXXXX");
- fd = mkstemp(x->twopassfile);
- }
-#endif
+ fd = av_tempfile("xvidff.", &(x->twopassfile));
if( fd == -1 ) {
av_log(avctx, AV_LOG_ERROR,
"XviD: Cannot write 2-pass pipe\n");