mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 13:08:49 +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>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static gboolean output_is_tty = TRUE;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
@ -142,11 +140,6 @@ gst_validate_pipeline_monitor_class_init (GstValidatePipelineMonitorClass *
|
||||||
object_class->get_property = gst_validate_pipeline_monitor_get_property;
|
object_class->get_property = gst_validate_pipeline_monitor_get_property;
|
||||||
|
|
||||||
g_object_class_override_property (object_class, PROP_VERBOSITY, "verbosity");
|
g_object_class_override_property (object_class, PROP_VERBOSITY, "verbosity");
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
output_is_tty = isatty (1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -160,7 +153,6 @@ print_position (GstValidateMonitor * monitor)
|
||||||
{
|
{
|
||||||
GstQuery *query;
|
GstQuery *query;
|
||||||
gint64 position, duration;
|
gint64 position, duration;
|
||||||
JsonBuilder *jbuilder;
|
|
||||||
GstElement *pipeline =
|
GstElement *pipeline =
|
||||||
GST_ELEMENT (gst_validate_monitor_get_pipeline (monitor));
|
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_parse_segment (query, &rate, NULL, NULL, NULL);
|
||||||
gst_query_unref (query);
|
gst_query_unref (query);
|
||||||
|
|
||||||
jbuilder = json_builder_new ();
|
gst_validate_print_position (position, duration, rate, NULL);
|
||||||
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');
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
gst_object_unref (pipeline);
|
gst_object_unref (pipeline);
|
||||||
|
|
|
@ -43,6 +43,7 @@ static GstClockTime _gst_validate_report_start_time = 0;
|
||||||
static GstValidateDebugFlags _gst_validate_flags = 0;
|
static GstValidateDebugFlags _gst_validate_flags = 0;
|
||||||
static GHashTable *_gst_validate_issues = NULL;
|
static GHashTable *_gst_validate_issues = NULL;
|
||||||
static FILE **log_files = NULL;
|
static FILE **log_files = NULL;
|
||||||
|
static gboolean output_is_tty = TRUE;
|
||||||
|
|
||||||
/* Tcp server for communications with gst-validate-launcher */
|
/* Tcp server for communications with gst-validate-launcher */
|
||||||
GSocketClient *socket_client = NULL;
|
GSocketClient *socket_client = NULL;
|
||||||
|
@ -552,6 +553,9 @@ gst_validate_report_init (void)
|
||||||
|
|
||||||
gst_validate_report_load_issues ();
|
gst_validate_report_load_issues ();
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
output_is_tty = isatty (1);
|
||||||
|
#endif
|
||||||
|
|
||||||
server_env = g_getenv ("GST_VALIDATE_SERVER");
|
server_env = g_getenv ("GST_VALIDATE_SERVER");
|
||||||
uuid = g_getenv ("GST_VALIDATE_UUID");
|
uuid = g_getenv ("GST_VALIDATE_UUID");
|
||||||
|
@ -1235,3 +1239,36 @@ gst_validate_report_add_repeated_report (GstValidateReport * report,
|
||||||
g_list_append (report->repeated_reports,
|
g_list_append (report->repeated_reports,
|
||||||
gst_validate_report_ref (repeated_report));
|
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);
|
void gst_validate_report_add_repeated_report (GstValidateReport *report, GstValidateReport *repeated_report);
|
||||||
GST_VALIDATE_API
|
GST_VALIDATE_API
|
||||||
GstValidateReportLevel gst_validate_report_level_from_name (const gchar *level_name);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -180,13 +180,10 @@ runner_stopping (GstValidateRunner * runner, ValidateSsimOverride * self)
|
||||||
min_avg = MIN (min_avg, mssim);
|
min_avg = MIN (min_avg, mssim);
|
||||||
min_min = MIN (lowest, min_min);
|
min_min = MIN (lowest, min_min);
|
||||||
total_avg += mssim;
|
total_avg += mssim;
|
||||||
gst_validate_printf (NULL,
|
gst_validate_print_position(frame->position, GST_CLOCK_TIME_NONE, 1.0,
|
||||||
"<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
|
g_strdup_printf(" %d / %d avg: %f min: %f (Passed: %d failed: %d)",
|
||||||
" %d / %d avg: %f min: %f (Passed: %d failed: %d)/>\n",
|
i + 1, nfiles, mssim, lowest, npassed, nfailures));
|
||||||
GST_TIME_ARGS (frame->position), GST_TIME_ARGS (GST_CLOCK_TIME_NONE),
|
g_free(bname);
|
||||||
i + 1, nfiles, mssim, lowest, npassed, nfailures);
|
|
||||||
|
|
||||||
g_free (bname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_validate_printf (NULL,
|
gst_validate_printf (NULL,
|
||||||
|
|
Loading…
Reference in a new issue