diff command.c @ 23416:ae4237717601

Move the time printing code out of the length property.
author albeu
date Thu, 31 May 2007 12:42:02 +0000
parents f6c225ffe60d
children a829005cbcd5
line wrap: on
line diff
--- a/command.c	Thu May 31 12:37:37 2007 +0000
+++ b/command.c	Thu May 31 12:42:02 2007 +0000
@@ -283,28 +283,7 @@
 	!(int) (len = demuxer_get_time_length(mpctx->demuxer)))
 	return M_PROPERTY_UNAVAILABLE;
 
-    switch (action) {
-    case M_PROPERTY_PRINT:
-	if (!arg)
-	    return M_PROPERTY_ERROR;
-	else {
-	    int h, m, s = len;
-	    h = s / 3600;
-	    s -= h * 3600;
-	    m = s / 60;
-	    s -= m * 60;
-	    *(char **) arg = malloc(20);
-	    if (h > 0)
-		sprintf(*(char **) arg, "%d:%02d:%02d", h, m, s);
-	    else if (m > 0)
-		sprintf(*(char **) arg, "%d:%02d", m, s);
-	    else
-		sprintf(*(char **) arg, "%d", s);
-	    return M_PROPERTY_OK;
-	}
-	break;
-    }
-    return m_property_double_ro(prop, action, arg, len);
+    return m_property_time_ro(prop, action, arg, len);
 }
 
 /// Demuxer meta data