[FFmpeg-devel] [PATCH 4/4] ffprobe: use avio_size() instead of deprecated file_size attribute.

Stefano Sabatini stefasab at gmail.com
Sat Nov 5 14:15:56 CET 2011


On date Saturday 2011-11-05 13:30:52 +0100, Clément Bœsch encoded:
> ---
>  ffprobe.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/ffprobe.c b/ffprobe.c
> index 4ee87ec..0e50bc9 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -757,7 +757,7 @@ static void show_format(WriterContext *w, AVFormatContext *fmt_ctx)
>      print_str("format_long_name", fmt_ctx->iformat->long_name);
>      print_str("start_time",       time_value_string(val_str, sizeof(val_str), fmt_ctx->start_time, &AV_TIME_BASE_Q));
>      print_str("duration",         time_value_string(val_str, sizeof(val_str), fmt_ctx->duration,   &AV_TIME_BASE_Q));
> -    print_str("size",             value_string(val_str, sizeof(val_str), fmt_ctx->file_size, unit_byte_str));
> +    print_str("size",             value_string(val_str, sizeof(val_str), avio_size(fmt_ctx->pb), unit_byte_str));

This prints a negative number in case of error (e.g. in case the
format is not seekable), which should be avoided, you might add a
check on the return value.
-- 
FFmpeg = Forgiving & Fostering Multimedia Prodigious Epic Game


More information about the ffmpeg-devel mailing list