From 8848657ce32f1e8a1e221ed6fc2b2aba740a9baa Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sat, 13 Dec 2014 16:00:12 +0100 Subject: [PATCH] validate:scenario: Add a disable-plugin action type https://bugzilla.gnome.org/show_bug.cgi?id=743994 --- validate/gst/validate/gst-validate-scenario.c | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c index 75806aa..a1edee7 100644 --- a/validate/gst/validate/gst-validate-scenario.c +++ b/validate/gst/validate/gst-validate-scenario.c @@ -1264,6 +1264,25 @@ _execute_emit_signal (GstValidateScenario * scenario, return TRUE; } +static GstValidateExecuteActionReturn +_execute_disable_plugin (GstValidateScenario * scenario, + GstValidateAction * action) +{ + GstPlugin *plugin; + const gchar *plugin_name; + + plugin_name = gst_structure_get_string (action->structure, "plugin-name"); + + plugin = gst_registry_find_plugin (gst_registry_get (), plugin_name); + + if (plugin == NULL) + return GST_VALIDATE_EXECUTE_ACTION_ERROR; + + gst_registry_remove_plugin (gst_registry_get (), plugin); + + return GST_VALIDATE_EXECUTE_ACTION_OK; +} + static void gst_validate_scenario_update_segment_from_seek (GstValidateScenario * scenario, GstEvent * seek) @@ -2497,6 +2516,21 @@ init_scenarios (void) "Emits a signal to an element in the pipeline", GST_VALIDATE_ACTION_TYPE_NONE); + REGISTER_ACTION_TYPE ("disable-plugin", _execute_disable_plugin, + ((GstValidateActionParameter []) + { + { + .name = "plugin-name", + .description = "The name of the GstPlugin to disable", + .mandatory = TRUE, + .types = "string" + }, + {NULL} + }), + "Disables a GstPlugin", + GST_VALIDATE_ACTION_TYPE_NONE); + /* *INDENT-ON* */ + socket_interposer_init (); /* *INDENT-ON* */ } -- 2.7.4