ges:launch: Handle setting playback information in scenarios

This way we can avoid real sinks when implementing scenarios
This commit is contained in:
Thibault Saunier 2020-02-24 08:50:04 -03:00
parent 32dae5e3da
commit f55033223f
4 changed files with 14 additions and 9 deletions

View file

@ -211,7 +211,7 @@ _project_loaded_cb (GESProject * project, GESTimeline * timeline,
if (self->priv->parsed_options.load_path && project_uri if (self->priv->parsed_options.load_path && project_uri
&& ges_validate_activate (GST_PIPELINE (self->priv->pipeline), && ges_validate_activate (GST_PIPELINE (self->priv->pipeline),
opts) == FALSE) { self, opts) == FALSE) {
g_error ("Could not activate scenario %s", opts->scenario); g_error ("Could not activate scenario %s", opts->scenario);
self->priv->seenerrors = TRUE; self->priv->seenerrors = TRUE;
g_application_quit (G_APPLICATION (self)); g_application_quit (G_APPLICATION (self));
@ -441,7 +441,7 @@ _run_pipeline (GESLauncher * self)
if (!opts->load_path) { if (!opts->load_path) {
if (ges_validate_activate (GST_PIPELINE (self->priv->pipeline), if (ges_validate_activate (GST_PIPELINE (self->priv->pipeline),
opts) == FALSE) { self, opts) == FALSE) {
g_error ("Could not activate scenario %s", opts->scenario); g_error ("Could not activate scenario %s", opts->scenario);
return FALSE; return FALSE;
} }
@ -726,7 +726,7 @@ ges_launcher_get_playback_option_group (GESLauncherParsedOptions * opts)
} }
gboolean gboolean
ges_launcher_parse_options (GESLauncherParsedOptions * opts, ges_launcher_parse_options (GESLauncher * self,
gchar ** arguments[], gint * argc, GOptionContext * ctx, GError ** error) gchar ** arguments[], gint * argc, GOptionContext * ctx, GError ** error)
{ {
gboolean res; gboolean res;
@ -735,6 +735,7 @@ ges_launcher_parse_options (GESLauncherParsedOptions * opts,
gchar **commands = NULL, *help, *tmp; gchar **commands = NULL, *help, *tmp;
GError *err = NULL; GError *err = NULL;
gboolean owns_ctx = ctx == NULL; gboolean owns_ctx = ctx == NULL;
GESLauncherParsedOptions *opts = &self->priv->parsed_options;
GOptionEntry options[] = { GOptionEntry options[] = {
{"disable-mixing", 0, 0, G_OPTION_ARG_NONE, &opts->disable_mixing, {"disable-mixing", 0, 0, G_OPTION_ARG_NONE, &opts->disable_mixing,
"Do not use mixing elements to mix layers together.", NULL} "Do not use mixing elements to mix layers together.", NULL}
@ -826,6 +827,7 @@ ges_launcher_parse_options (GESLauncherParsedOptions * opts,
if (owns_ctx) { if (owns_ctx) {
g_option_context_free (ctx); g_option_context_free (ctx);
_set_playback_details (self);
} }
return res; return res;
@ -846,7 +848,7 @@ _local_command_line (GApplication * application, gchar ** arguments[],
argc = g_strv_length (*arguments); argc = g_strv_length (*arguments);
gst_init (&argc, arguments); gst_init (&argc, arguments);
if (!ges_launcher_parse_options (opts, arguments, &argc, ctx, &error)) { if (!ges_launcher_parse_options (self, arguments, &argc, ctx, &error)) {
gst_init (NULL, NULL); gst_init (NULL, NULL);
printerr ("Error initializing: %s\n", error->message); printerr ("Error initializing: %s\n", error->message);
g_option_context_free (ctx); g_option_context_free (ctx);

View file

@ -91,7 +91,7 @@ GType ges_launcher_get_type (void);
GESLauncher* ges_launcher_new (void); GESLauncher* ges_launcher_new (void);
gint ges_launcher_get_exit_status (GESLauncher *self); gint ges_launcher_get_exit_status (GESLauncher *self);
gboolean ges_launcher_parse_options(GESLauncherParsedOptions* opts, gchar*** arguments, gint *argc, GOptionContext* ctx, GError** error); gboolean ges_launcher_parse_options(GESLauncher* self, gchar*** arguments, gint *argc, GOptionContext* ctx, GError** error);
G_END_DECLS G_END_DECLS

View file

@ -101,7 +101,8 @@ ges_validate_register_issues (void)
} }
gboolean gboolean
ges_validate_activate (GstPipeline * pipeline, GESLauncherParsedOptions * opts) ges_validate_activate (GstPipeline * pipeline, GESLauncher * launcher,
GESLauncherParsedOptions * opts)
{ {
GstValidateRunner *runner = NULL; GstValidateRunner *runner = NULL;
GstValidateMonitor *monitor = NULL; GstValidateMonitor *monitor = NULL;
@ -142,7 +143,8 @@ ges_validate_activate (GstPipeline * pipeline, GESLauncherParsedOptions * opts)
for (i = 0; ges_options[i]; i++) for (i = 0; ges_options[i]; i++)
ges_options_full[i + 1] = g_strdup (ges_options[i]); ges_options_full[i + 1] = g_strdup (ges_options[i]);
ges_launcher_parse_options (opts, &ges_options_full, NULL, NULL, NULL); ges_launcher_parse_options (launcher, &ges_options_full, NULL, NULL,
NULL);
g_strfreev (ges_options_full); g_strfreev (ges_options_full);
g_strfreev (ges_options); g_strfreev (ges_options);
} }
@ -230,7 +232,8 @@ _print_position (GstElement * pipeline)
} }
gboolean gboolean
ges_validate_activate (GstPipeline * pipeline, GESLauncherParsedOptions * opts) ges_validate_activate (GstPipeline * pipeline, GESLauncher * launcher,
GESLauncherParsedOptions * opts)
{ {
if (opts->scenario) { if (opts->scenario) {
GST_WARNING ("Trying to run scenario %s, but gst-validate not supported", GST_WARNING ("Trying to run scenario %s, but gst-validate not supported",

View file

@ -30,7 +30,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
gboolean gboolean
ges_validate_activate(GstPipeline* pipeline, GESLauncherParsedOptions* opts); ges_validate_activate(GstPipeline* pipeline, GESLauncher *launcher, GESLauncherParsedOptions* opts);
void ges_launch_validate_uri(const gchar* nid); void ges_launch_validate_uri(const gchar* nid);
gint gint