validate: Allow scenarios to set track types

This commit is contained in:
Thibault Saunier 2019-06-28 17:35:40 -04:00
parent 147cbcd6e1
commit 99c45d42cf
3 changed files with 32 additions and 10 deletions

View file

@ -206,15 +206,16 @@ _project_loaded_cb (GESProject * project, GESTimeline * timeline,
}
project_uri = ges_project_get_uri (project);
_timeline_set_user_options (self, timeline, project_uri);
if (self->priv->parsed_options.load_path && project_uri
&& ges_validate_activate (GST_PIPELINE (self->priv->pipeline),
opts->scenario, &opts->needs_set_state) == FALSE) {
&opts->track_types, opts->scenario,
&opts->needs_set_state) == FALSE) {
g_error ("Could not activate scenario %s", opts->scenario);
self->priv->seenerrors = TRUE;
g_application_quit (G_APPLICATION (self));
}
_timeline_set_user_options (self, timeline, project_uri);
g_free (project_uri);
@ -414,7 +415,8 @@ _run_pipeline (GESLauncher * self)
if (!opts->load_path) {
if (ges_validate_activate (GST_PIPELINE (self->priv->pipeline),
opts->scenario, &opts->needs_set_state) == FALSE) {
&opts->track_types, opts->scenario,
&opts->needs_set_state) == FALSE) {
g_error ("Could not activate scenario %s", opts->scenario);
return FALSE;
}

View file

@ -22,16 +22,17 @@
#include "config.h"
#endif
#include "utils.h"
#include "ges-validate.h"
#include <string.h>
#include <ges/ges.h>
#ifdef HAVE_GST_VALIDATE
#include <gst/validate/gst-validate-scenario.h>
#include <gst/validate/validate.h>
#include <gst/validate/gst-validate-utils.h>
#include <gst/validate/gst-validate-element-monitor.h>
#include <gst/validate/gst-validate-bin-monitor.h>
#define MONITOR_ON_PIPELINE "validate-monitor"
#define RUNNER_ON_PIPELINE "runner-monitor"
@ -99,10 +100,9 @@ ges_validate_register_issues (void)
" in a Video track).", GST_VALIDATE_REPORT_LEVEL_CRITICAL));
}
gboolean
ges_validate_activate (GstPipeline * pipeline, const gchar * scenario,
gboolean * needs_setting_state)
ges_validate_activate (GstPipeline * pipeline, GESTrackType * track_types,
const gchar * scenario, gboolean * needs_setting_state)
{
GstValidateRunner *runner = NULL;
GstValidateMonitor *monitor = NULL;
@ -126,6 +126,24 @@ ges_validate_activate (GstPipeline * pipeline, const gchar * scenario,
monitor =
gst_validate_monitor_factory_create (GST_OBJECT_CAST (pipeline), runner,
NULL);
if (GST_VALIDATE_BIN_MONITOR (monitor)->scenario) {
GstStructure *metas =
GST_VALIDATE_BIN_MONITOR (monitor)->scenario->description;
if (metas) {
const gchar *track_types_str;
if ((track_types_str =
gst_structure_get_string (metas, "ges-track-types"))) {
if (!get_flags_from_string (GES_TYPE_TRACK_TYPE, track_types_str,
track_types)) {
GST_ERROR_OBJECT (pipeline, "Scenario track types: %s no valid",
track_types_str);
return FALSE;
}
}
}
}
gst_validate_reporter_set_handle_g_logs (GST_VALIDATE_REPORTER (monitor));
@ -208,8 +226,8 @@ _print_position (GstElement * pipeline)
}
gboolean
ges_validate_activate (GstPipeline * pipeline, const gchar * scenario,
gboolean * needs_setting_state)
ges_validate_activate (GstPipeline * pipeline, GESTrackType * track_types,
const gchar * scenario, gboolean * needs_setting_state)
{
if (scenario) {
GST_WARNING ("Trying to run scenario %s, but gst-validate not supported",

View file

@ -23,11 +23,13 @@
#include <glib.h>
#include <gio/gio.h>
#include <gst/gst.h>
#include <ges/ges.h>
G_BEGIN_DECLS
gboolean
ges_validate_activate (GstPipeline *pipeline, const gchar *scenario, gboolean *needs_set_state);
ges_validate_activate (GstPipeline *pipeline, GESTrackType *track_types,
const gchar *scenario, gboolean *needs_set_state);
void ges_launch_validate_uri (const gchar *nid);
gint