File: Base.d

package info (click to toggle)
gtk-d 3.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 20,152 kB
  • sloc: javascript: 565; sh: 71; makefile: 25
file content (333 lines) | stat: -rw-r--r-- 12,759 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gst.base.Base;

private import glib.Str;
private import gobject.ObjectG;
private import gst.base.c.functions;
public  import gst.base.c.types;
private import gstreamer.Buffer;
private import gstreamer.Caps;
private import gstreamer.ObjectGst;
private import gstreamer.Pad;


/** */
public struct Base
{

	/**
	 * Tries to find what type of data is flowing from the given source #GstPad.
	 *
	 * Free-function: gst_caps_unref
	 *
	 * Params:
	 *     src = A source #GstPad
	 *     size = The length in bytes
	 *
	 * Returns: the #GstCaps corresponding to the data
	 *     stream.  Returns %NULL if no #GstCaps matches the data stream.
	 */
	public static Caps typeFindHelper(Pad src, ulong size)
	{
		auto p = gst_type_find_helper((src is null) ? null : src.getPadStruct(), size);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
	}

	/**
	 * Tries to find what type of data is contained in the given #GstBuffer, the
	 * assumption being that the buffer represents the beginning of the stream or
	 * file.
	 *
	 * All available typefinders will be called on the data in order of rank. If
	 * a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM,
	 * typefinding is stopped immediately and the found caps will be returned
	 * right away. Otherwise, all available typefind functions will the tried,
	 * and the caps with the highest probability will be returned, or %NULL if
	 * the content of the buffer could not be identified.
	 *
	 * Free-function: gst_caps_unref
	 *
	 * Params:
	 *     obj = object doing the typefinding, or %NULL (used for logging)
	 *     buf = a #GstBuffer with data to typefind
	 *     prob = location to store the probability of the found
	 *         caps, or %NULL
	 *
	 * Returns: the #GstCaps corresponding to the data,
	 *     or %NULL if no type could be found. The caller should free the caps
	 *     returned with gst_caps_unref().
	 */
	public static Caps typeFindHelperForBuffer(ObjectGst obj, Buffer buf, out GstTypeFindProbability prob)
	{
		auto p = gst_type_find_helper_for_buffer((obj is null) ? null : obj.getObjectGstStruct(), (buf is null) ? null : buf.getBufferStruct(), &prob);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
	}

	/**
	 * Tries to find what type of data is contained in the given @data, the
	 * assumption being that the data represents the beginning of the stream or
	 * file.
	 *
	 * All available typefinders will be called on the data in order of rank. If
	 * a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM,
	 * typefinding is stopped immediately and the found caps will be returned
	 * right away. Otherwise, all available typefind functions will the tried,
	 * and the caps with the highest probability will be returned, or %NULL if
	 * the content of @data could not be identified.
	 *
	 * Free-function: gst_caps_unref
	 *
	 * Params:
	 *     obj = object doing the typefinding, or %NULL (used for logging)
	 *     data = * a pointer with data to typefind
	 *     prob = location to store the probability of the found
	 *         caps, or %NULL
	 *
	 * Returns: the #GstCaps corresponding to the data,
	 *     or %NULL if no type could be found. The caller should free the caps
	 *     returned with gst_caps_unref().
	 */
	public static Caps typeFindHelperForData(ObjectGst obj, ubyte[] data, out GstTypeFindProbability prob)
	{
		auto p = gst_type_find_helper_for_data((obj is null) ? null : obj.getObjectGstStruct(), data.ptr, cast(size_t)data.length, &prob);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
	}

	/**
	 * Tries to find the best #GstCaps associated with @extension.
	 *
	 * All available typefinders will be checked against the extension in order
	 * of rank. The caps of the first typefinder that can handle @extension will be
	 * returned.
	 *
	 * Free-function: gst_caps_unref
	 *
	 * Params:
	 *     obj = object doing the typefinding, or %NULL (used for logging)
	 *     extension = an extension
	 *
	 * Returns: the #GstCaps corresponding to
	 *     @extension, or %NULL if no type could be found. The caller should free
	 *     the caps returned with gst_caps_unref().
	 */
	public static Caps typeFindHelperForExtension(ObjectGst obj, string extension)
	{
		auto p = gst_type_find_helper_for_extension((obj is null) ? null : obj.getObjectGstStruct(), Str.toStringz(extension));

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
	}

	/**
	 * Utility function to do pull-based typefinding. Unlike gst_type_find_helper()
	 * however, this function will use the specified function @func to obtain the
	 * data needed by the typefind functions, rather than operating on a given
	 * source pad. This is useful mostly for elements like tag demuxers which
	 * strip off data at the beginning and/or end of a file and want to typefind
	 * the stripped data stream before adding their own source pad (the specified
	 * callback can then call the upstream peer pad with offsets adjusted for the
	 * tag size, for example).
	 *
	 * When @extension is not %NULL, this function will first try the typefind
	 * functions for the given extension, which might speed up the typefinding
	 * in many cases.
	 *
	 * Free-function: gst_caps_unref
	 *
	 * Params:
	 *     obj = A #GstObject that will be passed as first argument to @func
	 *     parent = the parent of @obj or %NULL
	 *     func = A generic #GstTypeFindHelperGetRangeFunction that will
	 *         be used to access data at random offsets when doing the typefinding
	 *     size = The length in bytes
	 *     extension = extension of the media, or %NULL
	 *     prob = location to store the probability of the found
	 *         caps, or %NULL
	 *
	 * Returns: the #GstCaps corresponding to the data
	 *     stream.  Returns %NULL if no #GstCaps matches the data stream.
	 */
	public static Caps typeFindHelperGetRange(ObjectGst obj, ObjectGst parent, GstTypeFindHelperGetRangeFunction func, ulong size, string extension, out GstTypeFindProbability prob)
	{
		auto p = gst_type_find_helper_get_range((obj is null) ? null : obj.getObjectGstStruct(), (parent is null) ? null : parent.getObjectGstStruct(), func, size, Str.toStringz(extension), &prob);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
	}

