validate: Add/fix various annotations

And fix monitor constructors to correctly check for valid arguments.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
This commit is contained in:
Sebastian Dröge 2022-10-15 11:38:02 +03:00 committed by GStreamer Marge Bot
parent 533ea9bd7c
commit 3827f94574
8 changed files with 60 additions and 64 deletions

View file

@ -194,25 +194,18 @@ gst_validate_bin_monitor_init (GstValidateBinMonitor * bin_monitor)
* @runner: (transfer none): a #GstValidateRunner
* @parent: (nullable): The parent of the new monitor
*
* Returns: (transfer full): A #GstValidateBinMonitor or NULL
* Returns: (transfer full): A #GstValidateBinMonitor
*/
GstValidateBinMonitor *
gst_validate_bin_monitor_new (GstBin * bin, GstValidateRunner * runner,
GstValidateMonitor * parent)
{
GstValidateBinMonitor *monitor =
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
g_return_val_if_fail (runner != NULL, NULL);
return
g_object_new (GST_TYPE_VALIDATE_BIN_MONITOR, "object",
bin, "validate-runner", runner, "validate-parent", parent, NULL);
GstObject *target =
gst_validate_monitor_get_target (GST_VALIDATE_MONITOR (monitor));
if (target == NULL) {
g_object_unref (monitor);
return NULL;
}
gst_object_unref (target);
return monitor;
}
static void

View file

@ -155,31 +155,17 @@ gst_validate_element_monitor_init (GstValidateElementMonitor * element_monitor)
* @runner: (transfer none): a #GstValidateRunner
* @parent: (nullable): The parent of the new monitor
*
* Returns: (transfer full): A #GstValidateElementMonitor or NULL
* Returns: (transfer full): A #GstValidateElementMonitor
*/
GstValidateElementMonitor *
gst_validate_element_monitor_new (GstElement * element,
GstValidateRunner * runner, GstValidateMonitor * parent)
{
GstValidateElementMonitor *monitor;
GstElement *target;
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
g_return_val_if_fail (runner != NULL, NULL);
g_return_val_if_fail (element != NULL, NULL);
monitor = g_object_new (GST_TYPE_VALIDATE_ELEMENT_MONITOR, "object", element,
return g_object_new (GST_TYPE_VALIDATE_ELEMENT_MONITOR, "object", element,
"validate-runner", runner, "validate-parent", parent, NULL);
target =
GST_ELEMENT (gst_validate_monitor_get_target (GST_VALIDATE_MONITOR
(monitor)));
if (!target) {
g_object_unref (monitor);
return NULL;
}
gst_object_unref (target);
return monitor;
}
static GstElement *

View file

@ -317,7 +317,7 @@ gst_validate_monitor_setup (GstValidateMonitor * monitor)
* gst_validate_monitor_get_element
* @monitor: The monitor
*
* Returns: (transfer none): The GstElement associated with @monitor
* Returns: (transfer none) (nullable): The GstElement associated with @monitor
*/
GstElement *
gst_validate_monitor_get_element (GstValidateMonitor * monitor)
@ -331,6 +331,12 @@ gst_validate_monitor_get_element (GstValidateMonitor * monitor)
return element;
}
/**
* gst_validate_monitor_get_element_name
* @monitor: The monitor
*
* Returns: (transfer full) (nullable): The name of the element associated with @monitor
*/
gchar *
gst_validate_monitor_get_element_name (GstValidateMonitor * monitor)
{

View file

@ -1041,25 +1041,18 @@ gst_validate_pad_monitor_init (GstValidatePadMonitor * pad_monitor)
* @runner: (transfer none): a #GstValidateRunner
* @parent: (nullable): The parent of the new monitor
*
* Returns: (transfer full): A #GstValidatePadMonitor or NULL
* Returns: (transfer full): A #GstValidatePadMonitor
*/
GstValidatePadMonitor *
gst_validate_pad_monitor_new (GstPad * pad, GstValidateRunner * runner,
GstValidateElementMonitor * parent)
{
GstValidatePadMonitor *monitor = g_object_new (GST_TYPE_VALIDATE_PAD_MONITOR,
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
g_return_val_if_fail (runner != NULL, NULL);
return g_object_new (GST_TYPE_VALIDATE_PAD_MONITOR,
"object", pad, "validate-runner", runner, "validate-parent",
parent, NULL);
GstObject *target =
gst_validate_monitor_get_target (GST_VALIDATE_MONITOR (monitor));
if (target == NULL) {
g_object_unref (monitor);
return NULL;
}
gst_object_unref (target);
return monitor;
}
static GstElement *

View file

@ -826,24 +826,22 @@ done:
* @runner: (transfer none): a #GstValidateRunner
* @parent: (nullable): The parent of the new monitor
*
* Returns: (transfer full): A #GstValidatePipelineMonitor or NULL
* Returns: (transfer full): A #GstValidatePipelineMonitor
*/
GstValidatePipelineMonitor *
gst_validate_pipeline_monitor_new (GstPipeline * pipeline,
GstValidateRunner * runner, GstValidateMonitor * parent)
{
GstBus *bus;
GstValidatePipelineMonitor *monitor =
GstValidatePipelineMonitor *monitor;
g_return_val_if_fail (GST_IS_PIPELINE (pipeline), NULL);
g_return_val_if_fail (runner != NULL, NULL);
monitor =
g_object_new (GST_TYPE_VALIDATE_PIPELINE_MONITOR, "object",
pipeline, "validate-runner", runner, "validate-parent", parent,
"pipeline", pipeline, NULL);
GstObject *target =
gst_validate_monitor_get_target (GST_VALIDATE_MONITOR (monitor));
if (target == NULL) {
g_object_unref (monitor);
return NULL;
}
gst_validate_pipeline_monitor_create_scenarios (GST_VALIDATE_BIN_MONITOR
(monitor));
@ -865,7 +863,6 @@ gst_validate_pipeline_monitor_new (GstPipeline * pipeline,
monitor->is_playbin = TRUE;
else if (g_strcmp0 (G_OBJECT_TYPE_NAME (pipeline), "GstPlayBin3") == 0)
monitor->is_playbin3 = TRUE;
gst_object_unref (target);
return monitor;
}

View file

@ -209,14 +209,14 @@ MAKE_GETTER_COPY (gchar *, reporter_name, g_strdup);
/**
* gst_validate_report_get_trace:
*
* Returns: (transfer full): report backtrace
* Returns: (transfer full) (nullable): report backtrace
* Since: 1.22
*/
MAKE_GETTER_COPY (gchar *, trace, g_strdup);
/**
* gst_validate_report_get_dotfile_name:
*
* Returns: (transfer full): report dot file name
* Returns: (transfer full) (nullable): report dot file name
* Since: 1.22
*/
MAKE_GETTER_COPY (gchar *, dotfile_name, g_strdup);
@ -744,6 +744,12 @@ gst_validate_report_deinit (void)
g_clear_object (&server_connection);
}
/**
* gst_validate_issue_from_id:
* @issue_id: The issue id
*
* Returns: (nullable): The issue if found or NULL otherwise
*/
GstValidateIssue *
gst_validate_issue_from_id (GstValidateIssueId issue_id)
{

View file

@ -153,6 +153,13 @@ gst_validate_reporter_get_pipeline (GstValidateReporter * reporter)
return NULL;
}
/**
* gst_validate_reporter_get_report:
* @reporter: The reporter to get the report from
* @issue_id: The issue id to get the report from
*
* Returns: (transfer none) (nullable): The #GstValidateReport
*/
GstValidateReport *
gst_validate_reporter_get_report (GstValidateReporter * reporter,
GstValidateIssueId issue_id)
@ -410,7 +417,7 @@ gst_validate_reporter_report_simple (GstValidateReporter * reporter,
/**
* gst_validate_reporter_set_name:
* @reporter: The reporter to set the name on
* @name: (transfer full): The name of the reporter
* @name: (transfer full) (nullable): The name of the reporter
*
* Sets @name on @reporter
*/
@ -424,6 +431,14 @@ gst_validate_reporter_set_name (GstValidateReporter * reporter, gchar * name)
priv->name = name;
}
/**
* gst_validate_reporter_get_name:
* @reporter: The reporter to get the name from
*
* Gets @name of @reporter
*
* Returns: (transfer none) (nullable): The name of the reporter
*/
const gchar *
gst_validate_reporter_get_name (GstValidateReporter * reporter)
{

View file

@ -324,7 +324,7 @@ gst_validate_scenario_intercept_report (GstValidateReporter * reporter,
* gst_validate_scenario_get_pipeline:
* @scenario: The scenario to retrieve a pipeline from
*
* Returns: (transfer full): The #GstPipeline the scenario is running
* Returns: (transfer full) (nullable): The #GstPipeline the scenario is running
* against
*/
GstElement *
@ -5378,7 +5378,7 @@ gst_validate_scenario_from_structs (GstValidateRunner * runner,
* @pipeline: The pipeline to run the scenario on
* @scenario_name: The name (or path) of the scenario to run
*
* Returns: (transfer full): A #GstValidateScenario or NULL
* Returns: (transfer full) (nullable): A #GstValidateScenario or NULL
*/
GstValidateScenario *
gst_validate_scenario_factory_create (GstValidateRunner *
@ -6375,7 +6375,7 @@ gst_validate_action_set_done (GstValidateAction * action)
*
* Retrieve the scenario from which @action is executed.
*
* Returns: (transfer full): The scenario from which the action is being executed.
* Returns: (transfer full) (nullable): The scenario from which the action is being executed.
*/
GstValidateScenario *
gst_validate_action_get_scenario (GstValidateAction * action)