mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
gst-launch: pretty-print datetime tags
This commit is contained in:
parent
c8b3bdbf63
commit
d6aec1acc3
1 changed files with 25 additions and 0 deletions
|
@ -296,6 +296,31 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
|
|||
} else {
|
||||
str = g_strdup ("NULL buffer");
|
||||
}
|
||||
} else if (gst_tag_get_type (tag) == GST_TYPE_DATE_TIME) {
|
||||
GstDateTime *dt = NULL;
|
||||
|
||||
gst_tag_list_get_date_time_index (list, tag, i, &dt);
|
||||
if (gst_date_time_get_hour (dt) < 0) {
|
||||
str = g_strdup_printf ("%02u-%02u-%04u", gst_date_time_get_day (dt),
|
||||
gst_date_time_get_month (dt), gst_date_time_get_year (dt));
|
||||
} else {
|
||||
gdouble tz_offset = gst_date_time_get_time_zone_offset (dt);
|
||||
gchar tz_str[32];
|
||||
|
||||
if (tz_offset != 0.0) {
|
||||
g_snprintf (tz_str, sizeof (tz_str), "(UTC %s%gh)",
|
||||
(tz_offset > 0.0) ? "+" : "", tz_offset);
|
||||
} else {
|
||||
g_snprintf (tz_str, sizeof (tz_str), "(UTC)");
|
||||
}
|
||||
|
||||
str = g_strdup_printf ("%04u-%02u-%02u %02u:%02u:%02u %s",
|
||||
gst_date_time_get_year (dt), gst_date_time_get_month (dt),
|
||||
gst_date_time_get_day (dt), gst_date_time_get_hour (dt),
|
||||
gst_date_time_get_minute (dt), gst_date_time_get_second (dt),
|
||||
tz_str);
|
||||
}
|
||||
gst_date_time_unref (dt);
|
||||
} else {
|
||||
str =
|
||||
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
|
||||
|
|
Loading…
Reference in a new issue