	/**
	 * Tries to find what type of data is contained in the given #GstBuffer, the
	 * assumption being that the buffer represents the beginning of the stream or
	 * file.
	 *
	 * All available typefinders will be called on the data in order of rank. If
	 * a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM,
	 * typefinding is stopped immediately and the found caps will be returned
	 * right away. Otherwise, all available typefind functions will the tried,
	 * and the caps with the highest probability will be returned, or %NULL if
	 * the content of the buffer could not be identified.
	 *
	 * When @extension is not %NULL, this function will first try the typefind
	 * functions for the given extension, which might speed up the typefinding
	 * in many cases.
	 *
	 * Free-function: gst_caps_unref
	 *
	 * Params:
	 *     obj = object doing the typefinding, or %NULL (used for logging)
	 *     buf = a #GstBuffer with data to typefind
	 *     extension = extension of the media, or %NULL
	 *     prob = location to store the probability of the found
	 *         caps, or %NULL
	 *
	 * Returns: the #GstCaps corresponding to the data,
	 *     or %NULL if no type could be found. The caller should free the caps
	 *     returned with gst_caps_unref().
	 *
	 * Since: 1.16
	 */
	public static Caps typeFindHelperForBufferWithExtension(ObjectGst obj, Buffer buf, string extension, out GstTypeFindProbability prob)
	{
		auto p = gst_type_find_helper_for_buffer_with_extension((obj is null) ? null : obj.getObjectGstStruct(), (buf is null) ? null : buf.getBufferStruct(), Str.toStringz(extension), &prob);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
	}

	/**
	 * Tries to find what type of data is contained in the given @data, the
	 * assumption being that the data represents the beginning of the stream or
	 * file.
	 *
	 * All available typefinders will be called on the data in order of rank. If
	 * a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM,
	 * typefinding is stopped immediately and the found caps will be returned
	 * right away. Otherwise, all available typefind functions will the tried,
	 * and the caps with the highest probability will be returned, or %NULL if
	 * the content of @data could not be identified.
	 *
	 * When @extension is not %NULL, this function will first try the typefind
	 * functions for the given extension, which might speed up the typefinding
	 * in many cases.
	 *
	 * Free-function: gst_caps_unref
	 *
	 * Params:
	 *     obj = object doing the typefinding, or %NULL (used for logging)
	 *     data = * a pointer with data to typefind
	 *     extension = extension of the media, or %NULL
	 *     prob = location to store the probability of the found
	 *         caps, or %NULL
	 *
	 * Returns: the #GstCaps corresponding to the data,
	 *     or %NULL if no type could be found. The caller should free the caps
	 *     returned with gst_caps_unref().
	 *
	 * Since: 1.16
	 */
	public static Caps typeFindHelperForDataWithExtension(ObjectGst obj, ubyte[] data, string extension, out GstTypeFindProbability prob)
	{
		auto p = gst_type_find_helper_for_data_with_extension((obj is null) ? null : obj.getObjectGstStruct(), data.ptr, cast(size_t)data.length, Str.toStringz(extension), &prob);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
	}

	/**
	 * Utility function to do pull-based typefinding. Unlike gst_type_find_helper()
	 * however, this function will use the specified function @func to obtain the
	 * data needed by the typefind functions, rather than operating on a given
	 * source pad. This is useful mostly for elements like tag demuxers which
	 * strip off data at the beginning and/or end of a file and want to typefind
	 * the stripped data stream before adding their own source pad (the specified
	 * callback can then call the upstream peer pad with offsets adjusted for the
	 * tag size, for example).
	 *
	 * When @extension is not %NULL, this function will first try the typefind
	 * functions for the given extension, which might speed up the typefinding
	 * in many cases.
	 *
	 * Params:
	 *     obj = A #GstObject that will be passed as first argument to @func
	 *     parent = the parent of @obj or %NULL
	 *     func = A generic #GstTypeFindHelperGetRangeFunction that will
	 *         be used to access data at random offsets when doing the typefinding
	 *     size = The length in bytes
	 *     extension = extension of the media, or %NULL
	 *     caps = returned caps
	 *     prob = location to store the probability of the found
	 *         caps, or %NULL
	 *
	 * Returns: the last %GstFlowReturn from pulling a buffer or %GST_FLOW_OK if
	 *     typefinding was successful.
	 *
	 * Since: 1.14.3
	 */
	public static GstFlowReturn typeFindHelperGetRangeFull(ObjectGst obj, ObjectGst parent, GstTypeFindHelperGetRangeFunction func, ulong size, string extension, out Caps caps, out GstTypeFindProbability prob)
	{
		GstCaps* outcaps = null;

		auto p = gst_type_find_helper_get_range_full((obj is null) ? null : obj.getObjectGstStruct(), (parent is null) ? null : parent.getObjectGstStruct(), func, size, Str.toStringz(extension), &outcaps, &prob);

		caps = ObjectG.getDObject!(Caps)(outcaps);

		return p;
	}
}