mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
validate:tools: Print position every 50ms in gst-validate
This commit is contained in:
parent
ea7ae57d3b
commit
d8fc68479c
1 changed files with 30 additions and 0 deletions
|
@ -53,6 +53,35 @@ intr_handler (gpointer user_data)
|
||||||
}
|
}
|
||||||
#endif /* G_OS_UNIX */
|
#endif /* G_OS_UNIX */
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
print_position (void)
|
||||||
|
{
|
||||||
|
GstQuery *query;
|
||||||
|
gint64 position, duration;
|
||||||
|
|
||||||
|
gdouble rate = 1.0;
|
||||||
|
GstFormat format = GST_FORMAT_TIME;
|
||||||
|
|
||||||
|
gst_element_query_position (pipeline, format, &position);
|
||||||
|
|
||||||
|
format = GST_FORMAT_TIME;
|
||||||
|
gst_element_query_duration (pipeline, format, &duration);
|
||||||
|
|
||||||
|
query = gst_query_new_segment (GST_FORMAT_DEFAULT);
|
||||||
|
if (gst_element_query (pipeline, query))
|
||||||
|
gst_query_parse_segment (query, &rate, NULL, NULL, NULL);
|
||||||
|
gst_query_unref (query);
|
||||||
|
|
||||||
|
g_print ("<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
|
||||||
|
" speed: %f />\r", GST_TIME_ARGS (position), GST_TIME_ARGS (duration),
|
||||||
|
rate);
|
||||||
|
|
||||||
|
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline),
|
||||||
|
GST_DEBUG_GRAPH_SHOW_ALL, "position");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -217,6 +246,7 @@ main (int argc, gchar ** argv)
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_timeout_add (50, (GSourceFunc) print_position, NULL);
|
||||||
g_print ("Pipeline started\n");
|
g_print ("Pipeline started\n");
|
||||||
g_main_loop_run (mainloop);
|
g_main_loop_run (mainloop);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue