Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Thibault Saunier
gst-devtools
Commits
598ec0a5
Commit
598ec0a5
authored
Jun 12, 2020
by
Thibault Saunier
🌵
Committed by
GStreamer Marge Bot
Jun 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scenario: Add an action to remove a feature/plugin from the registry
Part-of: <
gstreamer/gst-devtools!207
>
parent
dda8e721
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
27 deletions
+48
-27
validate/gst/validate/gst-validate-scenario.c
validate/gst/validate/gst-validate-scenario.c
+48
-27
No files found.
validate/gst/validate/gst-validate-scenario.c
View file @
598ec0a5
...
...
@@ -2044,51 +2044,58 @@ _execute_switch_track (GstValidateScenario * scenario,
}
static
GstValidateExecuteActionReturn
_execute_set_rank
(
GstValidateScenario
*
scenario
,
GstValidateAction
*
action
)
_execute_set_rank_or_disable_feature
(
GstValidateScenario
*
scenario
,
GstValidateAction
*
action
)
{
GstValidateExecuteActionReturn
res
=
GST_VALIDATE_EXECUTE_ACTION_OK
;
guint
rank
;
GList
*
features
,
*
origlist
;
GstPlugin
*
plugin
;
GstPluginFeature
*
feature
;
const
gchar
*
name
;
if
(
!
(
name
=
gst_structure_
get_string
(
action
->
structure
,
"
feature-name"
))
&&
!
(
name
=
gst_structure_get_string
(
action
->
structure
,
"name"
)))
{
GST_ERROR
(
"Could not find the name of the plugin feature(s) to tweak"
);
return
GST_VALIDATE_EXECUTE_ACTION_ERROR
;
}
if
(
!
(
gst_structure_get_uint
(
action
->
structure
,
"rank"
,
&
rank
)
||
gst_structure_get_int
(
action
->
structure
,
"rank"
,
(
gint
*
)
&
rank
)))
{
GST_ERROR
(
"Could not get rank to set on %s"
,
name
);
return
GST_VALIDATE_EXECUTE_ACTION_ERROR
;
}
feature
=
gst_registry_lookup_feature
(
gst_
registry
_get
()
,
name
);
gboolean
removing_feature
=
gst_structure_
has_name
(
action
->
structure
,
"
remove-plugin-feature"
);
GstRegistry
*
registry
=
gst_registry_get
();
REPORT_UNLESS
(
(
name
=
gst_structure_get_string
(
action
->
structure
,
"feature-name"
))
||
(
name
=
gst_structure_get_string
(
action
->
structure
,
"name"
)),
done
,
"Could not find the name of the plugin/feature(s) to tweak"
);
if
(
removing_feature
)
REPORT_UNLESS
(
(
gst_structure_get_uint
(
action
->
structure
,
"rank"
,
&
rank
))
||
(
gst_structure_get_int
(
action
->
structure
,
"rank"
,
(
gint
*
)
&
rank
)),
done
,
"Could not get rank to set on %s"
,
name
);
feature
=
gst_registry_lookup_feature
(
registry
,
name
);
if
(
feature
)
{
gst_plugin_feature_set_rank
(
feature
,
rank
);
if
(
removing_feature
)
gst_plugin_feature_set_rank
(
feature
,
rank
);
else
gst_registry_remove_feature
(
registry
,
feature
);
gst_object_unref
(
feature
);
return
GST_VALIDATE_EXECUTE_ACTION_OK
;
goto
done
;
}
plugin
=
gst_registry_find_plugin
(
gst_registry_get
(),
name
);
if
(
!
plugin
)
{
GST_ERROR
(
"Could not find %s"
,
name
);
REPORT_UNLESS
((
plugin
=
gst_registry_find_plugin
(
registry
,
name
)),
done
,
"Could not find %s"
,
name
);
return
GST_VALIDATE_EXECUTE_ACTION_ERROR
;
if
(
removing_feature
)
{
gst_registry_remove_plugin
(
registry
,
plugin
);
goto
done
;
}
origlist
=
features
=
gst_registry_get_feature_list_by_plugin
(
gst_
registry
_get
()
,
gst_registry_get_feature_list_by_plugin
(
registry
,
gst_plugin_get_name
(
plugin
));
for
(;
features
;
features
=
features
->
next
)
gst_plugin_feature_set_rank
(
features
->
data
,
rank
);
gst_plugin_feature_list_free
(
origlist
);
return
GST_VALIDATE_EXECUTE_ACTION_OK
;
done:
return
res
;
}
static
inline
gboolean
...
...
@@ -6258,7 +6265,7 @@ register_action_types (void)
"Note that the GST_DEBUG_DUMP_DOT_DIR env variable needs to be set"
,
GST_VALIDATE_ACTION_TYPE_NONE
);
REGISTER_ACTION_TYPE
(
"set-rank"
,
_execute_set_rank
,
REGISTER_ACTION_TYPE
(
"set-rank"
,
_execute_set_rank
_or_disable_feature
,
((
GstValidateActionParameter
[])
{
{
.
name
=
"name"
,
...
...
@@ -6277,7 +6284,21 @@ register_action_types (void)
"Changes the ranking of a particular plugin feature(s)"
,
GST_VALIDATE_ACTION_TYPE_CONFIG
);
REGISTER_ACTION_TYPE
(
"set-feature-rank"
,
_execute_set_rank
,
REGISTER_ACTION_TYPE
(
"remove-feature"
,
_execute_set_rank_or_disable_feature
,
((
GstValidateActionParameter
[])
{
{
.
name
=
"name"
,
.
description
=
"The name of a GstFeature or GstPlugin to remove"
,
.
mandatory
=
TRUE
,
.
types
=
"string"
,
NULL
},
{
NULL
}
}),
"Remove a plugin feature(s) or a plugin from the registry"
,
GST_VALIDATE_ACTION_TYPE_CONFIG
);
REGISTER_ACTION_TYPE
(
"set-feature-rank"
,
_execute_set_rank_or_disable_feature
,
((
GstValidateActionParameter
[])
{
{
.
name
=
"feature-name"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment