mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
base: Avoid usage of deprecated API
GTimeval and related functions are now deprecated in glib. Replacement APIs have been present since 2.26
This commit is contained in:
parent
7eb98ba4f3
commit
2409f4f360
9 changed files with 36 additions and 57 deletions
|
@ -673,7 +673,6 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
|
||||||
gboolean more;
|
gboolean more;
|
||||||
gboolean flushing;
|
gboolean flushing;
|
||||||
GstClockTime now;
|
GstClockTime now;
|
||||||
GTimeVal nowtv;
|
|
||||||
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
|
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
|
||||||
GstMultiHandleSinkClass *mhsinkclass =
|
GstMultiHandleSinkClass *mhsinkclass =
|
||||||
GST_MULTI_HANDLE_SINK_GET_CLASS (mhsink);
|
GST_MULTI_HANDLE_SINK_GET_CLASS (mhsink);
|
||||||
|
@ -686,8 +685,7 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
|
||||||
do {
|
do {
|
||||||
gint maxsize;
|
gint maxsize;
|
||||||
|
|
||||||
g_get_current_time (&nowtv);
|
now = g_get_real_time () * GST_USECOND;
|
||||||
now = GST_TIMEVAL_TO_TIME (nowtv);
|
|
||||||
|
|
||||||
if (!mhclient->sending) {
|
if (!mhclient->sending) {
|
||||||
/* client is not working on a buffer */
|
/* client is not working on a buffer */
|
||||||
|
@ -905,10 +903,8 @@ gst_multi_fd_sink_handle_clients (GstMultiFdSink * sink)
|
||||||
* and will not disconnect inactive client in the streaming thread. */
|
* and will not disconnect inactive client in the streaming thread. */
|
||||||
if (G_UNLIKELY (result == 0)) {
|
if (G_UNLIKELY (result == 0)) {
|
||||||
GstClockTime now;
|
GstClockTime now;
|
||||||
GTimeVal nowtv;
|
|
||||||
|
|
||||||
g_get_current_time (&nowtv);
|
now = g_get_real_time () * GST_USECOND;
|
||||||
now = GST_TIMEVAL_TO_TIME (nowtv);
|
|
||||||
|
|
||||||
CLIENTS_LOCK (mhsink);
|
CLIENTS_LOCK (mhsink);
|
||||||
for (clients = mhsink->clients; clients; clients = next) {
|
for (clients = mhsink->clients; clients; clients = next) {
|
||||||
|
|
|
@ -599,8 +599,6 @@ void
|
||||||
gst_multi_handle_sink_client_init (GstMultiHandleClient * client,
|
gst_multi_handle_sink_client_init (GstMultiHandleClient * client,
|
||||||
GstSyncMethod sync_method)
|
GstSyncMethod sync_method)
|
||||||
{
|
{
|
||||||
GTimeVal now;
|
|
||||||
|
|
||||||
client->status = GST_CLIENT_STATUS_OK;
|
client->status = GST_CLIENT_STATUS_OK;
|
||||||
client->bufpos = -1;
|
client->bufpos = -1;
|
||||||
client->flushcount = -1;
|
client->flushcount = -1;
|
||||||
|
@ -616,8 +614,7 @@ gst_multi_handle_sink_client_init (GstMultiHandleClient * client,
|
||||||
client->currently_removing = FALSE;
|
client->currently_removing = FALSE;
|
||||||
|
|
||||||
/* update start time */
|
/* update start time */
|
||||||
g_get_current_time (&now);
|
client->connect_time = g_get_real_time () * GST_USECOND;
|
||||||
client->connect_time = GST_TIMEVAL_TO_TIME (now);
|
|
||||||
client->disconnect_time = 0;
|
client->disconnect_time = 0;
|
||||||
/* set last activity time to connect time */
|
/* set last activity time to connect time */
|
||||||
client->last_activity_time = client->connect_time;
|
client->last_activity_time = client->connect_time;
|
||||||
|
@ -883,11 +880,7 @@ gst_multi_handle_sink_get_stats (GstMultiHandleSink * sink,
|
||||||
result = gst_structure_new_empty ("multihandlesink-stats");
|
result = gst_structure_new_empty ("multihandlesink-stats");
|
||||||
|
|
||||||
if (mhclient->disconnect_time == 0) {
|
if (mhclient->disconnect_time == 0) {
|
||||||
GTimeVal nowtv;
|
interval = (g_get_real_time () * GST_USECOND) - mhclient->connect_time;
|
||||||
|
|
||||||
g_get_current_time (&nowtv);
|
|
||||||
|
|
||||||
interval = GST_TIMEVAL_TO_TIME (nowtv) - mhclient->connect_time;
|
|
||||||
} else {
|
} else {
|
||||||
interval = mhclient->disconnect_time - mhclient->connect_time;
|
interval = mhclient->disconnect_time - mhclient->connect_time;
|
||||||
}
|
}
|
||||||
|
@ -924,7 +917,6 @@ void
|
||||||
gst_multi_handle_sink_remove_client_link (GstMultiHandleSink * sink,
|
gst_multi_handle_sink_remove_client_link (GstMultiHandleSink * sink,
|
||||||
GList * link)
|
GList * link)
|
||||||
{
|
{
|
||||||
GTimeVal now;
|
|
||||||
GstMultiHandleClient *mhclient = (GstMultiHandleClient *) link->data;
|
GstMultiHandleClient *mhclient = (GstMultiHandleClient *) link->data;
|
||||||
GstMultiHandleSinkClass *mhsinkclass = GST_MULTI_HANDLE_SINK_GET_CLASS (sink);
|
GstMultiHandleSinkClass *mhsinkclass = GST_MULTI_HANDLE_SINK_GET_CLASS (sink);
|
||||||
|
|
||||||
|
@ -970,8 +962,7 @@ gst_multi_handle_sink_remove_client_link (GstMultiHandleSink * sink,
|
||||||
|
|
||||||
mhsinkclass->hash_removing (sink, mhclient);
|
mhsinkclass->hash_removing (sink, mhclient);
|
||||||
|
|
||||||
g_get_current_time (&now);
|
mhclient->disconnect_time = g_get_real_time () * GST_USECOND;
|
||||||
mhclient->disconnect_time = GST_TIMEVAL_TO_TIME (now);
|
|
||||||
|
|
||||||
/* free client buffers */
|
/* free client buffers */
|
||||||
g_slist_foreach (mhclient->sending, (GFunc) gst_mini_object_unref, NULL);
|
g_slist_foreach (mhclient->sending, (GFunc) gst_mini_object_unref, NULL);
|
||||||
|
@ -1681,7 +1672,6 @@ gst_multi_handle_sink_queue_buffer (GstMultiHandleSink * mhsink,
|
||||||
gboolean hash_changed = FALSE;
|
gboolean hash_changed = FALSE;
|
||||||
gint max_buffer_usage;
|
gint max_buffer_usage;
|
||||||
gint i;
|
gint i;
|
||||||
GTimeVal nowtv;
|
|
||||||
GstClockTime now;
|
GstClockTime now;
|
||||||
gint max_buffers, soft_max_buffers;
|
gint max_buffers, soft_max_buffers;
|
||||||
guint cookie;
|
guint cookie;
|
||||||
|
@ -1734,8 +1724,7 @@ gst_multi_handle_sink_queue_buffer (GstMultiHandleSink * mhsink,
|
||||||
}
|
}
|
||||||
|
|
||||||
max_buffer_usage = 0;
|
max_buffer_usage = 0;
|
||||||
g_get_current_time (&nowtv);
|
now = g_get_real_time () * GST_USECOND;
|
||||||
now = GST_TIMEVAL_TO_TIME (nowtv);
|
|
||||||
|
|
||||||
/* now check for new or slow clients */
|
/* now check for new or slow clients */
|
||||||
restart:
|
restart:
|
||||||
|
|
|
@ -823,7 +823,6 @@ gst_multi_socket_sink_handle_client_write (GstMultiSocketSink * sink,
|
||||||
gboolean more;
|
gboolean more;
|
||||||
gboolean flushing;
|
gboolean flushing;
|
||||||
GstClockTime now;
|
GstClockTime now;
|
||||||
GTimeVal nowtv;
|
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
|
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
|
||||||
GstMultiHandleClient *mhclient = (GstMultiHandleClient *) client;
|
GstMultiHandleClient *mhclient = (GstMultiHandleClient *) client;
|
||||||
|
@ -831,8 +830,7 @@ gst_multi_socket_sink_handle_client_write (GstMultiSocketSink * sink,
|
||||||
GST_MULTI_HANDLE_SINK_GET_CLASS (mhsink);
|
GST_MULTI_HANDLE_SINK_GET_CLASS (mhsink);
|
||||||
|
|
||||||
|
|
||||||
g_get_current_time (&nowtv);
|
now = g_get_real_time () * GST_USECOND;
|
||||||
now = GST_TIMEVAL_TO_TIME (nowtv);
|
|
||||||
|
|
||||||
flushing = mhclient->status == GST_CLIENT_STATUS_FLUSHING;
|
flushing = mhclient->status == GST_CLIENT_STATUS_FLUSHING;
|
||||||
|
|
||||||
|
@ -1111,12 +1109,10 @@ static gboolean
|
||||||
gst_multi_socket_sink_timeout (GstMultiSocketSink * sink)
|
gst_multi_socket_sink_timeout (GstMultiSocketSink * sink)
|
||||||
{
|
{
|
||||||
GstClockTime now;
|
GstClockTime now;
|
||||||
GTimeVal nowtv;
|
|
||||||
GList *clients;
|
GList *clients;
|
||||||
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
|
GstMultiHandleSink *mhsink = GST_MULTI_HANDLE_SINK (sink);
|
||||||
|
|
||||||
g_get_current_time (&nowtv);
|
now = g_get_real_time () * GST_USECOND;
|
||||||
now = GST_TIMEVAL_TO_TIME (nowtv);
|
|
||||||
|
|
||||||
CLIENTS_LOCK (mhsink);
|
CLIENTS_LOCK (mhsink);
|
||||||
for (clients = mhsink->clients; clients; clients = clients->next) {
|
for (clients = mhsink->clients; clients; clients = clients->next) {
|
||||||
|
|
|
@ -1081,7 +1081,7 @@ gst_video_test_src_ball (GstVideoTestSrc * v, GstClockTime pts,
|
||||||
int i;
|
int i;
|
||||||
int radius = 20;
|
int radius = 20;
|
||||||
int w = frame->info.width, h = frame->info.height;
|
int w = frame->info.width, h = frame->info.height;
|
||||||
GTimeVal rand_tv;
|
gint64 wall_time;
|
||||||
gdouble rad = 0;
|
gdouble rad = 0;
|
||||||
double x, y;
|
double x, y;
|
||||||
int flipit = 0;
|
int flipit = 0;
|
||||||
|
@ -1099,10 +1099,10 @@ gst_video_test_src_ball (GstVideoTestSrc * v, GstClockTime pts,
|
||||||
flipit = (v->n_frames / 50) % 2;
|
flipit = (v->n_frames / 50) % 2;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_TEST_SRC_WALL_TIME:
|
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;
|
rad = (gdouble) wall_time / 1000000.0;
|
||||||
flipit = rand_tv.tv_sec % 2;
|
flipit = (wall_time / 1000000) % 2;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_TEST_SRC_RUNNING_TIME:
|
case GST_VIDEO_TEST_SRC_RUNNING_TIME:
|
||||||
rad = (gdouble) (pts) / GST_SECOND;
|
rad = (gdouble) (pts) / GST_SECOND;
|
||||||
|
|
|
@ -79,8 +79,8 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
|
||||||
static GLfloat xrot = 0;
|
static GLfloat xrot = 0;
|
||||||
static GLfloat yrot = 0;
|
static GLfloat yrot = 0;
|
||||||
static GLfloat zrot = 0;
|
static GLfloat zrot = 0;
|
||||||
static GTimeVal current_time;
|
static GstClockTime current_time;
|
||||||
static glong last_sec = current_time.tv_sec;
|
static GstClockTime last_time = gst_util_get_timestamp();
|
||||||
static gint nbFrames = 0;
|
static gint nbFrames = 0;
|
||||||
|
|
||||||
GstVideoFrame v_frame;
|
GstVideoFrame v_frame;
|
||||||
|
@ -98,14 +98,14 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
|
||||||
|
|
||||||
texture = *(guint *) v_frame.data[0];
|
texture = *(guint *) v_frame.data[0];
|
||||||
|
|
||||||
g_get_current_time (¤t_time);
|
current_time = gst_util_get_timestamp ();
|
||||||
nbFrames++ ;
|
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;
|
nbFrames = 0;
|
||||||
last_sec = current_time.tv_sec;
|
last_time = current_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
|
@ -100,8 +100,8 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
|
||||||
static GLfloat xrot = 0;
|
static GLfloat xrot = 0;
|
||||||
static GLfloat yrot = 0;
|
static GLfloat yrot = 0;
|
||||||
static GLfloat zrot = 0;
|
static GLfloat zrot = 0;
|
||||||
static GTimeVal current_time;
|
static GstClockTime current_time;
|
||||||
static glong last_sec = current_time.tv_sec;
|
static GstClockTime last_time = gst_util_get_timestamp();
|
||||||
static gint nbFrames = 0;
|
static gint nbFrames = 0;
|
||||||
|
|
||||||
GstVideoFrame v_frame;
|
GstVideoFrame v_frame;
|
||||||
|
@ -119,14 +119,14 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
|
||||||
|
|
||||||
texture = *(guint *) v_frame.data[0];
|
texture = *(guint *) v_frame.data[0];
|
||||||
|
|
||||||
g_get_current_time (¤t_time);
|
current_time = gst_util_get_timestamp ();
|
||||||
nbFrames++ ;
|
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;
|
nbFrames = 0;
|
||||||
last_sec = current_time.tv_sec;
|
last_time = current_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
|
@ -102,8 +102,8 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
|
||||||
static GLfloat xrot = 0;
|
static GLfloat xrot = 0;
|
||||||
static GLfloat yrot = 0;
|
static GLfloat yrot = 0;
|
||||||
static GLfloat zrot = 0;
|
static GLfloat zrot = 0;
|
||||||
static GTimeVal current_time;
|
static GstClockTime current_time;
|
||||||
static glong last_sec = current_time.tv_sec;
|
static GstClockTime last_time = gst_util_get_timestamp();
|
||||||
static gint nbFrames = 0;
|
static gint nbFrames = 0;
|
||||||
|
|
||||||
GstVideoFrame v_frame;
|
GstVideoFrame v_frame;
|
||||||
|
@ -121,14 +121,14 @@ static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSa
|
||||||
|
|
||||||
texture = *(guint *) v_frame.data[0];
|
texture = *(guint *) v_frame.data[0];
|
||||||
|
|
||||||
g_get_current_time (¤t_time);
|
current_time = gst_util_get_timestamp ();
|
||||||
nbFrames++ ;
|
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;
|
std::cout << "GRAPHIC FPS of the scene which contains the custom cube) = " << nbFrames << std::endl;
|
||||||
nbFrames = 0;
|
nbFrames = 0;
|
||||||
last_sec = current_time.tv_sec;
|
last_time = current_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
|
@ -70,18 +70,18 @@ static gboolean drawCallback (void *filter, void *context, GLuint texture, GLuin
|
||||||
static GLfloat xrot = 0;
|
static GLfloat xrot = 0;
|
||||||
static GLfloat yrot = 0;
|
static GLfloat yrot = 0;
|
||||||
static GLfloat zrot = 0;
|
static GLfloat zrot = 0;
|
||||||
static GTimeVal current_time;
|
static GstClockTime current_time;
|
||||||
static glong last_sec = current_time.tv_sec;
|
static GstClockTime last_time = gst_util_get_timestamp();
|
||||||
static gint nbFrames = 0;
|
static gint nbFrames = 0;
|
||||||
|
|
||||||
g_get_current_time (¤t_time);
|
current_time = gst_util_get_timestamp ();
|
||||||
nbFrames++ ;
|
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;
|
nbFrames = 0;
|
||||||
last_sec = current_time.tv_sec;
|
last_time = current_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
|
@ -199,7 +199,6 @@ do_seek (GtkWidget * widget, gboolean flush, gboolean segment)
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
GstEvent *s_event;
|
GstEvent *s_event;
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
GTimeVal tv;
|
|
||||||
gboolean valid;
|
gboolean valid;
|
||||||
gdouble new_range;
|
gdouble new_range;
|
||||||
|
|
||||||
|
@ -222,8 +221,7 @@ do_seek (GtkWidget * widget, gboolean flush, gboolean segment)
|
||||||
|
|
||||||
cur_range = new_range;
|
cur_range = new_range;
|
||||||
|
|
||||||
g_get_current_time (&tv);
|
cur_time = g_get_real_time () * GST_USECOND;
|
||||||
cur_time = GST_TIMEVAL_TO_TIME (tv);
|
|
||||||
|
|
||||||
if (!valid)
|
if (!valid)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue