[MPlayer-dev-eng] [PATCH] (non-gui, audio-only) time format to hh:mm:ss.f
Robert M. Riches Jr
rm.riches at verizon.net
Fri May 23 19:47:56 CEST 2003
Andriy N. Gritsenko, andrej at lucky.net, wrote:
> Try in Mutt's compose menu to press a key ^E then ^U and type base64.
> It'll work. :)
Thanks for the info and for patience with a novice to
attachments. I think I have it figured out.
This patch converts the format of printed time (in non-gui,
audio-only mode) from pure seconds (and one fraction digit)
to hh:mm:ss.f to try to be more user-friendly. I have used
this patch for a few weeks (on 9.0rc4). A fresh build from
latest CVS as of this morning tested fine. Okay, the coding
isn't too elegant, but it should be reasonably efficient and
testing shows it to work.
Thanks for considering this tiny attempt at a contribution.
Robert Riches
rm.riches at verizon.net
-------------- next part --------------
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.695
diff -u -r1.695 mplayer.c
--- mplayer.c 23 May 2003 15:01:02 -0000 1.695
+++ mplayer.c 23 May 2003 17:32:32 -0000
@@ -1919,11 +1919,46 @@
if(!sh_video) {
// handle audio-only case:
- if(!quiet) mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A:%6.1f %4.1f%% %d%% \r"
- ,sh_audio->delay-audio_out->get_delay()
+ if(!quiet) {
+ //
+ // convert time to HH:MM:SS.F format
+ //
+ long tenths = 10 * sh_audio->delay-audio_out->get_delay();
+ int hh = (tenths / 36000) % 100;
+ int mm = (tenths / 600) % 60;
+ int ss = (tenths / 10) % 60;
+ int f1 = tenths % 10;
+ char hhmmssf[16]; // only really need 11, but just in case...
+ sprintf( hhmmssf, "%2d:%2d:%2d.%1d", hh, mm, ss, f1);
+ if (0 == hh) {
+ hhmmssf[1] = ' ';
+ hhmmssf[2] = ' ';
+ }
+ // uncomment the next three lines to show leading zero ten-hours
+ // else if (' ' == hhmmssf[0]) {
+ // hhmmssf[0] = '0';
+ // }
+ if ((0 == hh) && (0 == mm)) {
+ hhmmssf[4] = ' ';
+ hhmmssf[5] = ' ';
+ }
+ else if ((' ' == hhmmssf[3]) && (' ' != hhmmssf[2])) {
+ hhmmssf[3] = '0';
+ }
+ if ((' ' == hhmmssf[6]) && (' ' != hhmmssf[5])) {
+ hhmmssf[6] = '0';
+ }
+ //
+ // Instructions for sending patches say to not
+ // change indentation or whitespace, so the following
+ // statement is indented as the original.
+ //
+ mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A: %s %4.1f%% %d%% \r"
+ ,hhmmssf
,(sh_audio->delay>0.5)?100.0*audio_time_usage/(double)sh_audio->delay:0
,cache_fill_status
);
+ }
if(d_audio->eof) eof = PT_NEXT_ENTRY;
} else {
More information about the MPlayer-dev-eng
mailing list