1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gstreamer.DebugCategory;
26 
27 private import glib.Str;
28 private import glib.c.functions;
29 private import gstreamer.c.functions;
30 public  import gstreamer.c.types;
31 private import gtkd.Loader;
32 
33 
34 /**
35  * This is the struct that describes the categories. Once initialized with
36  * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
37  */
38 public class DebugCategory
39 {
40 	/** the main Gtk struct */
41 	protected GstDebugCategory* gstDebugCategory;
42 	protected bool ownedRef;
43 
44 	/** Get the main Gtk struct */
45 	public GstDebugCategory* getDebugCategoryStruct(bool transferOwnership = false)
46 	{
47 		if (transferOwnership)
48 			ownedRef = false;
49 		return gstDebugCategory;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected void* getStruct()
54 	{
55 		return cast(void*)gstDebugCategory;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (GstDebugCategory* gstDebugCategory, bool ownedRef = false)
62 	{
63 		this.gstDebugCategory = gstDebugCategory;
64 		this.ownedRef = ownedRef;
65 	}
66 
67 	~this ()
68 	{
69 		if ( Linker.isLoaded(LIBRARY_GSTREAMER) && ownedRef )
70 			gst_debug_category_free(gstDebugCategory);
71 	}
72 
73 
74 	/**
75 	 * Removes and frees the category and all associated resources.
76 	 *
77 	 * Deprecated: This function can easily cause memory corruption, don't use it.
78 	 */
79 	public void free()
80 	{
81 		gst_debug_category_free(gstDebugCategory);
82 		ownedRef = false;
83 	}
84 
85 	/**
86 	 * Returns the color of a debug category used when printing output in this
87 	 * category.
88 	 *
89 	 * Returns: the color of the category.
90 	 */
91 	public uint getColor()
92 	{
93 		return gst_debug_category_get_color(gstDebugCategory);
94 	}
95 
96 	/**
97 	 * Returns the description of a debug category.
98 	 *
99 	 * Returns: the description of the category.
100 	 */
101 	public string getDescription()
102 	{
103 		return Str.toString(gst_debug_category_get_description(gstDebugCategory));
104 	}
105 
106 	/**
107 	 * Returns the name of a debug category.
108 	 *
109 	 * Returns: the name of the category.
110 	 */
111 	public string getName()
112 	{
113 		return Str.toString(gst_debug_category_get_name(gstDebugCategory));
114 	}
115 
116 	/**
117 	 * Returns the threshold of a #GstDebugCategory.
118 	 *
119 	 * Returns: the #GstDebugLevel that is used as threshold.
120 	 */
121 	public GstDebugLevel getThreshold()
122 	{
123 		return gst_debug_category_get_threshold(gstDebugCategory);
124 	}
125 
126 	/**
127 	 * Resets the threshold of the category to the default level. Debug information
128 	 * will only be output if the threshold is lower or equal to the level of the
129 	 * debugging message.
130 	 * Use this function to set the threshold back to where it was after using
131 	 * gst_debug_category_set_threshold().
132 	 */
133 	public void resetThreshold()
134 	{
135 		gst_debug_category_reset_threshold(gstDebugCategory);
136 	}
137 
138 	/**
139 	 * Sets the threshold of the category to the given level. Debug information will
140 	 * only be output if the threshold is lower or equal to the level of the
141 	 * debugging message.
142 	 * > Do not use this function in production code, because other functions may
143 	 * > change the threshold of categories as side effect. It is however a nice
144 	 * > function to use when debugging (even from gdb).
145 	 *
146 	 * Params:
147 	 *     level = the #GstDebugLevel threshold to set.
148 	 */
149 	public void setThreshold(GstDebugLevel level)
150 	{
151 		gst_debug_category_set_threshold(gstDebugCategory, level);
152 	}
153 }