[FFmpeg-devel] [PATCH] libavformat: Fix rounding error

Michael Niedermayer michaelni at gmx.at
Wed Oct 31 18:49:25 CET 2012


On Wed, Oct 31, 2012 at 04:52:15PM +0100, Johan Wessfeldt wrote:
> This patch fixes a rounding error when printing
> the micro seconds part of the duration.
> 
> Signed-off-by: Johan Wessfeldt <johan.wessfeldt at gmail.com>
> ---
>  libavformat/utils.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index fb5742b..c81b641 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -3361,7 +3361,7 @@ void av_dump_format(AVFormatContext *ic,
>              hours = mins / 60;
>              mins %= 60;
>              av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
> -                   (100 * us) / AV_TIME_BASE);
> +                   (int)( (100.0f * us) / AV_TIME_BASE + 0.5f) );
>          } else {

fixed without floats

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121031/f471ee50/attachment.asc>


More information about the ffmpeg-devel mailing list