mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 13:25:56 +00:00
validate: flow: Allow logging upstream events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7382>
This commit is contained in:
parent
0fc5210c48
commit
8fdd59f9d5
5 changed files with 26 additions and 4 deletions
|
@ -150,9 +150,12 @@ several overrides and listening to different pads with different settings.
|
||||||
caps={width, height, framerate}, buffer={pts}"`. Overrides
|
caps={width, height, framerate}, buffer={pts}"`. Overrides
|
||||||
`ignored-event-fields` for specified event types.
|
`ignored-event-fields` for specified event types.
|
||||||
* `ignored-event-types`: Default: `{ }`. List of event type names to not record
|
* `ignored-event-types`: Default: `{ }`. List of event type names to not record
|
||||||
* `logged-event-types`: Default: `NULL`. List of event type names to not record,
|
* `logged-event-types`: Default: `NULL`. List of (downstream) event type names to not record,
|
||||||
if noone provided, all events are logged, except the ones defined in the
|
if noone provided, all events are logged, except the ones defined in the
|
||||||
`ignored-event-types`.
|
`ignored-event-types`.
|
||||||
|
* `logged-upstream-event-types`: Default: `NULL`. List of upstream event type names to record,
|
||||||
|
for backward compatibility reasons, upstream events are not logged by default,
|
||||||
|
and you must specify the ones you want to be logged.
|
||||||
* `expectations-dir`: Path to the directory where the expectations will be
|
* `expectations-dir`: Path to the directory where the expectations will be
|
||||||
written if they don't exist, relative to the current working directory. By
|
written if they don't exist, relative to the current working directory. By
|
||||||
default the current working directory is used, but this setting is usually
|
default the current working directory is used, but this setting is usually
|
||||||
|
|
|
@ -450,7 +450,8 @@ validate_flow_format_event (GstEvent * event,
|
||||||
GstStructure * logged_fields_struct,
|
GstStructure * logged_fields_struct,
|
||||||
GstStructure * ignored_fields_struct,
|
GstStructure * ignored_fields_struct,
|
||||||
const gchar * const *ignored_event_types,
|
const gchar * const *ignored_event_types,
|
||||||
const gchar * const *logged_event_types)
|
const gchar * const *logged_event_types,
|
||||||
|
const gchar * const *logged_upstream_event_types)
|
||||||
{
|
{
|
||||||
const gchar *event_type;
|
const gchar *event_type;
|
||||||
gchar *structure_string;
|
gchar *structure_string;
|
||||||
|
@ -460,6 +461,16 @@ validate_flow_format_event (GstEvent * event,
|
||||||
|
|
||||||
event_type = gst_event_type_get_name (GST_EVENT_TYPE (event));
|
event_type = gst_event_type_get_name (GST_EVENT_TYPE (event));
|
||||||
|
|
||||||
|
if (GST_EVENT_IS_UPSTREAM (event) && !GST_EVENT_IS_DOWNSTREAM (event)) {
|
||||||
|
/* For backward compatibility reason, only logged requested upstream event
|
||||||
|
* types */
|
||||||
|
if (!logged_upstream_event_types)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!g_strv_contains (logged_upstream_event_types, event_type))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (logged_event_types && !g_strv_contains (logged_event_types, event_type))
|
if (logged_event_types && !g_strv_contains (logged_event_types, event_type))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,6 @@ gchar* validate_flow_format_caps (const GstCaps* caps, gchar **wanted_fields, gc
|
||||||
|
|
||||||
gchar* validate_flow_format_buffer(GstBuffer* buffer, gboolean add_checksum, GstStructure* logged_fields_struct, GstStructure* ignored_fields_struct);
|
gchar* validate_flow_format_buffer(GstBuffer* buffer, gboolean add_checksum, GstStructure* logged_fields_struct, GstStructure* ignored_fields_struct);
|
||||||
|
|
||||||
gchar* validate_flow_format_event(GstEvent* event, const gchar* const* caps_properties, GstStructure* logged_event_fields, GstStructure* ignored_event_fields, const gchar* const* ignored_event_types, const gchar* const* logged_event_types);
|
gchar* validate_flow_format_event(GstEvent* event, const gchar* const* caps_properties, GstStructure* logged_event_fields, GstStructure* ignored_event_fields, const gchar* const* ignored_event_types, const gchar* const* logged_event_types, const gchar* const* logged_upstream_event_types);
|
||||||
|
|
||||||
#endif // __GST_VALIDATE_FLOW_FORMATTING_H__
|
#endif // __GST_VALIDATE_FLOW_FORMATTING_H__
|
||||||
|
|
|
@ -87,6 +87,7 @@ struct _ValidateFlowOverride
|
||||||
GstStructure *logged_fields;
|
GstStructure *logged_fields;
|
||||||
|
|
||||||
gchar **logged_event_types;
|
gchar **logged_event_types;
|
||||||
|
gchar **logged_upstream_event_types;
|
||||||
gchar **ignored_event_types;
|
gchar **ignored_event_types;
|
||||||
|
|
||||||
gchar *expectations_file_path;
|
gchar *expectations_file_path;
|
||||||
|
@ -192,7 +193,8 @@ validate_flow_override_event_handler (GstValidateOverride * override,
|
||||||
flow->logged_fields,
|
flow->logged_fields,
|
||||||
flow->ignored_fields,
|
flow->ignored_fields,
|
||||||
(const gchar * const *) flow->ignored_event_types,
|
(const gchar * const *) flow->ignored_event_types,
|
||||||
(const gchar * const *) flow->logged_event_types);
|
(const gchar * const *) flow->logged_event_types,
|
||||||
|
(const gchar * const *) flow->logged_upstream_event_types);
|
||||||
|
|
||||||
if (event_string) {
|
if (event_string) {
|
||||||
validate_flow_override_printf (flow, "event %s\n", event_string);
|
validate_flow_override_printf (flow, "event %s\n", event_string);
|
||||||
|
@ -294,6 +296,8 @@ validate_flow_override_new (GstStructure * config)
|
||||||
|
|
||||||
flow->logged_event_types =
|
flow->logged_event_types =
|
||||||
gst_validate_utils_get_strv (config, "logged-event-types");
|
gst_validate_utils_get_strv (config, "logged-event-types");
|
||||||
|
flow->logged_upstream_event_types =
|
||||||
|
gst_validate_utils_get_strv (config, "logged-upstream-event-types");
|
||||||
flow->ignored_event_types =
|
flow->ignored_event_types =
|
||||||
gst_validate_utils_get_strv (config, "ignored-event-types");
|
gst_validate_utils_get_strv (config, "ignored-event-types");
|
||||||
|
|
||||||
|
@ -619,6 +623,7 @@ validate_flow_override_finalize (GObject * object)
|
||||||
fclose (flow->output_file);
|
fclose (flow->output_file);
|
||||||
g_strfreev (flow->caps_properties);
|
g_strfreev (flow->caps_properties);
|
||||||
g_strfreev (flow->logged_event_types);
|
g_strfreev (flow->logged_event_types);
|
||||||
|
g_strfreev (flow->logged_upstream_event_types);
|
||||||
g_strfreev (flow->ignored_event_types);
|
g_strfreev (flow->ignored_event_types);
|
||||||
if (flow->ignored_fields)
|
if (flow->ignored_fields)
|
||||||
gst_structure_free (flow->ignored_fields);
|
gst_structure_free (flow->ignored_fields);
|
||||||
|
|
|
@ -2428,10 +2428,13 @@ gst_validate_pad_monitor_src_event_func (GstPad * pad, GstObject * parent,
|
||||||
GstValidatePadMonitor *pad_monitor = _GET_PAD_MONITOR (pad);
|
GstValidatePadMonitor *pad_monitor = _GET_PAD_MONITOR (pad);
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
|
gst_validate_pad_monitor_event_overrides (pad_monitor, event);
|
||||||
|
|
||||||
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
|
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
|
||||||
ret = gst_validate_pad_monitor_src_event_check (pad_monitor, parent, event,
|
ret = gst_validate_pad_monitor_src_event_check (pad_monitor, parent, event,
|
||||||
pad_monitor->event_func);
|
pad_monitor->event_func);
|
||||||
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
|
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue