mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
scenario: Set SCENARIO_PATH/DIR
variables in scenarios
And add some documentation about it
This commit is contained in:
parent
0e0928b0b7
commit
b11c5ba185
2 changed files with 22 additions and 4 deletions
|
@ -103,6 +103,8 @@ Any action can use the default variables:
|
||||||
[gst_element_query_duration()](gst_element_query_duration)
|
[gst_element_query_duration()](gst_element_query_duration)
|
||||||
- `$(TMPDIR)`: The default temporary directory as returned by
|
- `$(TMPDIR)`: The default temporary directory as returned by
|
||||||
[g_get_tmp_dir()](g_get_tmp_dir).
|
[g_get_tmp_dir()](g_get_tmp_dir).
|
||||||
|
- `$(SCENARIO_PATH)`: The path of the running scenario.
|
||||||
|
- `$(SCENARIO_DIR)`: The directory the running scenario is in.
|
||||||
|
|
||||||
|
|
||||||
It is also possible to set variables in scenario with the `set-vars` action.
|
It is also possible to set variables in scenario with the `set-vars` action.
|
|
@ -3510,15 +3510,17 @@ gst_validate_scenario_load (GstValidateScenario * scenario,
|
||||||
scenarios = g_strsplit (scenario_name, ":", -1);
|
scenarios = g_strsplit (scenario_name, ":", -1);
|
||||||
|
|
||||||
for (i = 0; scenarios[i]; i++) {
|
for (i = 0; scenarios[i]; i++) {
|
||||||
gchar *lfilename = NULL, *tldir = NULL;
|
gchar *lfilename = NULL, *tldir = NULL, *scenario_file = NULL;
|
||||||
|
|
||||||
/* First check if the scenario name is not a full path to the
|
/* First check if the scenario name is not a full path to the
|
||||||
* actual scenario */
|
* actual scenario */
|
||||||
if (g_file_test (scenarios[i], G_FILE_TEST_IS_REGULAR)) {
|
if (g_file_test (scenarios[i], G_FILE_TEST_IS_REGULAR)) {
|
||||||
GST_DEBUG_OBJECT (scenario, "Scenario: %s is a full path to a scenario. "
|
GST_DEBUG_OBJECT (scenario, "Scenario: %s is a full path to a scenario. "
|
||||||
"Trying to load it", scenarios[i]);
|
"Trying to load it", scenarios[i]);
|
||||||
if ((ret = _load_scenario_file (scenario, scenarios[i], &is_config)))
|
if ((ret = _load_scenario_file (scenario, scenarios[i], &is_config))) {
|
||||||
|
scenario_file = scenarios[i];
|
||||||
goto check_scenario;
|
goto check_scenario;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_str_has_suffix (scenarios[i], GST_VALIDATE_SCENARIO_SUFFIX))
|
if (g_str_has_suffix (scenarios[i], GST_VALIDATE_SCENARIO_SUFFIX))
|
||||||
|
@ -3532,16 +3534,20 @@ gst_validate_scenario_load (GstValidateScenario * scenario,
|
||||||
|
|
||||||
for (i = 0; env_scenariodir[i]; i++) {
|
for (i = 0; env_scenariodir[i]; i++) {
|
||||||
tldir = g_build_filename (env_scenariodir[i], lfilename, NULL);
|
tldir = g_build_filename (env_scenariodir[i], lfilename, NULL);
|
||||||
if ((ret = _load_scenario_file (scenario, tldir, &is_config)))
|
if ((ret = _load_scenario_file (scenario, tldir, &is_config))) {
|
||||||
|
scenario_file = tldir;
|
||||||
goto check_scenario;
|
goto check_scenario;
|
||||||
|
}
|
||||||
g_free (tldir);
|
g_free (tldir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tldir = g_build_filename ("data", "scenarios", lfilename, NULL);
|
tldir = g_build_filename ("data", "scenarios", lfilename, NULL);
|
||||||
|
|
||||||
if ((ret = _load_scenario_file (scenario, tldir, &is_config)))
|
if ((ret = _load_scenario_file (scenario, tldir, &is_config))) {
|
||||||
|
scenario_file = tldir;
|
||||||
goto check_scenario;
|
goto check_scenario;
|
||||||
|
}
|
||||||
|
|
||||||
g_free (tldir);
|
g_free (tldir);
|
||||||
|
|
||||||
|
@ -3563,6 +3569,16 @@ gst_validate_scenario_load (GstValidateScenario * scenario,
|
||||||
}
|
}
|
||||||
/* else check scenario */
|
/* else check scenario */
|
||||||
check_scenario:
|
check_scenario:
|
||||||
|
if (!is_config) {
|
||||||
|
gchar *scenario_dir = g_path_get_dirname (scenario_file);
|
||||||
|
|
||||||
|
gst_structure_set (scenario->priv->vars,
|
||||||
|
"SCENARIO_DIR", G_TYPE_STRING, scenario_dir,
|
||||||
|
"SCENARIO_PATH", G_TYPE_STRING, scenario_file, NULL);
|
||||||
|
|
||||||
|
g_free (scenario_dir);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (tldir);
|
g_free (tldir);
|
||||||
g_free (lfilename);
|
g_free (lfilename);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue