From 74dbb5388e356c085b2f426a5533c08cdc163488 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 16 Oct 2011 21:32:06 +0200 Subject: [PATCH] av_tempfile: Pass int log_offset, void *log_ctx Signed-off-by: Michael Niedermayer --- libavcodec/libxvid_rc.c | 2 +- libavcodec/libxvidff.c | 2 +- libavformat/cache.c | 2 +- libavutil/file.c | 7 ++++--- libavutil/file.h | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c index 37716acc4a..8a2b487122 100644 --- a/libavcodec/libxvid_rc.c +++ b/libavcodec/libxvid_rc.c @@ -41,7 +41,7 @@ int ff_xvid_rate_control_init(MpegEncContext *s){ //xvid_debug=-1; - fd=av_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; diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c index ba950edc39..f7aa7fd44e 100644 --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@ -232,7 +232,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { rc2pass2.version = XVID_VERSION; rc2pass2.bitrate = avctx->bit_rate; - fd = av_tempfile("xvidff.", &(x->twopassfile)); + fd = av_tempfile("xvidff.", &(x->twopassfile), 0, avctx); if( fd == -1 ) { av_log(avctx, AV_LOG_ERROR, "Xvid: Cannot write 2-pass pipe\n"); diff --git a/libavformat/cache.c b/libavformat/cache.c index a95ad53713..74f008e0d1 100644 --- a/libavformat/cache.c +++ b/libavformat/cache.c @@ -63,7 +63,7 @@ static int cache_open(URLContext *h, const char *arg, int flags) av_strstart(arg, "cache:", &arg); - c->fd = av_tempfile("ffcache", &buffername); + c->fd = av_tempfile("ffcache", &buffername, 0, h); if (c->fd < 0){ av_log(h, AV_LOG_ERROR, "Failed to create tempfile\n"); return c->fd; diff --git a/libavutil/file.c b/libavutil/file.c index e2cfc2f1dd..882a9855ef 100644 --- a/libavutil/file.c +++ b/libavutil/file.c @@ -130,7 +130,8 @@ void av_file_unmap(uint8_t *bufptr, size_t size) #endif } -int av_tempfile(const char *prefix, char **filename) { +int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx) { + FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx }; int fd=-1; #if !HAVE_MKSTEMP void *ptr= tempnam(NULL, prefix); @@ -145,7 +146,7 @@ int av_tempfile(const char *prefix, char **filename) { #endif /* -----common section-----*/ if (*filename == NULL) { - av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n"); + av_log(&file_log_ctx, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n"); return AVERROR(ENOMEM); } #if !HAVE_MKSTEMP @@ -167,7 +168,7 @@ int av_tempfile(const char *prefix, char **filename) { /* -----common section-----*/ if (fd < 0) { int err = AVERROR(errno); - av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename); + av_log(&file_log_ctx, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename); return err; } return fd; /* success */ diff --git a/libavutil/file.h b/libavutil/file.h index c6d2692d52..f3af9ef7e5 100644 --- a/libavutil/file.h +++ b/libavutil/file.h @@ -56,6 +56,6 @@ void av_file_unmap(uint8_t *bufptr, size_t size); * @return file descriptor of opened file (or -1 on error) * and opened file name in **filename. */ -int av_tempfile(const char *prefix, char **filename); +int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); #endif /* AVUTIL_FILE_H */ -- 2.11.0