summaryrefslogtreecommitdiff
path: root/libavcodec/libxvid_rc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/libxvid_rc.c')
-rw-r--r--libavcodec/libxvid_rc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index 4cb832fb4a..a9a1ee971d 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -3,25 +3,26 @@
*
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * 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.1 of the License, or (at your option) any later version.
*
- * Libav 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 Libav; 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 <xvid.h>
#include <unistd.h>
+#include "libavutil/file.h"
#include "avcodec.h"
#include "libxvid_internal.h"
//#include "dsputil.h"
@@ -40,7 +41,7 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
//xvid_debug=-1;
- fd=ff_tempfile("xvidrc.", &tmp_name);
+ fd=av_tempfile("xvidrc.", &tmp_name, 0, s->avctx);
if (fd == -1) {
av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n");
return -1;
@@ -58,7 +59,10 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8);
//av_log(NULL, AV_LOG_ERROR, "%s\n", tmp);
- write(fd, tmp, strlen(tmp));
+ if (write(fd, tmp, strlen(tmp)) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error %s writing 2pass logfile\n", strerror(errno));
+ return AVERROR(errno);
+ }
}
close(fd);