diff -ur vanilla/main/DOCS/documentation.html main/DOCS/documentation.html --- vanilla/main/DOCS/documentation.html Mon Aug 12 18:20:49 2002 +++ main/DOCS/documentation.html Tue Aug 13 11:14:52 2002 @@ -878,6 +878,9 @@

You can change default behaviour by setting osdlevel= variable in config file.

+

If you would like to see also the total movie time and the + percentage already played, you may try the -longosd + option.

1.6 RTC

diff -ur vanilla/main/DOCS/mplayer.1 main/DOCS/mplayer.1 --- vanilla/main/DOCS/mplayer.1 Mon Aug 12 18:21:07 2002 +++ main/DOCS/mplayer.1 Tue Aug 13 11:11:42 2002 @@ -621,6 +621,9 @@ Specifies which mode the OSD should start in (0: none, 1: seek, 2: seek+timer, default is 1). .TP +.B \-longosd (MPLAYER only) +Enables extended OSD display (timer+total time+percentage). +.TP .B \-sid (also see -slang option) Turns on DVD subtitle displaying. Also, you MUST specify a number which corresponds to a DVD subtitle language (0\-31). For the list of available diff -ur vanilla/main/cfg-mplayer.h main/cfg-mplayer.h --- vanilla/main/cfg-mplayer.h Mon Aug 5 18:55:01 2002 +++ main/cfg-mplayer.h Tue Aug 13 16:28:34 2002 @@ -58,6 +58,7 @@ #ifdef USE_OSD extern int osd_level; +extern int long_osd; #endif extern char *ao_outputfilename; @@ -289,7 +290,9 @@ //---------------------- mplayer-only options ------------------------ - {"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , NULL}, +#define MAX_OSD_LEVEL 2 + {"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, MAX_OSD_LEVEL , NULL}, + {"longosd", &long_osd, CONF_TYPE_FLAG, 0, 0, 1 , NULL}, // these should be moved to -common, and suppot in mencoder too {"vobsub", &vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL}, diff -ur vanilla/main/mplayer.c main/mplayer.c --- vanilla/main/mplayer.c Mon Aug 12 18:20:31 2002 +++ main/mplayer.c Tue Aug 13 16:28:34 2002 @@ -171,6 +171,7 @@ int use_gui=0; +int long_osd; int osd_level=1; int osd_visible=100; @@ -2091,7 +2092,7 @@ break; case 'o': // toggle OSD if(sh_video) - osd_level=(osd_level+1)%3; + osd_level=(osd_level+1)%(MAX_OSD_LEVEL+1); break; case 'z': sub_delay -= 0.1; @@ -2371,9 +2372,9 @@ if(sh_video) { int v = cmd->args[0].v.i; if(v < 0) - osd_level=(osd_level+1)%3; + osd_level=(osd_level+1)%(MAX_OSD_LEVEL+1); else - osd_level= v > 2 ? 2 : v; + osd_level= v > MAX_OSD_LEVEL ? MAX_OSD_LEVEL : v; } break; case MP_CMD_VOLUME : { int v = cmd->args[0].v.i; @@ -2983,9 +2984,35 @@ if (osd_show_av_delay) { sprintf(osd_text_tmp, "A-V delay: %d ms",(int)(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); - else osd_text_tmp[0]=0; + } else if(osd_level>=2) { + if (long_osd) { + int osd_pos = -1; + int total_time = -1; + char perc_text_tmp[50]; + if(demuxer->file_format==DEMUXER_TYPE_AVI && sh_video->video.dwLength>2){ + osd_pos=d_video->pack_no*100/sh_video->video.dwLength; + total_time=sh_video->video.dwLength/sh_video->fps; + } else { + off_t len = ( demuxer->movi_end - demuxer->movi_start ); + off_t pos = ( demuxer->file_format == DEMUXER_TYPE_AUDIO?stream->pos:demuxer->filepos ); + osd_pos=(len <= 0 ? -1 : ( pos - demuxer->movi_start ) * 100 / len); + total_time=((len <= 0 || sh_video->i_bps <= 0) ? -1 : len/sh_video->i_bps); + } + if (osd_pos >= 0) { + sprintf(perc_text_tmp, " - %d%%", osd_pos); + } else { + sprintf(perc_text_tmp, ""); + } + if (total_time >= 0) { + sprintf(osd_text_tmp,"%c %02d:%02d:%02d|%02d:%02d:%02d%s",osd_function,pts/3600,(pts/60)%60,pts%60, + total_time/3600,(total_time/60)%60,total_time%60,perc_text_tmp); + } else { + sprintf(osd_text_tmp,"%c %02d:%02d:%02d%s",osd_function,pts/3600,(pts/60)%60,pts%60,perc_text_tmp); + } + } else { + sprintf(osd_text_tmp,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60); + } + } else osd_text_tmp[0]=0; if(strcmp(vo_osd_text, osd_text_tmp)) { strcpy(vo_osd_text, osd_text_tmp);