mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 13:55:41 +00:00
validate: Add a way to save details about avalaible scenarios in a file
This commit is contained in:
parent
9e66ac00f6
commit
4467b27b9f
4 changed files with 38 additions and 9 deletions
|
@ -1215,9 +1215,13 @@ _list_scenarios_in_dir (GFile * dir, GKeyFile *kf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
gst_validate_list_scenarios (void)
|
gst_validate_list_scenarios (gchar *output_file)
|
||||||
{
|
{
|
||||||
|
gchar *result;
|
||||||
|
|
||||||
|
gsize datalength;
|
||||||
|
GError *err = NULL;
|
||||||
GKeyFile *kf = NULL;
|
GKeyFile *kf = NULL;
|
||||||
const gchar *env_scenariodir = g_getenv ("GST_VALIDATE_SCENARIOS_PATH");
|
const gchar *env_scenariodir = g_getenv ("GST_VALIDATE_SCENARIOS_PATH");
|
||||||
gchar *tldir = g_build_filename (g_get_user_data_dir (),
|
gchar *tldir = g_build_filename (g_get_user_data_dir (),
|
||||||
|
@ -1248,7 +1252,21 @@ gst_validate_list_scenarios (void)
|
||||||
_list_scenarios_in_dir (dir, kf);
|
_list_scenarios_in_dir (dir, kf);
|
||||||
g_object_unref (dir);
|
g_object_unref (dir);
|
||||||
|
|
||||||
g_print ("Full file:\n%s", g_key_file_to_data (kf, NULL, NULL));
|
result = g_key_file_to_data (kf, &datalength, &err);
|
||||||
|
g_print ("All scenarios avalaible:\n%s", result);
|
||||||
|
|
||||||
|
|
||||||
|
if (output_file && !err)
|
||||||
|
g_file_set_contents (output_file, result, datalength, &err);
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
GST_WARNING ("Got error '%s' listing scenarios", err->message);
|
||||||
|
g_clear_error (&err);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -71,7 +71,7 @@ GType gst_validate_scenario_get_type (void);
|
||||||
GstValidateScenario * gst_validate_scenario_factory_create (GstValidateRunner *runner,
|
GstValidateScenario * gst_validate_scenario_factory_create (GstValidateRunner *runner,
|
||||||
GstElement *pipeline,
|
GstElement *pipeline,
|
||||||
const gchar *scenario_name);
|
const gchar *scenario_name);
|
||||||
void gst_validate_list_scenarios (void);
|
gboolean gst_validate_list_scenarios (gchar *output_file);
|
||||||
void gst_validate_add_action_type (const gchar *type_name, GstValidateExecuteAction function,
|
void gst_validate_add_action_type (const gchar *type_name, GstValidateExecuteAction function,
|
||||||
const gchar * const * mandatory_fields, const gchar *description,
|
const gchar * const * mandatory_fields, const gchar *description,
|
||||||
gboolean is_config);
|
gboolean is_config);
|
||||||
|
|
|
@ -745,6 +745,7 @@ main (int argc, gchar ** argv)
|
||||||
GOptionContext *ctx;
|
GOptionContext *ctx;
|
||||||
int rep_err;
|
int rep_err;
|
||||||
GstStateChangeReturn sret;
|
GstStateChangeReturn sret;
|
||||||
|
gchar *output_file = NULL;
|
||||||
|
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
guint signal_watch_id;
|
guint signal_watch_id;
|
||||||
|
@ -780,6 +781,10 @@ main (int argc, gchar ** argv)
|
||||||
"exiting.", NULL},
|
"exiting.", NULL},
|
||||||
{"list-scenarios", 'l', 0, G_OPTION_ARG_NONE, &list_scenarios,
|
{"list-scenarios", 'l', 0, G_OPTION_ARG_NONE, &list_scenarios,
|
||||||
"List the avalaible scenarios that can be run", NULL},
|
"List the avalaible scenarios that can be run", NULL},
|
||||||
|
{"scenarios-defs-output-file", '\0', 0, G_OPTION_ARG_FILENAME,
|
||||||
|
&output_file, "The output file to store scenarios details. "
|
||||||
|
"Implies --list-scenario",
|
||||||
|
NULL},
|
||||||
{"force-reencoding", 'r', 0, G_OPTION_ARG_NONE, &force_reencoding,
|
{"force-reencoding", 'r', 0, G_OPTION_ARG_NONE, &force_reencoding,
|
||||||
"Whether to try to force reencoding, meaning trying to only remux "
|
"Whether to try to force reencoding, meaning trying to only remux "
|
||||||
"if possible(default: TRUE)", NULL},
|
"if possible(default: TRUE)", NULL},
|
||||||
|
@ -830,9 +835,9 @@ main (int argc, gchar ** argv)
|
||||||
|
|
||||||
gst_validate_init ();
|
gst_validate_init ();
|
||||||
|
|
||||||
if (list_scenarios) {
|
if (list_scenarios || output_file) {
|
||||||
gst_validate_list_scenarios ();
|
if (gst_validate_list_scenarios (output_file))
|
||||||
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,7 @@ main (int argc, gchar ** argv)
|
||||||
const gchar *scenario = NULL, *configs = NULL;
|
const gchar *scenario = NULL, *configs = NULL;
|
||||||
gboolean list_scenarios = FALSE;
|
gboolean list_scenarios = FALSE;
|
||||||
GstStateChangeReturn sret;
|
GstStateChangeReturn sret;
|
||||||
|
gchar *output_file = NULL;
|
||||||
|
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
guint signal_watch_id;
|
guint signal_watch_id;
|
||||||
|
@ -185,6 +186,10 @@ main (int argc, gchar ** argv)
|
||||||
"environment variable", NULL},
|
"environment variable", NULL},
|
||||||
{"list-scenarios", 'l', 0, G_OPTION_ARG_NONE, &list_scenarios,
|
{"list-scenarios", 'l', 0, G_OPTION_ARG_NONE, &list_scenarios,
|
||||||
"List the avalaible scenarios that can be run", NULL},
|
"List the avalaible scenarios that can be run", NULL},
|
||||||
|
{"scenarios-defs-output-file", '\0', 0, G_OPTION_ARG_FILENAME,
|
||||||
|
&output_file, "The output file to store scenarios details. "
|
||||||
|
"Implies --list-scenario",
|
||||||
|
NULL},
|
||||||
{"set-configs", '\0', 0, G_OPTION_ARG_STRING, &configs,
|
{"set-configs", '\0', 0, G_OPTION_ARG_STRING, &configs,
|
||||||
"Let you set a config scenario, the scenario needs to be set as 'config"
|
"Let you set a config scenario, the scenario needs to be set as 'config"
|
||||||
"' you can specify a list of scenario separated by ':'"
|
"' you can specify a list of scenario separated by ':'"
|
||||||
|
@ -233,8 +238,9 @@ main (int argc, gchar ** argv)
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
gst_validate_init ();
|
gst_validate_init ();
|
||||||
|
|
||||||
if (list_scenarios) {
|
if (list_scenarios || output_file) {
|
||||||
gst_validate_list_scenarios ();
|
if (gst_validate_list_scenarios (output_file))
|
||||||
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue