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  * Conversion parameters:
26  * inFile  = gstreamer-GstTypeFind.html
27  * outPack = gstreamer
28  * outFile = TypeFind
29  * strct   = GstTypeFind
30  * realStrct=
31  * ctorStrct=
32  * clss    = TypeFind
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_type_find_
41  * 	- gst_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * 	- gst_type_find_peek
46  * omit signals:
47  * imports:
48  * 	- glib.Str
49  * 	- gstreamer.Caps
50  * 	- gstreamer.Plugin
51  * structWrap:
52  * 	- GstCaps* -> Caps
53  * 	- GstPlugin* -> Plugin
54  * 	- GstTypeFind* -> TypeFind
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gstreamer.TypeFind;
61 
62 public  import gstreamerc.gstreamertypes;
63 
64 private import gstreamerc.gstreamer;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 
69 private import glib.Str;
70 private import gstreamer.Caps;
71 private import gstreamer.Plugin;
72 
73 
74 
75 
76 /**
77  * Description
78  * The following functions allow you to detect the media type of an unknown
79  * stream.
80  * Last reviewed on 2005-11-09 (0.9.4)
81  */
82 public class TypeFind
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GstTypeFind* gstTypeFind;
87 	
88 	
89 	public GstTypeFind* getTypeFindStruct()
90 	{
91 		return gstTypeFind;
92 	}
93 	
94 	
95 	/** the main Gtk struct as a void* */
96 	protected void* getStruct()
97 	{
98 		return cast(void*)gstTypeFind;
99 	}
100 	
101 	/**
102 	 * Sets our main struct and passes it to the parent class
103 	 */
104 	public this (GstTypeFind* gstTypeFind)
105 	{
106 		this.gstTypeFind = gstTypeFind;
107 	}
108 	
109 	/**
110 	 * Returns the size bytes of the stream to identify beginning at offset. If
111 	 * offset is a positive number, the offset is relative to the beginning of the
112 	 * stream, if offset is a negative number the offset is relative to the end of
113 	 * the stream. The returned memory is valid until the typefinding function
114 	 * returns and must not be freed.
115 	 * Params:
116 	 * offset = The offset
117 	 * size = The number of bytes to return
118 	 * Returns: the requested data, or NULL if that data is not available.
119 	 */
120 	public ubyte[] peek(long offset, uint size)
121 	{
122 		// guint8* gst_type_find_peek (GstTypeFind *find,  gint64 offset,  guint size);
123 		ubyte* buff = gst_type_find_peek(gstTypeFind, offset, size);
124 		
125 		return buff[0 .. size];
126 	}
127 	
128 	/**
129 	 */
130 	
131 	/**
132 	 * If a GstTypeFindFunction calls this function it suggests the caps with the
133 	 * given probability. A GstTypeFindFunction may supply different suggestions
134 	 * in one call.
135 	 * It is up to the caller of the GstTypeFindFunction to interpret these values.
136 	 * Params:
137 	 * probability = The probability in percent that the suggestion is right
138 	 * caps = The fixed GstCaps to suggest
139 	 */
140 	public void suggest(uint probability, Caps caps)
141 	{
142 		// void gst_type_find_suggest (GstTypeFind *find,  guint probability,  const GstCaps *caps);
143 		gst_type_find_suggest(gstTypeFind, probability, (caps is null) ? null : caps.getCapsStruct());
144 	}
145 	
146 	/**
147 	 * Get the length of the data stream.
148 	 * Returns: The length of the data stream, or 0 if it is not available.
149 	 */
150 	public ulong getLength()
151 	{
152 		// guint64 gst_type_find_get_length (GstTypeFind *find);
153 		return gst_type_find_get_length(gstTypeFind);
154 	}
155 	
156 	/**
157 	 * Registers a new typefind function to be used for typefinding. After
158 	 * registering this function will be available for typefinding.
159 	 * This function is typically called during an element's plugin initialization.
160 	 * Params:
161 	 * plugin = A GstPlugin.
162 	 * name = The name for registering
163 	 * rank = The rank (or importance) of this typefind function
164 	 * func = The GstTypeFindFunction to use
165 	 * extensions = Optional extensions that could belong to this type
166 	 * possibleCaps = Optionally the caps that could be returned when typefinding
167 	 *  succeeds
168 	 * data = Optional user data. This user data must be available until the plugin
169 	 *  is unloaded.
170 	 * dataNotify = a GDestroyNotify that will be called on data when the plugin
171 	 *  is unloaded.
172 	 * Returns: TRUE on success, FALSE otherwise
173 	 */
174 	public static int register(Plugin plugin, string name, uint rank, GstTypeFindFunction func, string[] extensions, Caps possibleCaps, void* data, GDestroyNotify dataNotify)
175 	{
176 		// gboolean gst_type_find_register (GstPlugin *plugin,  const gchar *name,  guint rank,  GstTypeFindFunction func,  gchar **extensions,  const GstCaps *possible_caps,  gpointer data,  GDestroyNotify data_notify);
177 		return gst_type_find_register((plugin is null) ? null : plugin.getPluginStruct(), Str.toStringz(name), rank, func, Str.toStringzArray(extensions), (possibleCaps is null) ? null : possibleCaps.getCapsStruct(), data, dataNotify);
178 	}
179 }