mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
validate:ssim: Enhance printing position
Adding a new `gst_validate_print_position` method which also sends messages to the runner if required.
This commit is contained in:
parent
0b41b8a8c0
commit
4ae29ab7ed
4 changed files with 44 additions and 34 deletions
|
@ -35,8 +35,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
static gboolean output_is_tty = TRUE;
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
@ -142,11 +140,6 @@ gst_validate_pipeline_monitor_class_init (GstValidatePipelineMonitorClass *
|
|||
object_class->get_property = gst_validate_pipeline_monitor_get_property;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_VERBOSITY, "verbosity");
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
output_is_tty = isatty (1);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -160,7 +153,6 @@ print_position (GstValidateMonitor * monitor)
|
|||
{
|
||||
GstQuery *query;
|
||||
gint64 position, duration;
|
||||
JsonBuilder *jbuilder;
|
||||
GstElement *pipeline =
|
||||
GST_ELEMENT (gst_validate_monitor_get_pipeline (monitor));
|
||||
|
||||
|
@ -196,25 +188,7 @@ print_position (GstValidateMonitor * monitor)
|
|||
gst_query_parse_segment (query, &rate, NULL, NULL, NULL);
|
||||
gst_query_unref (query);
|
||||
|
||||
jbuilder = json_builder_new ();
|
||||
json_builder_begin_object (jbuilder);
|
||||
json_builder_set_member_name (jbuilder, "type");
|
||||
json_builder_add_string_value (jbuilder, "position");
|
||||
json_builder_set_member_name (jbuilder, "position");
|
||||
json_builder_add_int_value (jbuilder, position);
|
||||
json_builder_set_member_name (jbuilder, "duration");
|
||||
json_builder_add_int_value (jbuilder, duration);
|
||||
json_builder_set_member_name (jbuilder, "speed");
|
||||
json_builder_add_double_value (jbuilder, rate);
|
||||
json_builder_end_object (jbuilder);
|
||||
|
||||
gst_validate_send (json_builder_get_root (jbuilder));
|
||||
g_object_unref (jbuilder);
|
||||
|
||||
gst_validate_printf (NULL,
|
||||
"<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
|
||||
" speed: %f />%c", GST_TIME_ARGS (position), GST_TIME_ARGS (duration),
|
||||
rate, output_is_tty ? '\r' : '\n');
|
||||
gst_validate_print_position (position, duration, rate, NULL);
|
||||
|
||||
done:
|
||||
gst_object_unref (pipeline);
|
||||
|
|
|
@ -43,6 +43,7 @@ static GstClockTime _gst_validate_report_start_time = 0;
|
|||
static GstValidateDebugFlags _gst_validate_flags = 0;
|
||||
static GHashTable *_gst_validate_issues = NULL;
|
||||
static FILE **log_files = NULL;
|
||||
static gboolean output_is_tty = TRUE;
|
||||
|
||||
/* Tcp server for communications with gst-validate-launcher */
|
||||
GSocketClient *socket_client = NULL;
|
||||
|
@ -552,6 +553,9 @@ gst_validate_report_init (void)
|
|||
|
||||
gst_validate_report_load_issues ();
|
||||
}
|
||||
#ifdef HAVE_UNISTD_H
|
||||
output_is_tty = isatty (1);
|
||||
#endif
|
||||
|
||||
server_env = g_getenv ("GST_VALIDATE_SERVER");
|
||||
uuid = g_getenv ("GST_VALIDATE_UUID");
|
||||
|
@ -1235,3 +1239,36 @@ gst_validate_report_add_repeated_report (GstValidateReport * report,
|
|||
g_list_append (report->repeated_reports,
|
||||
gst_validate_report_ref (repeated_report));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gst_validate_print_position (GstClockTime position, GstClockTime duration,
|
||||
gdouble rate, gchar * extra_info)
|
||||
{
|
||||
JsonBuilder *jbuilder;
|
||||
|
||||
gst_validate_printf (NULL,
|
||||
"<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
|
||||
" speed: %f %s/>%c", GST_TIME_ARGS (position), GST_TIME_ARGS (duration),
|
||||
rate, extra_info ? extra_info : "", output_is_tty ? '\r' : '\n');
|
||||
|
||||
if (!server_ostream)
|
||||
return;
|
||||
|
||||
jbuilder = json_builder_new ();
|
||||
json_builder_begin_object (jbuilder);
|
||||
json_builder_set_member_name (jbuilder, "type");
|
||||
json_builder_add_string_value (jbuilder, "position");
|
||||
json_builder_set_member_name (jbuilder, "position");
|
||||
json_builder_add_int_value (jbuilder, position);
|
||||
json_builder_set_member_name (jbuilder, "duration");
|
||||
json_builder_add_int_value (jbuilder, duration);
|
||||
json_builder_set_member_name (jbuilder, "speed");
|
||||
json_builder_add_double_value (jbuilder, rate);
|
||||
json_builder_end_object (jbuilder);
|
||||
|
||||
gst_validate_send (json_builder_get_root (jbuilder));
|
||||
g_object_unref (jbuilder);
|
||||
|
||||
g_free (extra_info);
|
||||
}
|
||||
|
|
|
@ -309,6 +309,8 @@ GST_VALIDATE_API
|
|||
void gst_validate_report_add_repeated_report (GstValidateReport *report, GstValidateReport *repeated_report);
|
||||
GST_VALIDATE_API
|
||||
GstValidateReportLevel gst_validate_report_level_from_name (const gchar *level_name);
|
||||
GST_VALIDATE_API
|
||||
void gst_validate_print_position(GstClockTime position, GstClockTime duration, gdouble rate, gchar* extra_info);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -180,12 +180,9 @@ runner_stopping (GstValidateRunner * runner, ValidateSsimOverride * self)
|
|||
min_avg = MIN (min_avg, mssim);
|
||||
min_min = MIN (lowest, min_min);
|
||||
total_avg += mssim;
|
||||
gst_validate_printf (NULL,
|
||||
"<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
|
||||
" %d / %d avg: %f min: %f (Passed: %d failed: %d)/>\n",
|
||||
GST_TIME_ARGS (frame->position), GST_TIME_ARGS (GST_CLOCK_TIME_NONE),
|
||||
i + 1, nfiles, mssim, lowest, npassed, nfailures);
|
||||
|
||||
gst_validate_print_position(frame->position, GST_CLOCK_TIME_NONE, 1.0,
|
||||
g_strdup_printf(" %d / %d avg: %f min: %f (Passed: %d failed: %d)",
|
||||
i + 1, nfiles, mssim, lowest, npassed, nfailures));
|
||||
g_free(bname);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue