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 gstreamer.c.functions;
29 public  import gstreamer.c.types;
30 public  import gstreamerc.gstreamertypes;
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 	public void free()
78 	{
79 		gst_debug_category_free(gstDebugCategory);
80 		ownedRef = false;
81 	}
82 
83 	/**
84 	 * Returns the color of a debug category used when printing output in this
85 	 * category.
86 	 *
87 	 * Returns: the color of the category.
88 	 */
89 	public uint getColor()
90 	{
91 		return gst_debug_category_get_color(gstDebugCategory);
92 	}
93 
94 	/**
95 	 * Returns the description of a debug category.
96 	 *
97 	 * Returns: the description of the category.
98 	 */
99 	public string getDescription()
100 	{
101 		return Str.toString(gst_debug_category_get_description(gstDebugCategory));
102 	}
103 
104 	/**
105 	 * Returns the name of a debug category.
106 	 *
107 	 * Returns: the name of the category.
108 	 */
109 	public string getName()
110 	{
111 		return Str.toString(gst_debug_category_get_name(gstDebugCategory));
112 	}
113 
114 	/**
115 	 * Returns the threshold of a #GstDebugCategory.
116 	 *
117 	 * Returns: the #GstDebugLevel that is used as threshold.
118 	 */
119 	public GstDebugLevel getThreshold()
120 	{
121 		return gst_debug_category_get_threshold(gstDebugCategory);
122 	}
123 
124 	/**
125 	 * Resets the threshold of the category to the default level. Debug information
126 	 * will only be output if the threshold is lower or equal to the level of the
127 	 * debugging message.
128 	 * Use this function to set the threshold back to where it was after using
129 	 * gst_debug_category_set_threshold().
130 	 */
131 	public void resetThreshold()
132 	{
133 		gst_debug_category_reset_threshold(gstDebugCategory);
134 	}
135 
136 	/**
137 	 * Sets the threshold of the category to the given level. Debug information will
138 	 * only be output if the threshold is lower or equal to the level of the
139 	 * debugging message.
140 	 * > Do not use this function in production code, because other functions may
141 	 * > change the threshold of categories as side effect. It is however a nice
142 	 * > function to use when debugging (even from gdb).
143 	 *
144 	 * Params:
145 	 *     level = the #GstDebugLevel threshold to set.
146 	 */
147 	public void setThreshold(GstDebugLevel level)
148 	{
149 		gst_debug_category_set_threshold(gstDebugCategory, level);
150 	}
151 }