[Mplayer-cvslog] CVS: main mplayer.c,1.633,1.634

Arpi of Ize arpi at mplayerhq.hu
Sat Dec 28 15:17:41 CET 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv27759

Modified Files:
	mplayer.c 
Log Message:
It shows not just the progressbar, but progressbar /and/ percentage
for osd levels 2 and 3, and inaddition it adds a new osd level (3)
which also shows total time.
patch by seru <seru at gmx.net>


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.633
retrieving revision 1.634
diff -u -r1.633 -r1.634
--- mplayer.c	28 Dec 2002 13:53:31 -0000	1.633
+++ mplayer.c	28 Dec 2002 14:17:38 -0000	1.634
@@ -179,6 +179,7 @@
 float playback_speed=1.0;
 
 int use_gui=0;
+#define MAX_OSD_LEVEL 3
 
 int osd_level=1;
 int osd_level_saved=-1;
@@ -578,6 +579,7 @@
 int osd_show_sub_visibility = 0;
 int osd_show_sub_alignment = 0;
 int osd_show_vobsub_changed = 0;
+int osd_show_percentage = 0;
 
 int rtc_fd=-1;
 
@@ -2104,6 +2106,7 @@
     switch(cmd->id) {
     case MP_CMD_SEEK : {
       int v,abs;
+      osd_show_percentage = 25;
       if ( stream->type == STREAMTYPE_STREAM ) break;
       v = cmd->args[0].v.i;
       abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
@@ -2201,9 +2204,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;
@@ -2942,9 +2945,23 @@
       if (osd_show_av_delay) {
 	  sprintf(osd_text_tmp, "A-V delay: %d ms", ROUND(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) {
+          int len = demuxer_get_time_length(demuxer);
+          int percentage = -1;
+          char percentage_text[50];
+          if (osd_show_percentage) {
+            percentage = demuxer_get_percent_pos(demuxer);
+            osd_show_percentage--;
+          }
+          if (percentage >= 0)
+            sprintf(percentage_text, " (%d%%)", percentage);
+          else
+            sprintf(percentage_text, "");
+          if (osd_level == 3) 
+            sprintf(osd_text_tmp,"%c %02d:%02d:%02d / %02d:%02d:%02d%s",osd_function,pts/3600,(pts/60)%60,pts%60,len/3600,(len/60)%60,len%60,percentage_text);
+          else
+            sprintf(osd_text_tmp,"%c %02d:%02d:%02d%s",osd_function,pts/3600,(pts/60)%60,pts%60,percentage_text);
+      } else osd_text_tmp[0]=0;
       
       if(strcmp(vo_osd_text, osd_text_tmp)) {
 	      strcpy(vo_osd_text, osd_text_tmp);




More information about the MPlayer-cvslog mailing list