mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
ges-validate: Port to the new GstValidate action registration API
This commit is contained in:
parent
9a07ce7681
commit
9f97c14cea
3 changed files with 219 additions and 64 deletions
|
@ -740,6 +740,7 @@ main (int argc, gchar ** argv)
|
|||
gchar *load_path = NULL;
|
||||
gchar *videosink = NULL, *audiosink = NULL;
|
||||
const gchar *scenario = NULL;
|
||||
gboolean list_action_types = FALSE;
|
||||
|
||||
GOptionEntry options[] = {
|
||||
{"thumbnail", 'm', 0.0, G_OPTION_ARG_DOUBLE, &thumbinterval,
|
||||
|
@ -787,6 +788,8 @@ main (int argc, gchar ** argv)
|
|||
{"audiosink", 'a', 0, G_OPTION_ARG_STRING, &audiosink,
|
||||
"The audio sink used for playing back", "<audiosink>"},
|
||||
#ifdef HAVE_GST_VALIDATE
|
||||
{"list-action-types", 'y', 0, G_OPTION_ARG_NONE, &list_action_types,
|
||||
"List the avalaible action types with which to write scenarios", NULL},
|
||||
{"set-scenario", 0, 0, G_OPTION_ARG_STRING, &scenario,
|
||||
"Specify a GstValidate scenario to run, 'none' means load gst-validate"
|
||||
" but run no scenario on it", "<scenario_name>"},
|
||||
|
@ -843,6 +846,9 @@ main (int argc, gchar ** argv)
|
|||
exit (0);
|
||||
}
|
||||
|
||||
if (list_action_types)
|
||||
return ges_validate_print_action_types (argv + 1, argc - 1);
|
||||
|
||||
tried_uris = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
if (((!load_path && !scenario && (argc < 4)))) {
|
||||
g_printf ("%s", g_option_context_get_help (ctx, TRUE, NULL));
|
||||
|
|
|
@ -443,6 +443,198 @@ beach:
|
|||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
ges_validate_register_action_types (void)
|
||||
{
|
||||
gst_validate_init ();
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
gst_validate_add_action_type ("edit-clip", _edit_clip,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "clip-name",
|
||||
.description = "The name of the clip to edit",
|
||||
.mandatory = TRUE,
|
||||
.types = "string",
|
||||
},
|
||||
{
|
||||
.name = "position",
|
||||
.description = "The new position of the clip",
|
||||
.mandatory = TRUE,
|
||||
.types = "double or string",
|
||||
.possible_variables = "position: The current position in the stream\n"
|
||||
"duration: The duration of the stream",
|
||||
NULL
|
||||
},
|
||||
{
|
||||
.name = "edit-mode",
|
||||
.description = "The GESEditMode to use to edit @clip-name",
|
||||
.mandatory = FALSE,
|
||||
.types = "string",
|
||||
.def = "normal",
|
||||
},
|
||||
{
|
||||
.name = "edge",
|
||||
.description = "The GESEdge to use to edit @clip-name\n"
|
||||
"should be in [ edge_start, edge_end, edge_none ] ",
|
||||
.mandatory = FALSE,
|
||||
.types = "string",
|
||||
.def = "edge_none",
|
||||
},
|
||||
{
|
||||
.name = "new-layer-priority",
|
||||
.description = "The priority of the layer @container should land in.\n"
|
||||
"If the layer you're trying to move the container to doesn't exist, it will\n"
|
||||
"be created automatically. -1 means no move.",
|
||||
.mandatory = FALSE,
|
||||
.types = "int",
|
||||
.def = "-1",
|
||||
},
|
||||
{NULL}
|
||||
},
|
||||
"Allows to edit a clip, for more details, have a look at:\n"
|
||||
"ges_container_edit documentation, Note that the timeline will\n"
|
||||
"be commited, and flushed so that the edition is taken into account",
|
||||
FALSE);
|
||||
|
||||
gst_validate_add_action_type ("add-asset", _add_asset,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "id",
|
||||
.description = "",
|
||||
.mandatory = TRUE,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
.name = "type",
|
||||
.description = "The type of asset to add",
|
||||
.mandatory = TRUE,
|
||||
NULL
|
||||
},
|
||||
{NULL}
|
||||
},
|
||||
"Allows to add an asset to the current project", FALSE);
|
||||
|
||||
gst_validate_add_action_type ("remove-asset", _remove_asset,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "id",
|
||||
.description = "The ID of the clip to remove",
|
||||
.mandatory = TRUE,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
.name = "type",
|
||||
.description = "The type of asset to remove",
|
||||
.mandatory = TRUE,
|
||||
NULL
|
||||
},
|
||||
{ NULL }
|
||||
},
|
||||
"Allows to remove an asset from the current project", FALSE);
|
||||
|
||||
gst_validate_add_action_type ("add-layer", _add_layer,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "priority",
|
||||
.description = "The priority of the new layer to add",
|
||||
.mandatory = TRUE,
|
||||
NULL
|
||||
},
|
||||
{ NULL }
|
||||
},
|
||||
"Allows to add a layer to the current timeline", FALSE);
|
||||
|
||||
gst_validate_add_action_type ("remove-layer", _remove_layer,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "priority",
|
||||
.description = "The priority of the layer to remove",
|
||||
.mandatory = TRUE,
|
||||
NULL
|
||||
},
|
||||
{ NULL }
|
||||
},
|
||||
"Allows to remove a layer from the current timeline", FALSE);
|
||||
|
||||
gst_validate_add_action_type ("add-clip", _add_clip,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "name",
|
||||
.description = "The name of the clip to add",
|
||||
.types = "string",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{
|
||||
.name = "layer-priority",
|
||||
.description = "The priority of the clip to add",
|
||||
.types = "int",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{
|
||||
.name = "asset-id",
|
||||
.description = "The id of the asset from which to extract the clip",
|
||||
.types = "string",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{
|
||||
.name = "type",
|
||||
.description = "The type of the clip to create",
|
||||
.types = "string",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{NULL}
|
||||
}, "Allows to add a clip to a given layer", FALSE);
|
||||
|
||||
gst_validate_add_action_type ("remove-clip", _remove_clip,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "clip-name",
|
||||
.description = "The name of the clip to remove",
|
||||
.types = "string",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{NULL}
|
||||
}, "Allows to remove a clip from a given layer", FALSE);
|
||||
|
||||
gst_validate_add_action_type ("serialize-project", _serialize_project,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "uri",
|
||||
.description = "The uri where to store the serialized project",
|
||||
.types = "string",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{NULL}
|
||||
}, "serializes a project", FALSE);
|
||||
|
||||
gst_validate_add_action_type ("set-child-property", _set_child_property,
|
||||
(GstValidateActionParameter []) {
|
||||
{
|
||||
.name = "element-name",
|
||||
.description = "The name of the element on which to modify the property",
|
||||
.types = "string",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{
|
||||
.name = "property",
|
||||
.description = "The name of the property to modify",
|
||||
.types = "string",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{
|
||||
.name = "value",
|
||||
.description = "The value of the property",
|
||||
.types = "gvalue",
|
||||
.mandatory = TRUE,
|
||||
},
|
||||
{NULL}
|
||||
}, "Allows to change child property of an object", FALSE);
|
||||
|
||||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
ges_validate_activate (GstPipeline * pipeline, const gchar * scenario,
|
||||
gboolean * needs_setting_state)
|
||||
|
@ -451,43 +643,7 @@ ges_validate_activate (GstPipeline * pipeline, const gchar * scenario,
|
|||
GstValidateRunner *runner = NULL;
|
||||
GstValidateMonitor *monitor = NULL;
|
||||
|
||||
const gchar *move_clip_mandatory_fields[] = { "clip-name", "position",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *set_child_property_mandatory_fields[] =
|
||||
{ "element-name", "property", "value", NULL };
|
||||
|
||||
const gchar *serialize_project_mandatory_fields[] = { "uri",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *add_asset_mandatory_fields[] = { "id", "type",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *remove_asset_mandatory_fields[] = { "id", "type",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *add_layer_mandatory_fields[] = { "priority",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *remove_layer_mandatory_fields[] = { "priority",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *add_clip_mandatory_fields[] = { "name", "layer-priority",
|
||||
"asset-id", "type",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *remove_clip_mandatory_fields[] = { "name",
|
||||
NULL
|
||||
};
|
||||
|
||||
gst_validate_init ();
|
||||
ges_validate_register_action_types ();
|
||||
|
||||
if (scenario) {
|
||||
if (g_strcmp0 (scenario, "none")) {
|
||||
|
@ -497,33 +653,6 @@ ges_validate_activate (GstPipeline * pipeline, const gchar * scenario,
|
|||
}
|
||||
}
|
||||
|
||||
gst_validate_add_action_type ("edit-clip", _edit_clip,
|
||||
move_clip_mandatory_fields, "Allows to seek into the files", FALSE);
|
||||
gst_validate_add_action_type ("add-asset", _add_asset,
|
||||
add_asset_mandatory_fields,
|
||||
"Allows to add an asset to the current project", FALSE);
|
||||
gst_validate_add_action_type ("remove-asset", _remove_asset,
|
||||
remove_asset_mandatory_fields,
|
||||
"Allows to remove an asset from the current project", FALSE);
|
||||
gst_validate_add_action_type ("add-layer", _add_layer,
|
||||
add_layer_mandatory_fields,
|
||||
"Allows to add a layer to the current timeline", FALSE);
|
||||
gst_validate_add_action_type ("remove-layer", _remove_layer,
|
||||
remove_layer_mandatory_fields,
|
||||
"Allows to remove a layer from the current timeline", FALSE);
|
||||
gst_validate_add_action_type ("add-clip", _add_clip,
|
||||
add_clip_mandatory_fields, "Allows to add a clip to a given layer",
|
||||
FALSE);
|
||||
gst_validate_add_action_type ("remove-clip", _remove_clip,
|
||||
remove_clip_mandatory_fields,
|
||||
"Allows to remove a clip from a given layer", FALSE);
|
||||
gst_validate_add_action_type ("serialize-project", _serialize_project,
|
||||
serialize_project_mandatory_fields, "serializes a project", FALSE);
|
||||
|
||||
gst_validate_add_action_type ("set-child-property", _set_child_property,
|
||||
set_child_property_mandatory_fields,
|
||||
"Allows to change child property of an object", FALSE);
|
||||
|
||||
o = gst_validate_override_new ();
|
||||
gst_validate_override_change_severity (o,
|
||||
GST_VALIDATE_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG,
|
||||
|
@ -585,6 +714,19 @@ ges_validate_handle_request_state_change (GstMessage * message,
|
|||
}
|
||||
}
|
||||
|
||||
gint
|
||||
ges_validate_print_action_types (gchar ** types, gint num_types)
|
||||
{
|
||||
ges_validate_register_action_types ();
|
||||
|
||||
if (!gst_validate_print_action_types (types, num_types)) {
|
||||
GST_ERROR ("Could not print all wanted types");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
static gboolean
|
||||
_print_position (GstElement * pipeline)
|
||||
|
@ -642,4 +784,10 @@ ges_validate_handle_request_state_change (GstMessage * message,
|
|||
return;
|
||||
}
|
||||
|
||||
gint
|
||||
ges_validate_print_action_types (const gchar ** types, gint num_types)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,6 +32,7 @@ gint
|
|||
ges_validate_clean (GstPipeline *pipeline);
|
||||
|
||||
void ges_validate_handle_request_state_change (GstMessage *message, GMainLoop *mainloop);
|
||||
gint ges_validate_print_action_types (gchar **types, gint num_types);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue