mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-20 06:08:14 +00:00
pad-monitor: call the event/query/buffer overrides
Use the new event/buffer/query overrides to allow custom checks on those scenarios
This commit is contained in:
parent
8a66b3d4ed
commit
55109ae7f9
5 changed files with 91 additions and 3 deletions
|
@ -56,9 +56,6 @@ gboolean gst_qa_monitor_setup (GstQaMonitor * monitor);
|
|||
static void gst_qa_monitor_intercept_report (GstQaReporter * reporter,
|
||||
GstQaReport * report);
|
||||
|
||||
#define GST_QA_MONITOR_OVERRIDES_LOCK(m) g_mutex_lock (&m->overrides_mutex)
|
||||
#define GST_QA_MONITOR_OVERRIDES_UNLOCK(m) g_mutex_unlock (&m->overrides_mutex)
|
||||
|
||||
#define _do_init \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_qa_monitor_debug, "qa_monitor", 0, "QA Monitor");\
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_QA_REPORTER, _reporter_iface_init)
|
||||
|
|
|
@ -44,6 +44,9 @@ G_BEGIN_DECLS
|
|||
#define GST_QA_MONITOR_GET_PARENT(m) (GST_QA_MONITOR_CAST (m)->parent)
|
||||
#define GST_QA_MONITOR_LOCK(m) (g_mutex_lock (&GST_QA_MONITOR_CAST(m)->mutex))
|
||||
#define GST_QA_MONITOR_UNLOCK(m) (g_mutex_unlock (&GST_QA_MONITOR_CAST(m)->mutex))
|
||||
#define GST_QA_MONITOR_OVERRIDES_LOCK(m) g_mutex_lock (&GST_QA_MONITOR_CAST (m)->overrides_mutex)
|
||||
#define GST_QA_MONITOR_OVERRIDES_UNLOCK(m) g_mutex_unlock (&GST_QA_MONITOR_CAST (m)->overrides_mutex)
|
||||
#define GST_QA_MONITOR_OVERRIDES(m) (GST_QA_MONITOR_CAST (m)->overrides)
|
||||
|
||||
/* #else TODO Implemen no variadic macros, use inline,
|
||||
* Problem being:
|
||||
|
|
|
@ -85,3 +85,27 @@ gst_qa_override_set_query_handler (GstQaOverride * override,
|
|||
{
|
||||
override->query_handler = handler;
|
||||
}
|
||||
|
||||
void
|
||||
gst_qa_override_event_handler (GstQaOverride * override, GstQaMonitor * monitor,
|
||||
GstEvent * event)
|
||||
{
|
||||
if (override->event_handler)
|
||||
override->event_handler (override, monitor, event);
|
||||
}
|
||||
|
||||
void
|
||||
gst_qa_override_buffer_handler (GstQaOverride * override,
|
||||
GstQaMonitor * monitor, GstBuffer * buffer)
|
||||
{
|
||||
if (override->buffer_handler)
|
||||
override->buffer_handler (override, monitor, buffer);
|
||||
}
|
||||
|
||||
void
|
||||
gst_qa_override_query_handler (GstQaOverride * override, GstQaMonitor * monitor,
|
||||
GstQuery * query)
|
||||
{
|
||||
if (override->query_handler)
|
||||
override->query_handler (override, monitor, query);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,10 @@ void gst_qa_override_free (GstQaOverride * override);
|
|||
void gst_qa_override_change_severity (GstQaOverride * override, GstQaIssueId issue_id, GstQaReportLevel new_level);
|
||||
GstQaReportLevel gst_qa_override_get_severity (GstQaOverride * override, GstQaIssueId issue_id, GstQaReportLevel default_level);
|
||||
|
||||
void gst_qa_override_event_handler (GstQaOverride * override, GstQaMonitor * monitor, GstEvent * event);
|
||||
void gst_qa_override_buffer_handler (GstQaOverride * override, GstQaMonitor * monitor, GstBuffer * buffer);
|
||||
void gst_qa_override_query_handler (GstQaOverride * override, GstQaMonitor * monitor, GstQuery * query);
|
||||
|
||||
void gst_qa_override_set_event_handler (GstQaOverride * override, GstQaOverrideEventHandler handler);
|
||||
void gst_qa_override_set_buffer_handler (GstQaOverride * override, GstQaOverrideBufferHandler handler);
|
||||
void gst_qa_override_set_query_handler (GstQaOverride * override, GstQaOverrideQueryHandler handler);
|
||||
|
|
|
@ -572,6 +572,58 @@ gst_qa_pad_monitor_get_element (GstQaMonitor * monitor)
|
|||
return GST_PAD_PARENT (pad);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_qa_pad_monitor_event_overrides (GstQaPadMonitor * pad_monitor,
|
||||
GstEvent * event)
|
||||
{
|
||||
GList *iter;
|
||||
|
||||
GST_QA_MONITOR_OVERRIDES_LOCK (pad_monitor);
|
||||
for (iter = GST_QA_MONITOR_OVERRIDES (pad_monitor).head; iter;
|
||||
iter = g_list_next (iter)) {
|
||||
GstQaOverride *override = iter->data;
|
||||
|
||||
gst_qa_override_event_handler (override, GST_QA_MONITOR_CAST (pad_monitor),
|
||||
event);
|
||||
}
|
||||
GST_QA_MONITOR_OVERRIDES_UNLOCK (pad_monitor);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_qa_pad_monitor_buffer_overrides (GstQaPadMonitor * pad_monitor,
|
||||
GstBuffer * buffer)
|
||||
{
|
||||
GList *iter;
|
||||
|
||||
GST_QA_MONITOR_OVERRIDES_LOCK (pad_monitor);
|
||||
for (iter = GST_QA_MONITOR_OVERRIDES (pad_monitor).head; iter;
|
||||
iter = g_list_next (iter)) {
|
||||
GstQaOverride *override = iter->data;
|
||||
|
||||
gst_qa_override_buffer_handler (override, GST_QA_MONITOR_CAST (pad_monitor),
|
||||
buffer);
|
||||
}
|
||||
GST_QA_MONITOR_OVERRIDES_UNLOCK (pad_monitor);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_qa_pad_monitor_query_overrides (GstQaPadMonitor * pad_monitor,
|
||||
GstQuery * query)
|
||||
{
|
||||
GList *iter;
|
||||
|
||||
GST_QA_MONITOR_OVERRIDES_LOCK (pad_monitor);
|
||||
for (iter = GST_QA_MONITOR_OVERRIDES (pad_monitor).head; iter;
|
||||
iter = g_list_next (iter)) {
|
||||
GstQaOverride *override = iter->data;
|
||||
|
||||
gst_qa_override_query_handler (override, GST_QA_MONITOR_CAST (pad_monitor),
|
||||
query);
|
||||
}
|
||||
GST_QA_MONITOR_OVERRIDES_UNLOCK (pad_monitor);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gst_qa_pad_monitor_timestamp_is_in_received_range (GstQaPadMonitor * monitor,
|
||||
GstClockTime ts)
|
||||
|
@ -1098,6 +1150,8 @@ gst_qa_pad_monitor_sink_event_check (GstQaPadMonitor * pad_monitor,
|
|||
break;
|
||||
}
|
||||
|
||||
gst_qa_pad_monitor_event_overrides (pad_monitor, event);
|
||||
|
||||
if (handler) {
|
||||
GST_QA_MONITOR_UNLOCK (pad_monitor);
|
||||
GST_QA_PAD_MONITOR_PARENT_UNLOCK (pad_monitor);
|
||||
|
@ -1214,6 +1268,7 @@ gst_qa_pad_monitor_chain_func (GstPad * pad, GstBuffer * buffer)
|
|||
gst_qa_pad_monitor_check_first_buffer (pad_monitor, buffer);
|
||||
gst_qa_pad_monitor_update_buffer_data (pad_monitor, buffer);
|
||||
|
||||
gst_qa_pad_monitor_buffer_overrides (pad_monitor, buffer);
|
||||
GST_QA_MONITOR_UNLOCK (pad_monitor);
|
||||
|
||||
ret = pad_monitor->chain_func (pad, buffer);
|
||||
|
@ -1282,6 +1337,11 @@ gst_qa_pad_monitor_query_func (GstPad * pad, GstQuery * query)
|
|||
GstQaPadMonitor *pad_monitor =
|
||||
g_object_get_data ((GObject *) pad, "qa-monitor");
|
||||
gboolean ret;
|
||||
|
||||
GST_QA_MONITOR_LOCK (pad_monitor);
|
||||
gst_qa_pad_monitor_query_overrides (pad_monitor, query);
|
||||
GST_QA_MONITOR_UNLOCK (pad_monitor);
|
||||
|
||||
ret = pad_monitor->query_func (pad, query);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue