utils: fix element leak in find_common_root()
[platform/upstream/gstreamer.git] / gst / gsttracerrecord.h
1 /* GStreamer
2  * Copyright (C) 2016 Stefan Sauer <ensonic@users.sf.net>
3  *
4  * gsttracerrecord.h: tracer log record class
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 #ifndef __GST_TRACER_RECORD_H__
23 #define __GST_TRACER_RECORD_H__
24
25 #include <gst/gstobject.h>
26
27 G_BEGIN_DECLS
28
29 typedef struct _GstTracerRecord GstTracerRecord;
30 typedef struct _GstTracerRecordClass GstTracerRecordClass;
31
32 #define GST_TYPE_TRACER_RECORD            (gst_tracer_record_get_type())
33 #define GST_TRACER_RECORD(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TRACER_RECORD,GstTracerRecord))
34 #define GST_TRACER_RECORD_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TRACER_RECORD,GstTracerRecordClass))
35 #define GST_IS_TRACER_RECORD(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TRACER_RECORD))
36 #define GST_IS_TRACER_RECORD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TRACER_RECORD))
37 #define GST_TRACER_RECORD_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_TRACER_RECORD,GstTracerRecordClass))
38 #define GST_TRACER_RECORD_CAST(obj)       ((GstTracerRecord *)(obj))
39
40 GType gst_tracer_record_get_type          (void);
41
42 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
43 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTracerRecord, gst_object_unref)
44 #endif
45
46 /**
47  * GstTracerValueScope:
48  * @GST_TRACER_VALUE_SCOPE_PROCESS: the value is related to the process
49  * @GST_TRACER_VALUE_SCOPE_THREAD: the value is related to a thread
50  * @GST_TRACER_VALUE_SCOPE_ELEMENT: the value is related to an #GstElement
51  * @GST_TRACER_VALUE_SCOPE_PAD: the value is related to a #GstPad
52  *
53  * Tracing record will contain fields that contain a meassured value or extra
54  * meta-data. One such meta data are values that tell where a measurement was
55  * taken. This enumerating declares to which scope such a meta data field
56  * relates to. If it is e.g. %GST_TRACER_VALUE_SCOPE_PAD, then each of the log
57  * events may contain values for different #GstPads.
58  *
59  * Since: 1.8
60  */
61 typedef enum
62 {
63   GST_TRACER_VALUE_SCOPE_PROCESS,
64   GST_TRACER_VALUE_SCOPE_THREAD,
65   GST_TRACER_VALUE_SCOPE_ELEMENT,
66   GST_TRACER_VALUE_SCOPE_PAD
67 } GstTracerValueScope;
68
69 /**
70  * GstTracerValueFlags:
71  * @GST_TRACER_VALUE_FLAGS_NONE: no flags
72  * @GST_TRACER_VALUE_FLAGS_OPTIONAL: the value is optional. When using this flag
73  *   one need to have an additional boolean arg before this value in the
74  *   var-args list passed to  gst_tracer_record_log().
75  * @GST_TRACER_VALUE_FLAGS_AGGREGATED: the value is combined since the start of
76  *   tracing
77  *
78  * Flag that describe the value. These flags help applications processing the
79  * logs to understand the values.
80  */
81 typedef enum
82 {
83   GST_TRACER_VALUE_FLAGS_NONE = 0,
84   GST_TRACER_VALUE_FLAGS_OPTIONAL = (1 << 0),
85   GST_TRACER_VALUE_FLAGS_AGGREGATED = (1 << 1),
86 } GstTracerValueFlags;
87
88 #ifdef GST_USE_UNSTABLE_API
89
90 GstTracerRecord * gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...);
91
92 #ifndef GST_DISABLE_GST_DEBUG
93 void              gst_tracer_record_log (GstTracerRecord *self, ...);
94 #else
95 #define gst_tracer_record_log(...) G_STMT_START {} G_STMT_END
96 #endif
97
98 #endif
99
100 G_END_DECLS
101
102 #endif /* __GST_TRACER_RECORD_H__ */