[MPlayer-dev-eng] [PATCH] round delay properly
Oskar Liljeblad
oskar at osk.mine.nu
Thu Dec 26 00:45:41 CET 2002
This patch makes subtitle and A-V delays display correctly rounded
("3800 ms" instead of "3799 ms" etc).
(I submitted this some time ago, but it was not applied. This
new patch doesn't define _BSD_SOURCE or _ISOC99_SOURCE, only
_GNU_SOURCE. It shouldn't matter though, since only GNU systems
care.)
Oskar (oskar at osk.mine.nu)
-------------- next part --------------
diff -u -p mplayer.c.v0 mplayer.c
--- mplayer.c.v0 2002-12-26 00:35:39.000000000 +0100
+++ mplayer.c 2002-12-26 00:36:23.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>
#include <sys/ioctl.h>
// #include <sys/mman.h>
@@ -2925,7 +2927,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) {
@@ -2939,7 +2941,7 @@ if(rel_seek_secs || abs_seek_pos){
osd_show_sub_alignment--;
} 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