Mercurial > mplayer.hg
changeset 33361:b433bc008e23
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.
author | ib |
---|---|
date | Mon, 09 May 2011 11:17:43 +0000 |
parents | c36ab8db37f6 |
children | bf3f244d7bc1 |
files | gui/mplayer/gui_common.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/mplayer/gui_common.c Sun May 08 18:44:43 2011 +0000 +++ b/gui/mplayer/gui_common.c Mon May 09 11:17:43 2011 +0000 @@ -154,6 +154,8 @@ 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 @@ 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 @@ 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;