mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 15:56:42 +00:00
launch: Add support for testfiles
Making it simpler to define a test in a single files, including the configuration etc.. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/166>
This commit is contained in:
parent
a71b4984f6
commit
f30a127776
3 changed files with 41 additions and 10 deletions
|
@ -131,7 +131,7 @@ retry:
|
|||
}
|
||||
}
|
||||
|
||||
if (opts->scenario && !load_path) {
|
||||
if ((opts->scenario || opts->testfile) && !load_path) {
|
||||
if (!has_video && opts->track_types & GES_TRACK_TYPE_VIDEO) {
|
||||
trackv = GES_TRACK (ges_video_track_new ());
|
||||
|
||||
|
@ -212,7 +212,10 @@ _project_loaded_cb (GESProject * project, GESTimeline * timeline,
|
|||
if (self->priv->parsed_options.load_path && project_uri
|
||||
&& ges_validate_activate (GST_PIPELINE (self->priv->pipeline),
|
||||
self, opts) == FALSE) {
|
||||
g_error ("Could not activate scenario %s", opts->scenario);
|
||||
if (opts->scenario)
|
||||
g_error ("Could not activate scenario %s", opts->scenario);
|
||||
else
|
||||
g_error ("Could not activate testfile %s", opts->testfile);
|
||||
self->priv->seenerrors = TRUE;
|
||||
g_application_quit (G_APPLICATION (self));
|
||||
}
|
||||
|
@ -239,7 +242,7 @@ _error_loading_asset_cb (GESProject * project, GError * error,
|
|||
|
||||
static gboolean
|
||||
_create_timeline (GESLauncher * self, const gchar * serialized_timeline,
|
||||
const gchar * proj_uri, const gchar * scenario)
|
||||
const gchar * proj_uri, gboolean validate)
|
||||
{
|
||||
GESProject *project;
|
||||
|
||||
|
@ -247,7 +250,7 @@ _create_timeline (GESLauncher * self, const gchar * serialized_timeline,
|
|||
|
||||
if (proj_uri != NULL) {
|
||||
project = ges_project_new (proj_uri);
|
||||
} else if (scenario == NULL) {
|
||||
} else if (!validate) {
|
||||
GST_INFO ("serialized timeline is %s", serialized_timeline);
|
||||
project = ges_project_new (serialized_timeline);
|
||||
} else {
|
||||
|
@ -560,7 +563,8 @@ _create_pipeline (GESLauncher * self, const gchar * serialized_timeline)
|
|||
|
||||
self->priv->pipeline = ges_pipeline_new ();
|
||||
|
||||
if (!_create_timeline (self, serialized_timeline, uri, opts->scenario)) {
|
||||
if (!_create_timeline (self, serialized_timeline, uri, opts->scenario
|
||||
|| opts->testfile)) {
|
||||
GST_ERROR ("Could not create the timeline");
|
||||
goto failure;
|
||||
}
|
||||
|
@ -773,6 +777,16 @@ ges_launcher_parse_options (GESLauncher * self,
|
|||
}
|
||||
,
|
||||
#ifdef HAVE_GST_VALIDATE
|
||||
{"set-test-file", 0, 0, G_OPTION_ARG_STRING, &opts->testfile,
|
||||
"ges-launch-1.0 exposes gst-validate functionalities, such as test files and scenarios."
|
||||
" Scenarios describe actions to execute, such as seeks or setting of "
|
||||
"properties. "
|
||||
"GES implements editing-specific actions such as adding or removing "
|
||||
"clips. "
|
||||
"See gst-validate-1.0 --help for more info about validate and "
|
||||
"scenarios, " "and --inspect-action-type.",
|
||||
"</test/file/path>"}
|
||||
,
|
||||
{"set-scenario", 0, 0, G_OPTION_ARG_STRING, &opts->scenario,
|
||||
"ges-launch-1.0 exposes gst-validate functionalities, such as scenarios."
|
||||
" Scenarios describe actions to execute, such as seeks or setting of "
|
||||
|
@ -890,8 +904,8 @@ _local_command_line (GApplication * application, gchar ** arguments[],
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (!opts->load_path && !opts->scenario && !opts->list_transitions
|
||||
&& (argc <= 1)) {
|
||||
if (!opts->load_path && !opts->scenario && !opts->testfile
|
||||
&& !opts->list_transitions && (argc <= 1)) {
|
||||
g_printf ("%s", g_option_context_get_help (ctx, TRUE, NULL));
|
||||
g_option_context_free (ctx);
|
||||
*exit_status = 1;
|
||||
|
@ -1003,6 +1017,7 @@ _finalize (GObject * object)
|
|||
g_free (opts->video_track_caps);
|
||||
g_free (opts->audio_track_caps);
|
||||
g_free (opts->scenario);
|
||||
g_free (opts->testfile);
|
||||
|
||||
G_OBJECT_CLASS (ges_launcher_parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ typedef struct
|
|||
gboolean needs_set_state;
|
||||
gboolean smartrender;
|
||||
gchar *scenario;
|
||||
gchar *testfile;
|
||||
gchar *format;
|
||||
gchar *outputuri;
|
||||
gchar *encoding_profile;
|
||||
|
|
|
@ -115,10 +115,13 @@ ges_validate_activate (GstPipeline * pipeline, GESLauncher * launcher,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
ges_validate_register_action_types ();
|
||||
ges_validate_register_issues ();
|
||||
gst_validate_init_debug ();
|
||||
|
||||
if (opts->scenario) {
|
||||
if (opts->testfile) {
|
||||
if (opts->scenario)
|
||||
g_error ("Can not specify scenario and testfile at the same time");
|
||||
gst_validate_setup_test_file (opts->testfile, opts->mute);
|
||||
} else if (opts->scenario) {
|
||||
if (g_strcmp0 (opts->scenario, "none")) {
|
||||
gchar *scenario_name =
|
||||
g_strconcat (opts->scenario, "->gespipeline*", NULL);
|
||||
|
@ -127,6 +130,9 @@ ges_validate_activate (GstPipeline * pipeline, GESLauncher * launcher,
|
|||
}
|
||||
}
|
||||
|
||||
ges_validate_register_action_types ();
|
||||
ges_validate_register_issues ();
|
||||
|
||||
runner = gst_validate_runner_new ();
|
||||
gst_tracing_register_hook (GST_TRACER (runner), "bin-add-post",
|
||||
G_CALLBACK (bin_element_added));
|
||||
|
@ -141,6 +147,8 @@ ges_validate_activate (GstPipeline * pipeline, GESLauncher * launcher,
|
|||
|
||||
if (metas) {
|
||||
gchar **ges_options = gst_validate_utils_get_strv (metas, "ges-options");
|
||||
if (!ges_options)
|
||||
ges_options = gst_validate_utils_get_strv (metas, "args");
|
||||
|
||||
if (ges_options) {
|
||||
gint i;
|
||||
|
@ -242,6 +250,13 @@ gboolean
|
|||
ges_validate_activate (GstPipeline * pipeline, GESLauncher * launcher,
|
||||
GESLauncherParsedOptions * opts)
|
||||
{
|
||||
if (opts->testfile) {
|
||||
GST_WARNING ("Trying to run testfile %s, but gst-validate not supported",
|
||||
opts->testfile);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (opts->scenario) {
|
||||
GST_WARNING ("Trying to run scenario %s, but gst-validate not supported",
|
||||
opts->scenario);
|
||||
|
|
Loading…
Reference in a new issue