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