diff options
author | Anton Khirnov <anton@khirnov.net> | 2015-06-28 09:45:02 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2015-07-19 10:37:11 +0300 |
commit | bd2ab27c488ae92c7820efe11d4f53d84e94d58e (patch) | |
tree | eef97a58b304750431aef9302e6c6b36a6568872 /cmdutils.c | |
parent | 6d5d9246042acb804a652e6fedfb7afe0ca85614 (diff) |
avconv: use read_file() for reading the 2pass stats
Also, drop the now unused cmdutils_read_file(). There is no reason to
have two functions doing essentially the same thing.
Diffstat (limited to 'cmdutils.c')
-rw-r--r-- | cmdutils.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/cmdutils.c b/cmdutils.c index bc22ef5839..e5cba98a60 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1396,61 +1396,6 @@ int read_yesno(void) return yesno; } -int cmdutils_read_file(const char *filename, char **bufptr, size_t *size) -{ - int ret; - FILE *f = fopen(filename, "rb"); - - if (!f) { - av_log(NULL, AV_LOG_ERROR, "Cannot read file '%s': %s\n", filename, - strerror(errno)); - return AVERROR(errno); - } - - ret = fseek(f, 0, SEEK_END); - if (ret == -1) { - ret = AVERROR(errno); - goto out; - } - - ret = ftell(f); - if (ret < 0) { - ret = AVERROR(errno); - goto out; - } - *size = ret; - - ret = fseek(f, 0, SEEK_SET); - if (ret == -1) { - ret = AVERROR(errno); - goto out; - } - - *bufptr = av_malloc(*size + 1); - if (!*bufptr) { - av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n"); - ret = AVERROR(ENOMEM); - goto out; - } - ret = fread(*bufptr, 1, *size, f); - if (ret < *size) { - av_free(*bufptr); - if (ferror(f)) { - av_log(NULL, AV_LOG_ERROR, "Error while reading file '%s': %s\n", - filename, strerror(errno)); - ret = AVERROR(errno); - } else - ret = AVERROR_EOF; - } else { - ret = 0; - (*bufptr)[(*size)++] = '\0'; - } - -out: - fclose(f); - return ret; -} - void init_pts_correction(PtsCorrectionContext *ctx) { ctx->num_faulty_pts = ctx->num_faulty_dts = 0; |