#endif
struct tm *t;
time_t now;
+#ifdef G_OS_WIN32
+ gunichar2 buf[256];
+#else
gchar buf[256];
+#endif
now = time (NULL);
if (t == NULL)
return g_strdup ("--:--:--");
+#ifdef G_OS_WIN32
+ if (wcsftime (buf, sizeof (buf), (wchar_t *) overlay->wformat, t) == 0)
+ return g_strdup ("");
+
+ return g_utf16_to_utf8 (buf, -1, NULL, NULL, NULL);
+#else
if (strftime (buf, sizeof (buf), overlay->format, t) == 0)
return g_strdup ("");
+
return g_strdup (buf);
+#endif
}
/* Called with lock held */
txt = g_strdup (overlay->default_text);
+ GST_OBJECT_LOCK (overlay);
time_str = gst_clock_overlay_render_time (clock_overlay);
+ GST_OBJECT_UNLOCK (overlay);
+
if (txt != NULL && *txt != '\0') {
ret = g_strdup_printf ("%s %s", txt, time_str);
} else {
g_free (overlay->text);
overlay->format = NULL;
+ g_free (overlay->wformat);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
overlay->format = g_strdup (DEFAULT_PROP_TIMEFORMAT);
+#ifdef G_OS_WIN32
+ overlay->wformat =
+ g_utf8_to_utf16 (DEFAULT_PROP_TIMEFORMAT, -1, NULL, NULL, NULL);
+#endif
+
context = textoverlay->pango_context;
pango_context_set_language (context, pango_language_from_string ("en_US"));
case PROP_TIMEFORMAT:
g_free (overlay->format);
overlay->format = g_value_dup_string (value);
+ if (!overlay->format)
+ overlay->format = g_strdup (DEFAULT_PROP_TIMEFORMAT);
+#ifdef G_OS_WIN32
+ g_free (overlay->wformat);
+ overlay->wformat =
+ g_utf8_to_utf16 (overlay->format, -1, NULL, NULL, NULL);
+#endif
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);