Commit a104af03 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Move duration_string to utils.c

parent 2eb0078a
......@@ -57,3 +57,17 @@ create_image(Evas_Object *parent, const char *image_path)
return img;
}
char *
duration_string(int64_t duration)
{
lldiv_t d;
long long sec;
char *str;
d = lldiv(duration, 60);
sec = d.rem;
d = lldiv(d.quot, 60);
asprintf(&str, "%02lld:%02lld:%02lld", d.quot, d.rem, sec);
return str;
}
......@@ -32,5 +32,8 @@ create_icon(Evas_Object *parent, const char *icon_name);
Evas_Object*
create_image(Evas_Object *parent, const char *image_path);
char *
duration_string(int64_t duration);
#endif /* UTILS_H_ */
......@@ -75,21 +75,6 @@ free_list_item(void *data, Evas_Object *obj, void *event_info)
free(vli);
}
static char *
duration_string(int64_t duration)
{
lldiv_t d;
long long sec;
char *str;
duration /= 1000;
d = lldiv(duration, 60);
sec = d.rem;
d = lldiv(d.quot, 60);
asprintf(&str, "%02lld:%02lld:%02lld", d.quot, d.rem, sec);
return str;
}
static char *
genlist_text_get_cb(void *data, Evas_Object *obj, const char *part)
{
......@@ -108,7 +93,7 @@ genlist_text_get_cb(void *data, Evas_Object *obj, const char *part)
if(vli->p_media_item->i_duration < 0)
return NULL;
else
return duration_string(vli->p_media_item->i_duration);
return duration_string(vli->p_media_item->i_duration/1000);
}
else if (!strcmp(part, "elm.text.sub.right.bottom")) {
if (vli->p_media_item->i_w <= 0 || vli->p_media_item->i_h <= 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment