mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
validate: Port to the new REPORT_ACTION API
This commit is contained in:
parent
b7c4171f31
commit
056ac5eeb0
1 changed files with 18 additions and 17 deletions
|
@ -56,7 +56,8 @@ error_loading_asset_cb (GESProject * project, GError * err,
|
||||||
}
|
}
|
||||||
|
|
||||||
static GESTimeline *
|
static GESTimeline *
|
||||||
_ges_load_timeline (GstValidateScenario * scenario, const gchar * project_uri)
|
_ges_load_timeline (GstValidateScenario * scenario, GstValidateAction * action,
|
||||||
|
const gchar * project_uri)
|
||||||
{
|
{
|
||||||
GESProject *project = ges_project_new (project_uri);
|
GESProject *project = ges_project_new (project_uri);
|
||||||
GESTimeline *timeline;
|
GESTimeline *timeline;
|
||||||
|
@ -78,9 +79,9 @@ _ges_load_timeline (GstValidateScenario * scenario, const gchar * project_uri)
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
GST_VALIDATE_REPORT (scenario, SCENARIO_ACTION_EXECUTION_ERROR,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
"Can not load timeline from: %s (%s)", project_uri,
|
SCENARIO_ACTION_EXECUTION_ERROR, "Can not load timeline from: %s (%s)",
|
||||||
data.error->message);
|
project_uri, data.error->message);
|
||||||
g_clear_error (&data.error);
|
g_clear_error (&data.error);
|
||||||
gst_clear_object (&timeline);
|
gst_clear_object (&timeline);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +98,7 @@ done:
|
||||||
if (!project_uri) { \
|
if (!project_uri) { \
|
||||||
pipeline = gst_validate_scenario_get_pipeline(scenario); \
|
pipeline = gst_validate_scenario_get_pipeline(scenario); \
|
||||||
if (pipeline == NULL) { \
|
if (pipeline == NULL) { \
|
||||||
GST_VALIDATE_REPORT(scenario, SCENARIO_ACTION_EXECUTION_ERROR, \
|
GST_VALIDATE_REPORT_ACTION (scenario, action, SCENARIO_ACTION_EXECUTION_ERROR, \
|
||||||
"Can't execute a '%s' action after the pipeline " \
|
"Can't execute a '%s' action after the pipeline " \
|
||||||
"has been destroyed.", \
|
"has been destroyed.", \
|
||||||
action->type); \
|
action->type); \
|
||||||
|
@ -105,7 +106,7 @@ done:
|
||||||
} \
|
} \
|
||||||
g_object_get(pipeline, "timeline", &timeline, NULL); \
|
g_object_get(pipeline, "timeline", &timeline, NULL); \
|
||||||
} else { \
|
} else { \
|
||||||
timeline = _ges_load_timeline(scenario, project_uri); \
|
timeline = _ges_load_timeline(scenario, action, project_uri); \
|
||||||
if (!timeline) \
|
if (!timeline) \
|
||||||
return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED; \
|
return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED; \
|
||||||
}
|
}
|
||||||
|
@ -118,7 +119,7 @@ done:
|
||||||
#define SAVE_TIMELINE_IF_NEEDED(scenario, timeline, action) \
|
#define SAVE_TIMELINE_IF_NEEDED(scenario, timeline, action) \
|
||||||
{ \
|
{ \
|
||||||
if (!_ges_save_timeline_if_needed(timeline, action->structure, NULL)) { \
|
if (!_ges_save_timeline_if_needed(timeline, action->structure, NULL)) { \
|
||||||
GST_VALIDATE_REPORT(scenario, \
|
GST_VALIDATE_REPORT_ACTION(scenario, action, \
|
||||||
g_quark_from_string("scenario::execution-error"), \
|
g_quark_from_string("scenario::execution-error"), \
|
||||||
"Could not save timeline to %s", gst_structure_get_string(action->structure, "project-id")); \
|
"Could not save timeline to %s", gst_structure_get_string(action->structure, "project-id")); \
|
||||||
gst_object_unref(timeline); \
|
gst_object_unref(timeline); \
|
||||||
|
@ -341,8 +342,8 @@ _edit_container (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
|
|
||||||
container = ges_timeline_get_element (timeline, clip_name);
|
container = ges_timeline_get_element (timeline, clip_name);
|
||||||
if (!container) {
|
if (!container) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
SCENARIO_ACTION_EXECUTION_ERROR,
|
||||||
"Could not find container %s", clip_name);
|
"Could not find container %s", clip_name);
|
||||||
return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED;
|
return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED;
|
||||||
}
|
}
|
||||||
|
@ -623,7 +624,7 @@ _copy_element (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
gst_object_unref (timeline);
|
gst_object_unref (timeline);
|
||||||
|
|
||||||
if (!pasted) {
|
if (!pasted) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
g_quark_from_string ("scenario::execution-error"),
|
||||||
"Could not paste clip %s", element_name);
|
"Could not paste clip %s", element_name);
|
||||||
return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED;
|
return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED;
|
||||||
|
@ -632,7 +633,7 @@ _copy_element (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
paste_name = gst_structure_get_string (action->structure, "paste-name");
|
paste_name = gst_structure_get_string (action->structure, "paste-name");
|
||||||
if (paste_name) {
|
if (paste_name) {
|
||||||
if (!ges_timeline_element_set_name (pasted, paste_name)) {
|
if (!ges_timeline_element_set_name (pasted, paste_name)) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
g_quark_from_string ("scenario::execution-error"),
|
||||||
"Could not set element name %s", paste_name);
|
"Could not set element name %s", paste_name);
|
||||||
|
|
||||||
|
@ -732,7 +733,7 @@ _validate_action_execute (GstValidateScenario * scenario,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!func (timeline, action->structure, &err)) {
|
if (!func (timeline, action->structure, &err)) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
g_quark_from_string ("scenario::execution-error"),
|
||||||
"Could not execute %s (error: %s)",
|
"Could not execute %s (error: %s)",
|
||||||
gst_structure_get_name (action->structure),
|
gst_structure_get_name (action->structure),
|
||||||
|
@ -775,7 +776,7 @@ _load_project (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
gst_validate_printf (action, "Loading project from serialized content\n");
|
gst_validate_printf (action, "Loading project from serialized content\n");
|
||||||
|
|
||||||
if (!GES_IS_PIPELINE (pipeline)) {
|
if (!GES_IS_PIPELINE (pipeline)) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
g_quark_from_string ("scenario::execution-error"),
|
||||||
"Not a GES pipeline, can't work with it");
|
"Not a GES pipeline, can't work with it");
|
||||||
|
|
||||||
|
@ -789,7 +790,7 @@ _load_project (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
|
|
||||||
g_file_set_contents (tmpfile, content, -1, &error);
|
g_file_set_contents (tmpfile, content, -1, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
g_quark_from_string ("scenario::execution-error"),
|
||||||
"Could not set XML content: %s", error->message);
|
"Could not set XML content: %s", error->message);
|
||||||
|
|
||||||
|
@ -798,7 +799,7 @@ _load_project (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
|
|
||||||
uri = gst_filename_to_uri (tmpfile, &error);
|
uri = gst_filename_to_uri (tmpfile, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
g_quark_from_string ("scenario::execution-error"),
|
||||||
"Could not set filename to URI: %s", error->message);
|
"Could not set filename to URI: %s", error->message);
|
||||||
|
|
||||||
|
@ -808,7 +809,7 @@ _load_project (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
uri = g_strdup (gst_structure_get_string (action->structure, "uri"));
|
uri = g_strdup (gst_structure_get_string (action->structure, "uri"));
|
||||||
|
|
||||||
if (!uri) {
|
if (!uri) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
g_quark_from_string ("scenario::execution-error"),
|
||||||
"None of 'uri' or 'content' passed as parametter"
|
"None of 'uri' or 'content' passed as parametter"
|
||||||
" can't load any timeline!");
|
" can't load any timeline!");
|
||||||
|
@ -830,7 +831,7 @@ _load_project (GstValidateScenario * scenario, GstValidateAction * action)
|
||||||
g_signal_connect (project, "loaded", G_CALLBACK (_project_loaded_cb), action);
|
g_signal_connect (project, "loaded", G_CALLBACK (_project_loaded_cb), action);
|
||||||
ges_project_load (project, timeline, &error);
|
ges_project_load (project, timeline, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
GST_VALIDATE_REPORT (scenario,
|
GST_VALIDATE_REPORT_ACTION (scenario, action,
|
||||||
g_quark_from_string ("scenario::execution-error"),
|
g_quark_from_string ("scenario::execution-error"),
|
||||||
"Could not load timeline: %s", error->message);
|
"Could not load timeline: %s", error->message);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue