* Interface to xvidcore for mpeg4 encoding
* Copyright (c) 2004 Adam Thayer <krevnik@comcast.net>
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <unistd.h>
#include "common.h"
#include "avcodec.h"
-#ifdef CONFIG_WIN32
-#include <fcntl.h>
-#endif
+#include "xvid_internal.h"
/**
* Buffer management macros.
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");
} else {
/* We are claiming to be XviD */
x->quicktime_format = 0;
- avctx->codec_tag = ff_get_fourcc("xvid");
+ if(!avctx->codec_tag)
+ avctx->codec_tag = ff_get_fourcc("xvid");
}
/* Bframes */
sizeof(xvid_context_t),
ff_xvid_encode_init,
ff_xvid_encode_frame,
- ff_xvid_encode_close
+ ff_xvid_encode_close,
+ .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
};