GTimeval and related functions are now deprecated in glib.
Replacement APIs have been present since 2.26
gboolean more;
gboolean flushing;
GstClockTime now;
- GTimeVal nowtv;
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
GstMultiHandleSinkClass *mhsinkclass =
GST_MULTI_HANDLE_SINK_GET_CLASS (mhsink);
do {
gint maxsize;
- g_get_current_time (&nowtv);
- now = GST_TIMEVAL_TO_TIME (nowtv);
+ now = g_get_real_time () * GST_USECOND;
if (!mhclient->sending) {
/* client is not working on a buffer */
* and will not disconnect inactive client in the streaming thread. */
if (G_UNLIKELY (result == 0)) {
GstClockTime now;
- GTimeVal nowtv;
- g_get_current_time (&nowtv);
- now = GST_TIMEVAL_TO_TIME (nowtv);
+ now = g_get_real_time () * GST_USECOND;
CLIENTS_LOCK (mhsink);
for (clients = mhsink->clients; clients; clients = next) {
gst_multi_handle_sink_client_init (GstMultiHandleClient * client,
GstSyncMethod sync_method)
{
- GTimeVal now;
-
client->status = GST_CLIENT_STATUS_OK;
client->bufpos = -1;
client->flushcount = -1;
client->currently_removing = FALSE;
/* update start time */
- g_get_current_time (&now);
- client->connect_time = GST_TIMEVAL_TO_TIME (now);
+ client->connect_time = g_get_real_time () * GST_USECOND;
client->disconnect_time = 0;
/* set last activity time to connect time */
client->last_activity_time = client->connect_time;
result = gst_structure_new_empty ("multihandlesink-stats");
if (mhclient->disconnect_time == 0) {
- GTimeVal nowtv;
-
- g_get_current_time (&nowtv);
-
- interval = GST_TIMEVAL_TO_TIME (nowtv) - mhclient->connect_time;
+ interval = (g_get_real_time () * GST_USECOND) - mhclient->connect_time;
} else {
interval = mhclient->disconnect_time - mhclient->connect_time;
}
gst_multi_handle_sink_remove_client_link (GstMultiHandleSink * sink,
GList * link)
{
- GTimeVal now;
GstMultiHandleClient *mhclient = (GstMultiHandleClient *) link->data;
GstMultiHandleSinkClass *mhsinkclass = GST_MULTI_HANDLE_SINK_GET_CLASS (sink);
mhsinkclass->hash_removing (sink, mhclient);
- g_get_current_time (&now);
- mhclient->disconnect_time = GST_TIMEVAL_TO_TIME (now);
+ mhclient->disconnect_time = g_get_real_time () * GST_USECOND;
/* free client buffers */
g_slist_foreach (mhclient->sending, (GFunc) gst_mini_object_unref, NULL);
gboolean hash_changed = FALSE;
gint max_buffer_usage;
gint i;
- GTimeVal nowtv;
GstClockTime now;
gint max_buffers, soft_max_buffers;
guint cookie;
}
max_buffer_usage = 0;
- g_get_current_time (&nowtv);
- now = GST_TIMEVAL_TO_TIME (nowtv);
+ now = g_get_real_time () * GST_USECOND;
/* now check for new or slow clients */
restart:
gboolean more;
gboolean flushing;
GstClockTime now;
- GTimeVal nowtv;
GError *err = NULL;
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
GstMultiHandleClient *mhclient = (GstMultiHandleClient *) client;
GST_MULTI_HANDLE_SINK_GET_CLASS (mhsink);
- g_get_current_time (&nowtv);
- now = GST_TIMEVAL_TO_TIME (nowtv);
+ now = g_get_real_time () * GST_USECOND;
flushing = mhclient->status == GST_CLIENT_STATUS_FLUSHING;
gst_multi_socket_sink_timeout (GstMultiSocketSink * sink)
{
GstClockTime now;
- GTimeVal nowtv;
GList *clients;
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
- g_get_current_time (&nowtv);
- now = GST_TIMEVAL_TO_TIME (nowtv);
+ now = g_get_real_time () * GST_USECOND;
CLIENTS_LOCK (mhsink);
for (clients = mhsink->clients; clients; clients = clients->next) {
int i;
int radius = 20;
int w = frame->info.width, h = frame->info.height;
- GTimeVal rand_tv;
+ gint64 wall_time;
gdouble rad = 0;
double x, y;
int flipit = 0;
flipit = (v->n_frames / 50) % 2;
break;
case GST_VIDEO_TEST_SRC_WALL_TIME:
- g_get_current_time (&rand_tv);
+ wall_time = g_get_real_time ();
- rad = (gdouble) (rand_tv.tv_usec) / 1000000.0 + rand_tv.tv_sec;
- flipit = rand_tv.tv_sec % 2;
+ rad = (gdouble) wall_time / 1000000.0;
+ flipit = (wall_time / 1000000) % 2;
break;
case GST_VIDEO_TEST_SRC_RUNNING_TIME:
rad = (gdouble) (pts) / GST_SECOND;
static GLfloat xrot = 0;
static GLfloat yrot = 0;
static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
+ static GstClockTime current_time;
+ static GstClockTime last_time = gst_util_get_timestamp();
static gint nbFrames = 0;
GstVideoFrame v_frame;
texture = *(guint *) v_frame.data[0];
- g_get_current_time (¤t_time);
+ current_time = gst_util_get_timestamp ();
nbFrames++ ;
- if ((current_time.tv_sec - last_sec) >= 1)
+ if ((current_time - last_time) >= GST_SECOND)
{
- std::cout << "GRPHIC FPS = " << nbFrames << std::endl;
+ std::cout << "GRAPHIC FPS = " << nbFrames << std::endl;
nbFrames = 0;
- last_sec = current_time.tv_sec;
+ last_time = current_time;
}
glEnable(GL_DEPTH_TEST);
static GLfloat xrot = 0;
static GLfloat yrot = 0;
static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
+ static GstClockTime current_time;
+ static GstClockTime last_time = gst_util_get_timestamp();
static gint nbFrames = 0;
GstVideoFrame v_frame;
texture = *(guint *) v_frame.data[0];
- g_get_current_time (¤t_time);
+ current_time = gst_util_get_timestamp ();
nbFrames++ ;
- if ((current_time.tv_sec - last_sec) >= 1)
+ if ((current_time - last_time) >= GST_SECOND)
{
- std::cout << "GRPHIC FPS = " << nbFrames << std::endl;
+ std::cout << "GRAPHIC FPS = " << nbFrames << std::endl;
nbFrames = 0;
- last_sec = current_time.tv_sec;
+ last_time = current_time;
}
glEnable(GL_DEPTH_TEST);
static GLfloat xrot = 0;
static GLfloat yrot = 0;
static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
+ static GstClockTime current_time;
+ static GstClockTime last_time = gst_util_get_timestamp();
static gint nbFrames = 0;
GstVideoFrame v_frame;
texture = *(guint *) v_frame.data[0];
- g_get_current_time (¤t_time);
+ current_time = gst_util_get_timestamp ();
nbFrames++ ;
- if ((current_time.tv_sec - last_sec) >= 1)
+ if ((current_time - last_time) >= GST_SECOND)
{
std::cout << "GRAPHIC FPS of the scene which contains the custom cube) = " << nbFrames << std::endl;
nbFrames = 0;
- last_sec = current_time.tv_sec;
+ last_time = current_time;
}
glEnable(GL_DEPTH_TEST);
static GLfloat xrot = 0;
static GLfloat yrot = 0;
static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
+ static GstClockTime current_time;
+ static GstClockTime last_time = gst_util_get_timestamp();
static gint nbFrames = 0;
- g_get_current_time (¤t_time);
+ current_time = gst_util_get_timestamp ();
nbFrames++ ;
- if ((current_time.tv_sec - last_sec) >= 1)
+ if ((current_time - last_time) >= GST_SECOND)
{
- std::cout << "GRPHIC FPS = " << nbFrames << std::endl;
+ std::cout << "GRAPHIC FPS = " << nbFrames << std::endl;
nbFrames = 0;
- last_sec = current_time.tv_sec;
+ last_time = current_time;
}
glEnable(GL_DEPTH_TEST);
gboolean res = FALSE;
GstEvent *s_event;
gdouble rate;
- GTimeVal tv;
gboolean valid;
gdouble new_range;
cur_range = new_range;
- g_get_current_time (&tv);
- cur_time = GST_TIMEVAL_TO_TIME (tv);
+ cur_time = g_get_real_time () * GST_USECOND;
if (!valid)
return FALSE;