launch: Make command line provided sinks override scenario defined ones

This commit is contained in:
Thibault Saunier 2020-03-02 14:35:33 -03:00
parent ed2c7006c5
commit 329cbbcba7

View file

@ -736,13 +736,15 @@ ges_launcher_parse_options (GESLauncher * self,
GError *err = NULL; GError *err = NULL;
gboolean owns_ctx = ctx == NULL; gboolean owns_ctx = ctx == NULL;
GESLauncherParsedOptions *opts = &self->priv->parsed_options; GESLauncherParsedOptions *opts = &self->priv->parsed_options;
gchar *prev_videosink = opts->videosink, *prev_audiosink = opts->audiosink;
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}
, ,
{"track-types", 't', 0, G_OPTION_ARG_CALLBACK, &_parse_track_type, {"track-types", 't', 0, G_OPTION_ARG_CALLBACK, &_parse_track_type,
"Specify the track types to be created. " "Specify the track types to be created. "
"When loading a project, only relevant tracks will be added to the timeline.", "When loading a project, only relevant tracks will be added to the "
"timeline.",
"<track-types>"} "<track-types>"}
, ,
{ {
@ -766,10 +768,12 @@ ges_launcher_parse_options (GESLauncher * self,
#ifdef HAVE_GST_VALIDATE #ifdef HAVE_GST_VALIDATE
{"set-scenario", 0, 0, G_OPTION_ARG_STRING, &opts->scenario, {"set-scenario", 0, 0, G_OPTION_ARG_STRING, &opts->scenario,
"ges-launch-1.0 exposes gst-validate functionalities, such as scenarios." "ges-launch-1.0 exposes gst-validate functionalities, such as scenarios."
" Scenarios describe actions to execute, such as seeks or setting of properties. " " Scenarios describe actions to execute, such as seeks or setting of "
"GES implements editing-specific actions such as adding or removing clips. " "properties. "
"See gst-validate-1.0 --help for more info about validate and scenarios, " "GES implements editing-specific actions such as adding or removing "
"and --inspect-action-type.", "clips. "
"See gst-validate-1.0 --help for more info about validate and "
"scenarios, " "and --inspect-action-type.",
"<scenario_name>"} "<scenario_name>"}
, ,
#endif #endif
@ -785,8 +789,10 @@ ges_launcher_parse_options (GESLauncher * self,
{NULL} {NULL}
}; };
if (!ctx) if (owns_ctx) {
opts->videosink = opts->audiosink = NULL;
ctx = g_option_context_new ("- plays or renders a timeline."); ctx = g_option_context_new ("- plays or renders a timeline.");
}
tmpargc = argc ? *argc : g_strv_length (*arguments); tmpargc = argc ? *argc : g_strv_length (*arguments);
if (tmpargc > 2) { if (tmpargc > 2) {
@ -827,6 +833,16 @@ ges_launcher_parse_options (GESLauncher * self,
if (owns_ctx) { if (owns_ctx) {
g_option_context_free (ctx); g_option_context_free (ctx);
/* sinks passed in the command line are preferred. */
if (prev_videosink) {
g_free (opts->videosink);
opts->videosink = prev_videosink;
}
if (prev_audiosink) {
g_free (opts->audiosink);
opts->audiosink = prev_audiosink;
}
_set_playback_details (self); _set_playback_details (self);
} }