tools: Simplify the setting of action scenario vs config scenario

This make it easier for user to understand the difference between
the two concepts and avoids confusion.

Change-Id: Ib42913722c93a1e7e3c8b156173c458230946592

Conflicts:
	validate/tools/gst-validate-transcoding.c
	validate/tools/gst-validate.c
This commit is contained in:
Thibault Saunier 2013-10-19 13:41:01 -03:00
parent 9dfee4dffa
commit 1c3340ecbb
3 changed files with 37 additions and 10 deletions

View file

@ -922,10 +922,10 @@ invalid_name:
} }
one_actions_scenario_max: one_actions_scenario_max:
{ {
GST_ERROR ("You can not set several actions scenario (you can " GST_ERROR ("You can set at most only one action scenario. "
"have set various confi scenario though, meaning you have to set" "You can have several config scenarios though (a config scenario's "
" 'scenario, is-config=true' in the scenario file, and all actions" "file must have is-config=true, and all its actions must be executable "
" should be executable at parsing time)"); "at parsing time).");
ret = FALSE; ret = FALSE;
goto done; goto done;

View file

@ -708,7 +708,7 @@ main (int argc, gchar ** argv)
#endif #endif
GError *err = NULL; GError *err = NULL;
const gchar *scenario = NULL; const gchar *scenario = NULL, *configs = NULL;
gboolean want_help = FALSE; gboolean want_help = FALSE;
gboolean list_scenarios = FALSE; gboolean list_scenarios = FALSE;
@ -725,6 +725,11 @@ main (int argc, gchar ** argv)
{"set-scenario", '\0', 0, G_OPTION_ARG_STRING, &scenario, {"set-scenario", '\0', 0, G_OPTION_ARG_STRING, &scenario,
"Let you set a scenario, it will override the GST_VALIDATE_SCENARIO " "Let you set a scenario, it will override the GST_VALIDATE_SCENARIO "
"environment variable", NULL}, "environment variable", NULL},
{"set-configs", '\0', 0, G_OPTION_ARG_STRING, &configs,
"Let you set a config scenario, the scenario needs to be set as 'config"
"' you can specify a list of scenario separated by ':'"
" it will override the GST_VALIDATE_SCENARIO environment variable,",
NULL},
{"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown, {"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown,
"If an EOS event should be sent to the pipeline if an interrupt is " "If an EOS event should be sent to the pipeline if an interrupt is "
"received, instead of forcing the pipeline to stop. Sending an EOS " "received, instead of forcing the pipeline to stop. Sending an EOS "
@ -765,8 +770,17 @@ main (int argc, gchar ** argv)
g_option_context_free (ctx); g_option_context_free (ctx);
if (scenario) if (scenario || configs) {
g_setenv ("GST_VALIDATE_SCENARIO", scenario, TRUE); gchar *scenarios;
if (scenario)
scenarios = g_strjoin (":", scenario, configs, NULL);
else
scenarios = g_strdup (configs);
g_setenv ("GST_VALIDATE_SCENARIO", scenarios, TRUE);
g_free (scenarios);
}
if (list_scenarios) if (list_scenarios)
gst_validate_list_scenarios (); gst_validate_list_scenarios ();

View file

@ -99,7 +99,7 @@ int
main (int argc, gchar ** argv) main (int argc, gchar ** argv)
{ {
GError *err = NULL; GError *err = NULL;
const gchar *scenario = NULL; const gchar *scenario = NULL, *configs = NULL;
gboolean list_scenarios = FALSE; gboolean list_scenarios = FALSE;
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
guint signal_watch_id; guint signal_watch_id;
@ -112,6 +112,11 @@ 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},
{"set-configs", '\0', 0, G_OPTION_ARG_STRING, &configs,
"Let you set a config scenario, the scenario needs to be set as 'config"
"' you can specify a list of scenario separated by ':'"
" it will override the GST_VALIDATE_SCENARIO environment variable,",
NULL},
{NULL} {NULL}
}; };
GOptionContext *ctx; GOptionContext *ctx;
@ -140,8 +145,16 @@ main (int argc, gchar ** argv)
exit (1); exit (1);
} }
if (scenario) { if (scenario || configs) {
g_setenv ("GST_VALIDATE_SCENARIO", scenario, TRUE); gchar *scenarios;
if (scenario)
scenarios = g_strjoin (":", scenario, configs, NULL);
else
scenarios = g_strdup (configs);
g_setenv ("GST_VALIDATE_SCENARIO", scenarios, TRUE);
g_free (scenarios);
} }
gst_init (&argc, &argv); gst_init (&argc, &argv);