mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 22:16:22 +00:00
flvmux: Use GDateTime instead of gmtime()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6872>
This commit is contained in:
parent
a6a1fd03cc
commit
441e71d1ff
1 changed files with 9 additions and 11 deletions
|
@ -1180,8 +1180,7 @@ gst_flv_mux_create_metadata (GstFlvMux * mux)
|
||||||
tag_string = NULL;
|
tag_string = NULL;
|
||||||
|
|
||||||
{
|
{
|
||||||
time_t secs;
|
GDateTime *now;
|
||||||
struct tm tm;
|
|
||||||
gchar *s;
|
gchar *s;
|
||||||
static const gchar *weekdays[] = {
|
static const gchar *weekdays[] = {
|
||||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||||
|
@ -1191,16 +1190,15 @@ gst_flv_mux_create_metadata (GstFlvMux * mux)
|
||||||
"Aug", "Sep", "Oct", "Nov", "Dec"
|
"Aug", "Sep", "Oct", "Nov", "Dec"
|
||||||
};
|
};
|
||||||
|
|
||||||
secs = g_get_real_time () / G_USEC_PER_SEC;
|
now = g_date_time_new_now_utc ();
|
||||||
#ifdef HAVE_GMTIME_R
|
|
||||||
gmtime_r (&secs, &tm);
|
|
||||||
#else
|
|
||||||
tm = *gmtime (&secs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
s = g_strdup_printf ("%s %s %d %02d:%02d:%02d %d", weekdays[tm.tm_wday],
|
s = g_strdup_printf ("%s %s %u %02u:%02u:%02u %u",
|
||||||
months[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
|
weekdays[g_date_time_get_day_of_week (now)],
|
||||||
tm.tm_year + 1900);
|
months[g_date_time_get_month (now)], g_date_time_get_day_of_month (now),
|
||||||
|
g_date_time_get_hour (now), g_date_time_get_minute (now),
|
||||||
|
g_date_time_get_second (now), g_date_time_get_year (now));
|
||||||
|
|
||||||
|
g_date_time_unref (now);
|
||||||
|
|
||||||
_gst_buffer_new_and_alloc (2 + 12 + 1 + 2 + strlen (s), &tmp, &data);
|
_gst_buffer_new_and_alloc (2 + 12 + 1 + 2 + strlen (s), &tmp, &data);
|
||||||
data[0] = 0; /* 12 bytes name */
|
data[0] = 0; /* 12 bytes name */
|
||||||
|
|
Loading…
Reference in a new issue