[MPlayer-dev-eng] [PATCH] sub/a-v delay display rounding
Oskar Liljeblad
oskar at osk.mine.nu
Thu Dec 5 08:01:42 CET 2002
On Thursday, December 05, 2002 at 01:17, Arpi wrote:
> Hi,
>
> ok i've got some time so i collected patches from list (only [PATCHES]
> mails) and applied most of them:
Great, thanks for applying the patches. I forgot to make one of the patches
I sent with [PATCH], so here's another one (very simple) that I'd like to
see applied:
This patch prevents sub and A-V delays from being displayed as
-2799 ms instead of -2800 ms etc.
Note: apparently round and lround only officially exist in C99
according to gcc. Therefore it is necessary to define
_ISOC99_SOURCE. And when you do this, BSD functions aren't
included by default. So you have to define _BSD_SOURCE as well.
You won't need these two unless you compile with -Wall.
Oskar Liljeblad (oskar at osk.mine.nu)
--- mplayer.c.orig 2002-11-29 01:58:06.000000000 +0100
+++ mplayer.c 2002-11-30 15:51:11.000000000 +0100
@@ -1,9 +1,12 @@
// Movie Player v0.90 (C) 2000-2002. by A'rpi/ESP-team & `cat AUTHORS`
+#define _ISOC99_SOURCE // for lround
+#define _BSD_SOURCE // for usleep with _ISOC99_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <math.h> // for lround
#include <sys/ioctl.h>
// #include <sys/mman.h>
@@ -2719,11 +2722,11 @@
osd_show_vobsub_changed--;
} else
if (osd_show_sub_delay) {
- sprintf(osd_text_tmp, "Sub delay: %d ms",(int)(sub_delay*1000));
+ sprintf(osd_text_tmp, "Sub delay: %ld ms", lround(sub_delay*1000));
osd_show_sub_delay--;
} else
if (osd_show_av_delay) {
- sprintf(osd_text_tmp, "A-V delay: %d ms",(int)(audio_delay*1000));
+ sprintf(osd_text_tmp, "A-V delay: %ld ms", lround(audio_delay*1000));
osd_show_av_delay--;
} else if(osd_level>=2)
sprintf(osd_text_tmp,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60);
More information about the MPlayer-dev-eng
mailing list