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 gstreamerc.gstreamer;
29 public  import gstreamerc.gstreamertypes;
30 private import gtkd.Loader;
31 
32 
33 /**
34  * This is the struct that describes the categories. Once initialized with
35  * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
36  */
37 public class DebugCategory
38 {
39 	/** the main Gtk struct */
40 	protected GstDebugCategory* gstDebugCategory;
41 	protected bool ownedRef;
42 
43 	/** Get the main Gtk struct */
44 	public GstDebugCategory* getDebugCategoryStruct(bool transferOwnership = false)
45 	{
46 		if (transferOwnership)
47 			ownedRef = false;
48 		return gstDebugCategory;
49 	}
50 
51 	/** the main Gtk struct as a void* */
52 	protected void* getStruct()
53 	{
54 		return cast(void*)gstDebugCategory;
55 	}
56 
57 	/**
58 	 * Sets our main struct and passes it to the parent class.
59 	 */
60 	public this (GstDebugCategory* gstDebugCategory, bool ownedRef = false)
61 	{
62 		this.gstDebugCategory = gstDebugCategory;
63 		this.ownedRef = ownedRef;
64 	}
65 
66 	~this ()
67 	{
68 		if (  Linker.isLoaded(LIBRARY_GSTREAMER) && ownedRef )
69 			gst_debug_category_free(gstDebugCategory);
70 	}
71 
72 
73 	/**
74 	 * Removes and frees the category and all associated resources.
75 	 */
76 	public void free()
77 	{
78 		gst_debug_category_free(gstDebugCategory);
79 		ownedRef = false;
80 	}
81 
82 	/**
83 	 * Returns the color of a debug category used when printing output in this
84 	 * category.
85 	 *
86 	 * Returns: the color of the category.
87 	 */
88 	public uint getColor()
89 	{
90 		return gst_debug_category_get_color(gstDebugCategory);
91 	}
92 
93 	/**
94 	 * Returns the description of a debug category.
95 	 *
96 	 * Returns: the description of the category.
97 	 */
98 	public string getDescription()
99 	{
100 		return Str.toString(gst_debug_category_get_description(gstDebugCategory));
101 	}
102 
103 	/**
104 	 * Returns the name of a debug category.
105 	 *
106 	 * Returns: the name of the category.
107 	 */
108 	public string getName()
109 	{
110 		return Str.toString(gst_debug_category_get_name(gstDebugCategory));
111 	}
112 
113 	/**
114 	 * Returns the threshold of a #GstDebugCategory.
115 	 *
116 	 * Returns: the #GstDebugLevel that is used as threshold.
117 	 */
118 	public GstDebugLevel getThreshold()
119 	{
120 		return gst_debug_category_get_threshold(gstDebugCategory);
121 	}
122 
123 	/**
124 	 * Resets the threshold of the category to the default level. Debug information
125 	 * will only be output if the threshold is lower or equal to the level of the
126 	 * debugging message.
127 	 * Use this function to set the threshold back to where it was after using
128 	 * gst_debug_category_set_threshold().
129 	 */
130 	public void resetThreshold()
131 	{
132 		gst_debug_category_reset_threshold(gstDebugCategory);
133 	}
134 
135 	/**
136 	 * Sets the threshold of the category to the given level. Debug information will
137 	 * only be output if the threshold is lower or equal to the level of the
138 	 * debugging message.
139 	 * > Do not use this function in production code, because other functions may
140 	 * > change the threshold of categories as side effect. It is however a nice
141 	 * > function to use when debugging (even from gdb).
142 	 *
143 	 * Params:
144 	 *     level = the #GstDebugLevel threshold to set.
145 	 */
146 	public void setThreshold(GstDebugLevel level)
147 	{
148 		gst_debug_category_set_threshold(gstDebugCategory, level);
149 	}
150 }