[MPlayer-dev-eng] [PATCH] sub/a-v delay display rounding (final)
Oskar Liljeblad
oskar at osk.mine.nu
Thu Dec 5 19:32:56 CET 2002
On Thursday, December 05, 2002 at 08:56, Dominik Mierzejewski wrote:
> > 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.
>
> _GNU_SOURCE covers both of these (and some more). See /usr/include/features.h.
True... And the only system that uses _BSD_SOURCE and _ISOC99_SOURCE
defines is GNU. Here's the final patch, against CVS as of today:
Oskar (oskar at osk.mine.nu)
diff -u -p mplayer.c.v0 mplayer.c
--- mplayer.c.v0 2002-12-05 19:29:27.000000000 +0100
+++ mplayer.c 2002-12-05 19:30:21.000000000 +0100
@@ -1,9 +1,11 @@
// Movie Player v0.90 (C) 2000-2002. by A'rpi/ESP-team & `cat AUTHORS`
+#define _GNU_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>
@@ -2738,7 +2740,7 @@ if(rel_seek_secs || abs_seek_pos){
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: %d ms", lround(sub_delay*1000));
osd_show_sub_delay--;
} else
if (osd_show_sub_pos) {
@@ -2746,7 +2748,7 @@ if(rel_seek_secs || abs_seek_pos){
osd_show_sub_pos--;
} 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: %d 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