element: Enforce that elements created by gst_element_factory_create/make() are floating
[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 GST_API
41 GType gst_tracer_record_get_type          (void);
42
43 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
44 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTracerRecord, gst_object_unref)
45 #endif
46
47 /**
48  * GstTracerValueScope:
49  * @GST_TRACER_VALUE_SCOPE_PROCESS: the value is related to the process
50  * @GST_TRACER_VALUE_SCOPE_THREAD: the value is related to a thread
51  * @GST_TRACER_VALUE_SCOPE_ELEMENT: the value is related to an #GstElement
52  * @GST_TRACER_VALUE_SCOPE_PAD: the value is related to a #GstPad
53  *
54  * Tracing record will contain fields that contain a measured value or extra
55  * meta-data. One such meta data are values that tell where a measurement was
56  * taken. This enumerating declares to which scope such a meta data field
57  * relates to. If it is e.g. %GST_TRACER_VALUE_SCOPE_PAD, then each of the log
58  * events may contain values for different #GstPads.
59  *
60  * Since: 1.8
61  */
62 typedef enum
63 {
64   GST_TRACER_VALUE_SCOPE_PROCESS,
65   GST_TRACER_VALUE_SCOPE_THREAD,
66   GST_TRACER_VALUE_SCOPE_ELEMENT,
67   GST_TRACER_VALUE_SCOPE_PAD
68 } GstTracerValueScope;
69
70 /**
71  * GstTracerValueFlags:
72  * @GST_TRACER_VALUE_FLAGS_NONE: no flags
73  * @GST_TRACER_VALUE_FLAGS_OPTIONAL: the value is optional. When using this flag
74  *   one need to have an additional boolean arg before this value in the
75  *   var-args list passed to  gst_tracer_record_log().
76  * @GST_TRACER_VALUE_FLAGS_AGGREGATED: the value is a combined figure, since the
77  *   start of tracing. Examples are averages or timestamps.
78  *
79  * Flag that describe the value. These flags help applications processing the
80  * logs to understand the values.
81  */
82 typedef enum
83 {
84   GST_TRACER_VALUE_FLAGS_NONE = 0,
85   GST_TRACER_VALUE_FLAGS_OPTIONAL = (1 << 0),
86   GST_TRACER_VALUE_FLAGS_AGGREGATED = (1 << 1),
87 } GstTracerValueFlags;
88
89 #ifdef GST_USE_UNSTABLE_API
90
91 GST_API
92 GstTracerRecord * gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...);
93
94 #ifndef GST_DISABLE_GST_DEBUG
95 GST_API
96 void              gst_tracer_record_log (GstTracerRecord *self, ...);
97 #else
98 #define gst_tracer_record_log(...) G_STMT_START {} G_STMT_END
99 #endif
100
101 #endif
102
103 G_END_DECLS
104
105 #endif /* __GST_TRACER_RECORD_H__ */