bad: Avoid using deprecated API

GTimeval is deprecated
This commit is contained in:
Edward Hervey 2019-11-06 14:36:11 +01:00 committed by Edward Hervey
parent dca3e47bce
commit 7bceb6c3ff
6 changed files with 13 additions and 22 deletions

View file

@ -359,8 +359,7 @@ gst_motion_cells_init (GstMotioncells * filter)
filter->prev_buff_timestamp = 0;
filter->cur_buff_timestamp = 0;
filter->diff_timestamp = -1;
g_get_current_time (&filter->tv);
filter->starttime = 1000 * filter->tv.tv_sec;
filter->starttime = 1000 * g_get_real_time();
filter->previous_motion = FALSE;
filter->changed_datafile = FALSE;
filter->postallmotion = FALSE;

View file

@ -86,7 +86,6 @@ struct _GstMotioncells
gint64 diff_timestamp, starttime;
guint64 consecutive_motion;
gint width, height;
GTimeVal tv;
double framerate;
//Video width and height are known in "gst_motion_cells_handle_sink_event",
// but not when setting the "motionmaskcoords".

View file

@ -480,14 +480,12 @@ gst_adaptive_demux_init (GstAdaptiveDemux * demux,
} else {
GDateTime *utc_now;
GstClockTime rtc_now;
GTimeVal gtv;
utc_now = g_date_time_new_now_utc ();
rtc_now = gst_clock_get_time (demux->realtime_clock);
g_date_time_to_timeval (utc_now, &gtv);
demux->clock_offset =
gtv.tv_sec * G_TIME_SPAN_SECOND + gtv.tv_usec -
GST_TIME_AS_USECONDS (rtc_now);
g_date_time_to_unix (utc_now) * G_TIME_SPAN_SECOND +
g_date_time_get_microsecond (utc_now) - GST_TIME_AS_USECONDS (rtc_now);
g_date_time_unref (utc_now);
}
g_rec_mutex_init (&demux->priv->updates_lock);
@ -4478,14 +4476,10 @@ GDateTime *
gst_adaptive_demux_get_client_now_utc (GstAdaptiveDemux * demux)
{
GstClockTime rtc_now;
gint64 utc_now;
GTimeVal gtv;
rtc_now = gst_clock_get_time (demux->realtime_clock);
utc_now = demux->clock_offset + GST_TIME_AS_USECONDS (rtc_now);
gtv.tv_sec = utc_now / G_TIME_SPAN_SECOND;
gtv.tv_usec = utc_now % G_TIME_SPAN_SECOND;
return g_date_time_new_from_timeval_utc (&gtv);
return g_date_time_new_from_unix_utc (demux->clock_offset +
GST_TIME_AS_USECONDS (rtc_now));
}
/**

View file

@ -36,7 +36,6 @@ struct _GstUriDownloaderPrivate
GstElement *urisrc;
GstBus *bus;
GstPad *pad;
GTimeVal *timeout;
GstFragment *download;
gboolean got_buffer;
GMutex download_lock; /* used to restrict to one download only */

View file

@ -240,14 +240,14 @@ gst_asf_payload_free (AsfPayload * payload)
guint64
gst_asf_get_current_time (void)
{
GTimeVal timeval;
gint64 now;
guint64 secs;
guint64 usecs;
g_get_current_time (&timeval);
now = g_get_real_time ();
secs = (guint64) timeval.tv_sec;
usecs = (guint64) timeval.tv_usec;
secs = (guint64) now / G_USEC_PER_SEC;
usecs = (guint64) now % G_USEC_PER_SEC;
return secs * G_GUINT64_CONSTANT (10000000) + usecs * 10
+ G_GUINT64_CONSTANT (116444628000000000);
}

View file

@ -555,7 +555,7 @@ mxf_timestamp_to_string (const MXFTimestamp * t, gchar str[32])
void
mxf_timestamp_set_now (MXFTimestamp * timestamp)
{
GTimeVal tv;
gint64 now;
time_t t;
struct tm *tm;
@ -563,8 +563,8 @@ mxf_timestamp_set_now (MXFTimestamp * timestamp)
struct tm tm_;
#endif
g_get_current_time (&tv);
t = (time_t) tv.tv_sec;
now = g_get_real_time ();
t = now / G_USEC_PER_SEC;
#ifdef HAVE_GMTIME_R
tm = gmtime_r (&t, &tm_);
@ -578,7 +578,7 @@ mxf_timestamp_set_now (MXFTimestamp * timestamp)
timestamp->hour = tm->tm_hour;
timestamp->minute = tm->tm_min;
timestamp->second = tm->tm_sec;
timestamp->msecond = tv.tv_usec / 1000;
timestamp->msecond = now / 1000;
}
void