mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +00:00
tracer: add the hook-id to the invoke signature
Tracers that subscribe to multiple hooks can know what hook was used.
This commit is contained in:
parent
6e9f018dc4
commit
68b1473846
4 changed files with 10 additions and 10 deletions
|
@ -95,18 +95,18 @@ Plugin api
|
|||
|
||||
TracerPlugins are plugin features. They have a simple api:
|
||||
|
||||
GstTracerHookMask init(gchar *params);
|
||||
'instance creation'
|
||||
Plugins can attach handlers to one or more hooks. They use a HookMask to tell
|
||||
which events they are interested in. The params are the extra detail from the
|
||||
environment var.
|
||||
|
||||
void invoke(GstStructure *s);
|
||||
void invoke(GstTracerHookId id, GstStructure *s);
|
||||
Hooks marshall the parameters given to a trace hook into a GstStructure and also
|
||||
add some extra into such as a timestamp. The hooks will receive this structure.
|
||||
Hooks will be called from misc threads. The trace plugins should only consume
|
||||
(=read) the provided data. Most trace plugins will log data to a trace channel.
|
||||
|
||||
void done(void);
|
||||
'instance destruction'
|
||||
Plugins can output results and release data. This would ideally be done at the
|
||||
end of the applications, but gst_deinit() is not mandatory. gst_tracelib was
|
||||
using a gcc_destructor
|
||||
|
|
|
@ -123,13 +123,13 @@ gst_tracer_get_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_tracer_invoke (GstTracer * self, GstStructure * s)
|
||||
gst_tracer_invoke (GstTracer * self, GstTracerHookId id, GstStructure * s)
|
||||
{
|
||||
GstTracerClass *klass = GST_TRACER_GET_CLASS (self);
|
||||
|
||||
g_return_if_fail (klass->invoke);
|
||||
|
||||
klass->invoke (s);
|
||||
klass->invoke (id, s);
|
||||
}
|
||||
|
||||
/* tracing modules */
|
||||
|
@ -287,7 +287,7 @@ dispatch (GstTracerHookId id, GstStructure * s)
|
|||
{
|
||||
GList *node;
|
||||
for (node = tracers[id]; node; node = g_list_next (node)) {
|
||||
gst_tracer_invoke (node->data, s);
|
||||
gst_tracer_invoke (node->data, id, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ struct _GstTracer {
|
|||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
typedef void (*GstTracerInvokeFunction) (GstStructure *s);
|
||||
typedef void (*GstTracerInvokeFunction) (GstTracerHookId id, GstStructure *s);
|
||||
|
||||
struct _GstTracerClass {
|
||||
GstObjectClass parent_class;
|
||||
|
|
|
@ -34,7 +34,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_log_debug);
|
|||
G_DEFINE_TYPE_WITH_CODE (GstLogTracer, gst_log_tracer, GST_TYPE_TRACER,
|
||||
_do_init);
|
||||
|
||||
static void gst_log_tracer_invoke (GstStructure * s);
|
||||
static void gst_log_tracer_invoke (GstTracerHookId id, GstStructure * s);
|
||||
|
||||
static void
|
||||
gst_log_tracer_class_init (GstLogTracerClass * klass)
|
||||
|
@ -51,10 +51,10 @@ gst_log_tracer_init (GstLogTracer * self)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_log_tracer_invoke (GstStructure * s)
|
||||
gst_log_tracer_invoke (GstTracerHookId id, GstStructure * s)
|
||||
{
|
||||
gchar *str = gst_structure_to_string (s);
|
||||
/* TODO(ensonic): log to different categories depending on GstHookId */
|
||||
/* TODO(ensonic): log to different categories depending on 'id' */
|
||||
GST_TRACE ("%s", str);
|
||||
g_free (str);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue