validate: Use GstValidate logging system to print buffering avancement

So it can be used in the launcher.
And make sure to properly parse the info in the launcher.
This commit is contained in:
Thibault Saunier 2016-03-21 14:34:27 +01:00
parent 9b93cc884f
commit 621bda9b62
4 changed files with 6 additions and 11 deletions

View file

@ -158,6 +158,7 @@ _bus_handler (GstBus * bus, GstMessage * message,
if (percent == 100) {
/* a 100% message means buffering is done */
gst_validate_printf (NULL, "Done buffering\n");
if (monitor->buffering) {
monitor->print_pos_srcid =
g_timeout_add (PRINT_POSITION_TIMEOUT,
@ -168,10 +169,13 @@ _bus_handler (GstBus * bus, GstMessage * message,
/* buffering... */
if (!monitor->buffering) {
monitor->buffering = TRUE;
gst_validate_printf (NULL, "Start buffering\n");
if (monitor->print_pos_srcid
&& g_source_remove (monitor->print_pos_srcid))
&& g_source_remove (monitor->print_pos_srcid)) {
monitor->print_pos_srcid = 0;
}
}
gst_validate_printf (NULL, "%s %d%% \r", "Buffering...", percent);
}
break;
}

View file

@ -632,7 +632,7 @@ class GstValidateTest(Test):
utils.gsttime_from_tuple(times[0][4:]))
def _parse_buffering(self, b):
return b.split("buffering... ")[1].split("%")[0], 100
return b.lower().split("buffering... ")[1].split("%")[0], 100
def _get_position(self):
position = duration = -1

View file

@ -487,7 +487,6 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
}
gst_message_parse_buffering (message, &percent);
g_print ("%s %d%% \r", "Buffering...", percent);
/* no state management needed for live pipelines */
if (is_live)
@ -499,10 +498,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
buffering = FALSE;
if (target_state == GST_STATE_PLAYING) {
g_print ("Done buffering, setting pipeline to PLAYING\n");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
} else {
g_print ("Done buffering, staying in PAUSED\n");
}
}
} else {

View file

@ -160,7 +160,6 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
gst_message_parse_buffering (message, &percent);
gst_message_parse_buffering_stats (message, &mode, NULL, NULL, NULL);
g_print ("%s %d%% \r", "Buffering...", percent);
/* no state management needed for live pipelines */
if (mode == GST_BUFFERING_LIVE) {
@ -174,16 +173,12 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
buffering = FALSE;
if (target_state == GST_STATE_PLAYING) {
g_print ("Done buffering, setting pipeline to PLAYING\n");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
} else {
g_print ("Done buffering, staying in PAUSED\n");
}
}
} else {
/* buffering... */
if (!buffering) {
g_print ("Start buffering, setting pipeline to PAUSED\n");
gst_element_set_state (pipeline, GST_STATE_PAUSED);
buffering = TRUE;
}