[MPlayer-cvslog] r33448 - trunk/gui/mplayer/gui_common.c

ib subversion at mplayerhq.hu
Mon May 9 13:17:43 CEST 2011


Author: ib
Date: Mon May  9 13:17:43 2011
New Revision: 33448

Log:
Check for reasonable time values.

Some A/V files don't provide reasonable time information in which case
the GUI produces a junk dlabel, so set values to zero.

Modified:
   trunk/gui/mplayer/gui_common.c

Modified: trunk/gui/mplayer/gui_common.c
==============================================================================
--- trunk/gui/mplayer/gui_common.c	Sun May  8 20:44:43 2011	(r33447)
+++ trunk/gui/mplayer/gui_common.c	Mon May  9 13:17:43 2011	(r33448)
@@ -154,6 +154,8 @@ static char *Translate(char *str)
             case '1':
                 t = guiIntfStruct.TimeSec;
 calclengthhhmmss:
+                if (t < 0)
+                    t = 0;
                 snprintf(tmp, sizeof(tmp), "%02d:%02d:%02d", t / 3600, t / 60 % 60, t % 60);
                 av_strlcat(trbuf, tmp, sizeof(trbuf));
                 break;
@@ -165,6 +167,8 @@ calclengthhhmmss:
             case '2':
                 t = guiIntfStruct.TimeSec;
 calclengthmmmmss:
+                if (t < 0)
+                    t = 0;
                 snprintf(tmp, sizeof(tmp), "%04d:%02d", t / 60, t % 60);
                 av_strlcat(trbuf, tmp, sizeof(trbuf));
                 break;
@@ -185,7 +189,10 @@ calclengthmmmmss:
                 break;
 
             case '8':
-                snprintf(tmp, sizeof(tmp), "%01d:%02d:%02d", guiIntfStruct.TimeSec / 3600, (guiIntfStruct.TimeSec / 60) % 60, guiIntfStruct.TimeSec % 60);
+                t = guiIntfStruct.TimeSec;
+                if (t < 0)
+                    t = 0;
+                snprintf(tmp, sizeof(tmp), "%01d:%02d:%02d", t / 3600, (t / 60) % 60, t % 60);
                 av_strlcat(trbuf, tmp, sizeof(trbuf));
                 break;
 


More information about the MPlayer-cvslog mailing list