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 gst.mpegts.Descriptor;
26 
27 private import glib.ArrayG;
28 private import glib.MemorySlice;
29 private import glib.PtrArray;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 private import gst.mpegts.CableDeliverySystemDescriptor;
33 private import gst.mpegts.ComponentDescriptor;
34 private import gst.mpegts.Content;
35 private import gst.mpegts.DVBLinkageDescriptor;
36 private import gst.mpegts.DVBParentalRatingItem;
37 private import gst.mpegts.DVBServiceListItem;
38 private import gst.mpegts.DataBroadcastDescriptor;
39 private import gst.mpegts.DvbMultilingualBouquetNameItem;
40 private import gst.mpegts.DvbMultilingualComponentItem;
41 private import gst.mpegts.DvbMultilingualNetworkNameItem;
42 private import gst.mpegts.DvbMultilingualServiceNameItem;
43 private import gst.mpegts.ExtendedEventDescriptor;
44 private import gst.mpegts.ISO639LanguageDescriptor;
45 private import gst.mpegts.LogicalChannelDescriptor;
46 private import gst.mpegts.SatelliteDeliverySystemDescriptor;
47 private import gst.mpegts.T2DeliverySystemDescriptor;
48 private import gst.mpegts.TerrestrialDeliverySystemDescriptor;
49 private import gst.mpegts.c.functions;
50 public  import gst.mpegts.c.types;
51 private import gtkd.Loader;
52 
53 
54 /**
55  * These are the base descriptor types and methods.
56  * 
57  * For more details, refer to the ITU H.222.0 or ISO/IEC 13818-1 specifications
58  * and other specifications mentionned in the documentation.
59  */
60 public class Descriptor
61 {
62 	/** the main Gtk struct */
63 	protected GstMpegtsDescriptor* gstMpegtsDescriptor;
64 	protected bool ownedRef;
65 
66 	/** Get the main Gtk struct */
67 	public GstMpegtsDescriptor* getDescriptorStruct(bool transferOwnership = false)
68 	{
69 		if (transferOwnership)
70 			ownedRef = false;
71 		return gstMpegtsDescriptor;
72 	}
73 
74 	/** the main Gtk struct as a void* */
75 	protected void* getStruct()
76 	{
77 		return cast(void*)gstMpegtsDescriptor;
78 	}
79 
80 	/**
81 	 * Sets our main struct and passes it to the parent class.
82 	 */
83 	public this (GstMpegtsDescriptor* gstMpegtsDescriptor, bool ownedRef = false)
84 	{
85 		this.gstMpegtsDescriptor = gstMpegtsDescriptor;
86 		this.ownedRef = ownedRef;
87 	}
88 
89 	~this ()
90 	{
91 		if ( Linker.isLoaded(LIBRARY_GSTMPEGTS) && ownedRef )
92 			gst_mpegts_descriptor_free(gstMpegtsDescriptor);
93 	}
94 
95 	/**
96 	 * Parses out the stuffing bytes from the @descriptor.
97 	 *
98 	 * Params:
99 	 *     stuffingBytes = the stuffing bytes
100 	 *
101 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
102 	 */
103 	public bool parseDvbStuffing(out ubyte[] stuffingBytes)
104 	{
105 		ubyte* outstuffingBytes = null;
106 
107 		auto p = gst_mpegts_descriptor_parse_dvb_stuffing(gstMpegtsDescriptor, &outstuffingBytes) != 0;
108 
109 		stuffingBytes = outstuffingBytes[0 .. gstMpegtsDescriptor.length];
110 
111 		return p;
112 	}
113 
114 	/**
115 	 */
116 
117 	/** */
118 	public static GType getType()
119 	{
120 		return gst_mpegts_descriptor_get_type();
121 	}
122 
123 	/**
124 	 * Frees @desc
125 	 */
126 	public void free()
127 	{
128 		gst_mpegts_descriptor_free(gstMpegtsDescriptor);
129 		ownedRef = false;
130 	}
131 
132 	/**
133 	 * Extracts the Conditional Access information from @descriptor.
134 	 *
135 	 * Params:
136 	 *     caSystemId = the type of CA system used
137 	 *     caPid = The PID containing ECM or EMM data
138 	 *     privateData = The private data
139 	 *
140 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
141 	 */
142 	public bool parseCa(out ushort caSystemId, out ushort caPid, out ubyte[] privateData)
143 	{
144 		ubyte* outprivateData = null;
145 		size_t privateDataSize;
146 
147 		auto p = gst_mpegts_descriptor_parse_ca(gstMpegtsDescriptor, &caSystemId, &caPid, &outprivateData, &privateDataSize) != 0;
148 
149 		privateData = outprivateData[0 .. privateDataSize];
150 
151 		return p;
152 	}
153 
154 	/**
155 	 * Extracts the cable delivery system information from @descriptor.
156 	 *
157 	 * Params:
158 	 *     res = the #GstMpegtsCableDeliverySystemDescriptor to fill
159 	 *
160 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
161 	 */
162 	public bool parseCableDeliverySystem(out CableDeliverySystemDescriptor res)
163 	{
164 		GstMpegtsCableDeliverySystemDescriptor* outres = sliceNew!GstMpegtsCableDeliverySystemDescriptor();
165 
166 		auto p = gst_mpegts_descriptor_parse_cable_delivery_system(gstMpegtsDescriptor, outres) != 0;
167 
168 		res = ObjectG.getDObject!(CableDeliverySystemDescriptor)(outres, true);
169 
170 		return p;
171 	}
172 
173 	/**
174 	 * Extracts the bouquet name from @descriptor.
175 	 *
176 	 * Params:
177 	 *     bouquetName = the bouquet name
178 	 *
179 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
180 	 */
181 	public bool parseDvbBouquetName(out string bouquetName)
182 	{
183 		char* outbouquetName = null;
184 
185 		auto p = gst_mpegts_descriptor_parse_dvb_bouquet_name(gstMpegtsDescriptor, &outbouquetName) != 0;
186 
187 		bouquetName = Str.toString(outbouquetName);
188 
189 		return p;
190 	}
191 
192 	/**
193 	 * Extracts ca id's from @descriptor.
194 	 *
195 	 * Params:
196 	 *     list = a list of ca identifier.
197 	 *         Edge entry identifies the CA system. Allocations of the value of this field
198 	 *         are found in http://www.dvbservices.com
199 	 *
200 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
201 	 */
202 	public bool parseDvbCaIdentifier(out ArrayG list)
203 	{
204 		GArray* outlist = null;
205 
206 		auto p = gst_mpegts_descriptor_parse_dvb_ca_identifier(gstMpegtsDescriptor, &outlist) != 0;
207 
208 		list = new ArrayG(outlist);
209 
210 		return p;
211 	}
212 
213 	/**
214 	 * Extracts the DVB component information from @descriptor.
215 	 *
216 	 * Params:
217 	 *     res = the #GstMpegtsComponentDescriptor to fill
218 	 *
219 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
220 	 */
221 	public bool parseDvbComponent(out ComponentDescriptor res)
222 	{
223 		GstMpegtsComponentDescriptor* outres = null;
224 
225 		auto p = gst_mpegts_descriptor_parse_dvb_component(gstMpegtsDescriptor, &outres) != 0;
226 
227 		res = ObjectG.getDObject!(ComponentDescriptor)(outres);
228 
229 		return p;
230 	}
231 
232 	/**
233 	 * Extracts the DVB content information from @descriptor.
234 	 *
235 	 * Params:
236 	 *     content = #GstMpegtsContent
237 	 *
238 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
239 	 */
240 	public bool parseDvbContent(out PtrArray content)
241 	{
242 		GPtrArray* outcontent = null;
243 
244 		auto p = gst_mpegts_descriptor_parse_dvb_content(gstMpegtsDescriptor, &outcontent) != 0;
245 
246 		content = new PtrArray(outcontent);
247 
248 		return p;
249 	}
250 
251 	/**
252 	 * Parses out the data broadcast from the @descriptor.
253 	 *
254 	 * Params:
255 	 *     res = #GstMpegtsDataBroadcastDescriptor
256 	 *
257 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
258 	 */
259 	public bool parseDvbDataBroadcast(out DataBroadcastDescriptor res)
260 	{
261 		GstMpegtsDataBroadcastDescriptor* outres = null;
262 
263 		auto p = gst_mpegts_descriptor_parse_dvb_data_broadcast(gstMpegtsDescriptor, &outres) != 0;
264 
265 		res = ObjectG.getDObject!(DataBroadcastDescriptor)(outres);
266 
267 		return p;
268 	}
269 
270 	/**
271 	 * Parses out the data broadcast id from the @descriptor.
272 	 *
273 	 * Params:
274 	 *     dataBroadcastId = the data broadcast id
275 	 *     idSelectorBytes = the selector bytes, if present
276 	 *
277 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
278 	 */
279 	public bool parseDvbDataBroadcastId(out ushort dataBroadcastId, out ubyte[] idSelectorBytes)
280 	{
281 		ubyte* outidSelectorBytes = null;
282 		ubyte len;
283 
284 		auto p = gst_mpegts_descriptor_parse_dvb_data_broadcast_id(gstMpegtsDescriptor, &dataBroadcastId, &outidSelectorBytes, &len) != 0;
285 
286 		idSelectorBytes = outidSelectorBytes[0 .. len];
287 
288 		return p;
289 	}
290 
291 	/**
292 	 * Extracts the DVB extended event information from @descriptor.
293 	 *
294 	 * Params:
295 	 *     res = the #GstMpegtsExtendedEventDescriptor to fill
296 	 *
297 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
298 	 */
299 	public bool parseDvbExtendedEvent(out ExtendedEventDescriptor res)
300 	{
301 		GstMpegtsExtendedEventDescriptor* outres = null;
302 
303 		auto p = gst_mpegts_descriptor_parse_dvb_extended_event(gstMpegtsDescriptor, &outres) != 0;
304 
305 		res = ObjectG.getDObject!(ExtendedEventDescriptor)(outres);
306 
307 		return p;
308 	}
309 
310 	/**
311 	 * Parses out a list of frequencies from the @descriptor.
312 	 *
313 	 * Params:
314 	 *     offset = %FALSE in Hz, %TRUE in kHz
315 	 *     list = a list of all frequencies in Hz/kHz
316 	 *         depending on %offset
317 	 *
318 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
319 	 */
320 	public bool parseDvbFrequencyList(out bool offset, out ArrayG list)
321 	{
322 		int outoffset;
323 		GArray* outlist = null;
324 
325 		auto p = gst_mpegts_descriptor_parse_dvb_frequency_list(gstMpegtsDescriptor, &outoffset, &outlist) != 0;
326 
327 		offset = (outoffset == 1);
328 		list = new ArrayG(outlist);
329 
330 		return p;
331 	}
332 
333 	/**
334 	 * Extracts the DVB linkage information from @descriptor.
335 	 *
336 	 * Params:
337 	 *     res = the #GstMpegtsDVBLinkageDescriptor to fill
338 	 *
339 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
340 	 */
341 	public bool parseDvbLinkage(out DVBLinkageDescriptor res)
342 	{
343 		GstMpegtsDVBLinkageDescriptor* outres = null;
344 
345 		auto p = gst_mpegts_descriptor_parse_dvb_linkage(gstMpegtsDescriptor, &outres) != 0;
346 
347 		res = ObjectG.getDObject!(DVBLinkageDescriptor)(outres);
348 
349 		return p;
350 	}
351 
352 	/**
353 	 * Parses out the multilingual bouquet name from the @descriptor.
354 	 *
355 	 * Params:
356 	 *     bouquetNameItems = a #GstMpegtsDvbMultilingualBouquetNameItem
357 	 *
358 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
359 	 */
360 	public bool parseDvbMultilingualBouquetName(out PtrArray bouquetNameItems)
361 	{
362 		GPtrArray* outbouquetNameItems = null;
363 
364 		auto p = gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name(gstMpegtsDescriptor, &outbouquetNameItems) != 0;
365 
366 		bouquetNameItems = new PtrArray(outbouquetNameItems);
367 
368 		return p;
369 	}
370 
371 	/**
372 	 * Parses out the multilingual component from the @descriptor.
373 	 *
374 	 * Params:
375 	 *     componentTag = the component tag
376 	 *     componentDescriptionItems = a #GstMpegtsDvbMultilingualComponentItem
377 	 *
378 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
379 	 */
380 	public bool parseDvbMultilingualComponent(out ubyte componentTag, out PtrArray componentDescriptionItems)
381 	{
382 		GPtrArray* outcomponentDescriptionItems = null;
383 
384 		auto p = gst_mpegts_descriptor_parse_dvb_multilingual_component(gstMpegtsDescriptor, &componentTag, &outcomponentDescriptionItems) != 0;
385 
386 		componentDescriptionItems = new PtrArray(outcomponentDescriptionItems);
387 
388 		return p;
389 	}
390 
391 	/**
392 	 * Parses out the multilingual network name from the @descriptor.
393 	 *
394 	 * Params:
395 	 *     networkNameItems = a #GstMpegtsDvbMultilingualNetworkNameItem
396 	 *
397 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
398 	 */
399 	public bool parseDvbMultilingualNetworkName(out PtrArray networkNameItems)
400 	{
401 		GPtrArray* outnetworkNameItems = null;
402 
403 		auto p = gst_mpegts_descriptor_parse_dvb_multilingual_network_name(gstMpegtsDescriptor, &outnetworkNameItems) != 0;
404 
405 		networkNameItems = new PtrArray(outnetworkNameItems);
406 
407 		return p;
408 	}
409 
410 	/**
411 	 * Parses out the multilingual service name from the @descriptor.
412 	 *
413 	 * Params:
414 	 *     serviceNameItems = a #GstMpegtsDvbMultilingualServiceNameItem
415 	 *
416 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
417 	 */
418 	public bool parseDvbMultilingualServiceName(out PtrArray serviceNameItems)
419 	{
420 		GPtrArray* outserviceNameItems = null;
421 
422 		auto p = gst_mpegts_descriptor_parse_dvb_multilingual_service_name(gstMpegtsDescriptor, &outserviceNameItems) != 0;
423 
424 		serviceNameItems = new PtrArray(outserviceNameItems);
425 
426 		return p;
427 	}
428 
429 	/**
430 	 * Parses out the dvb network name from the @descriptor:
431 	 *
432 	 * Params:
433 	 *     name = the extracted name
434 	 *
435 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
436 	 */
437 	public bool parseDvbNetworkName(out string name)
438 	{
439 		char* outname = null;
440 
441 		auto p = gst_mpegts_descriptor_parse_dvb_network_name(gstMpegtsDescriptor, &outname) != 0;
442 
443 		name = Str.toString(outname);
444 
445 		return p;
446 	}
447 
448 	/**
449 	 * Extracts the DVB parental rating information from @descriptor.
450 	 *
451 	 * Params:
452 	 *     rating = #GstMpegtsDVBParentalRatingItem
453 	 *
454 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
455 	 */
456 	public bool parseDvbParentalRating(out PtrArray rating)
457 	{
458 		GPtrArray* outrating = null;
459 
460 		auto p = gst_mpegts_descriptor_parse_dvb_parental_rating(gstMpegtsDescriptor, &outrating) != 0;
461 
462 		rating = new PtrArray(outrating);
463 
464 		return p;
465 	}
466 
467 	/**
468 	 * Parses out the private data specifier from the @descriptor.
469 	 *
470 	 * Params:
471 	 *     privateDataSpecifier = the private data specifier id
472 	 *         registered by http://www.dvbservices.com/
473 	 *     privateData = additional data or NULL
474 	 *
475 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
476 	 */
477 	public bool parseDvbPrivateDataSpecifier(out uint privateDataSpecifier, out ubyte[] privateData)
478 	{
479 		ubyte* outprivateData = null;
480 		ubyte length;
481 
482 		auto p = gst_mpegts_descriptor_parse_dvb_private_data_specifier(gstMpegtsDescriptor, &privateDataSpecifier, &outprivateData, &length) != 0;
483 
484 		privateData = outprivateData[0 .. length];
485 
486 		return p;
487 	}
488 
489 	/**
490 	 * Parses out the scrambling mode from the @descriptor.
491 	 *
492 	 * Params:
493 	 *     scramblingMode = This 8-bit field identifies the selected
494 	 *         mode of the scrambling algorithm (#GstMpegtsDVBScramblingModeType).
495 	 *         The technical details of the scrambling algorithm are available only
496 	 *         to bona-fide users upon signature of a Non Disclosure Agreement (NDA)
497 	 *         administered by the DVB Common Scrambling Algorithm Custodian.
498 	 *
499 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
500 	 */
501 	public bool parseDvbScrambling(out GstMpegtsDVBScramblingModeType scramblingMode)
502 	{
503 		return gst_mpegts_descriptor_parse_dvb_scrambling(gstMpegtsDescriptor, &scramblingMode) != 0;
504 	}
505 
506 	/**
507 	 * Extracts the dvb service information from @descriptor.
508 	 *
509 	 * Params:
510 	 *     serviceType = the service type
511 	 *     serviceName = the service name
512 	 *     providerName = the provider name
513 	 *
514 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
515 	 */
516 	public bool parseDvbService(out GstMpegtsDVBServiceType serviceType, out string serviceName, out string providerName)
517 	{
518 		char* outserviceName = null;
519 		char* outproviderName = null;
520 
521 		auto p = gst_mpegts_descriptor_parse_dvb_service(gstMpegtsDescriptor, &serviceType, &outserviceName, &outproviderName) != 0;
522 
523 		serviceName = Str.toString(outserviceName);
524 		providerName = Str.toString(outproviderName);
525 
526 		return p;
527 	}
528 
529 	/**
530 	 * Parses out a list of services from the @descriptor:
531 	 *
532 	 * Params:
533 	 *     list = the list of services
534 	 *
535 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
536 	 */
537 	public bool parseDvbServiceList(out PtrArray list)
538 	{
539 		GPtrArray* outlist = null;
540 
541 		auto p = gst_mpegts_descriptor_parse_dvb_service_list(gstMpegtsDescriptor, &outlist) != 0;
542 
543 		list = new PtrArray(outlist);
544 
545 		return p;
546 	}
547 
548 	/**
549 	 * Extracts the DVB short event information from @descriptor.
550 	 *
551 	 * Params:
552 	 *     languageCode = the language code
553 	 *     eventName = the event name
554 	 *     text = the event text
555 	 *
556 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
557 	 */
558 	public bool parseDvbShortEvent(out string languageCode, out string eventName, out string text)
559 	{
560 		char* outlanguageCode = null;
561 		char* outeventName = null;
562 		char* outtext = null;
563 
564 		auto p = gst_mpegts_descriptor_parse_dvb_short_event(gstMpegtsDescriptor, &outlanguageCode, &outeventName, &outtext) != 0;
565 
566 		languageCode = Str.toString(outlanguageCode);
567 		eventName = Str.toString(outeventName);
568 		text = Str.toString(outtext);
569 
570 		return p;
571 	}
572 
573 	/**
574 	 * Extracts the component tag from @descriptor.
575 	 *
576 	 * Params:
577 	 *     componentTag = the component tag
578 	 *
579 	 * Returns: %TRUE if the parsing happended correctly, else %FALSE.
580 	 */
581 	public bool parseDvbStreamIdentifier(out ubyte componentTag)
582 	{
583 		return gst_mpegts_descriptor_parse_dvb_stream_identifier(gstMpegtsDescriptor, &componentTag) != 0;
584 	}
585 
586 	/**
587 	 * Extracts the DVB subtitling informatio from specific table id in @descriptor.
588 	 *
589 	 * Note: Use #gst_tag_get_language_code if you want to get the the
590 	 * ISO 639-1 language code from the returned ISO 639-2 one.
591 	 *
592 	 * Params:
593 	 *     idx = Table id of the entry to parse
594 	 *     lang = the language code
595 	 *     type = the type of subtitling
596 	 *     compositionPageId = the composition page id
597 	 *     ancillaryPageId = the ancillary page id
598 	 *
599 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
600 	 */
601 	public bool parseDvbSubtitlingIdx(uint idx, out string lang, out ubyte type, out ushort compositionPageId, out ushort ancillaryPageId)
602 	{
603 		char* outlang = null;
604 
605 		auto p = gst_mpegts_descriptor_parse_dvb_subtitling_idx(gstMpegtsDescriptor, idx, &outlang, &type, &compositionPageId, &ancillaryPageId) != 0;
606 
607 		lang = Str.toString(outlang);
608 
609 		return p;
610 	}
611 
612 	/**
613 	 * Returns: The number of entries in @descriptor
614 	 */
615 	public uint parseDvbSubtitlingNb()
616 	{
617 		return gst_mpegts_descriptor_parse_dvb_subtitling_nb(gstMpegtsDescriptor);
618 	}
619 
620 	/**
621 	 * Parses out the DVB-T2 delivery system from the @descriptor.
622 	 *
623 	 * Params:
624 	 *     res = #GstMpegtsT2DeliverySystemDescriptor
625 	 *
626 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
627 	 */
628 	public bool parseDvbT2DeliverySystem(out T2DeliverySystemDescriptor res)
629 	{
630 		GstMpegtsT2DeliverySystemDescriptor* outres = null;
631 
632 		auto p = gst_mpegts_descriptor_parse_dvb_t2_delivery_system(gstMpegtsDescriptor, &outres) != 0;
633 
634 		res = ObjectG.getDObject!(T2DeliverySystemDescriptor)(outres);
635 
636 		return p;
637 	}
638 
639 	/**
640 	 * Parses teletext number @idx in the @descriptor. The language is in ISO639 format.
641 	 *
642 	 * Params:
643 	 *     idx = The id of the teletext to get
644 	 *     languageCode = a null-terminated string
645 	 *     teletextType = #GstMpegtsDVBTeletextType
646 	 *
647 	 * Returns: FALSE on out-of-bounds and errors
648 	 */
649 	public bool parseDvbTeletextIdx(uint idx, out string languageCode, out GstMpegtsDVBTeletextType teletextType, out ubyte magazineNumber, out ubyte pageNumber)
650 	{
651 		char* outlanguageCode = null;
652 
653 		auto p = gst_mpegts_descriptor_parse_dvb_teletext_idx(gstMpegtsDescriptor, idx, &outlanguageCode, &teletextType, &magazineNumber, &pageNumber) != 0;
654 
655 		languageCode = Str.toString(outlanguageCode);
656 
657 		return p;
658 	}
659 
660 	/**
661 	 * Find the number of teletext entries in @descriptor
662 	 *
663 	 * Returns: Number of teletext entries
664 	 */
665 	public uint parseDvbTeletextNb()
666 	{
667 		return gst_mpegts_descriptor_parse_dvb_teletext_nb(gstMpegtsDescriptor);
668 	}
669 
670 	/**
671 	 * Extracts the iso 639-2 language information from @descriptor.
672 	 *
673 	 * Note: Use #gst_tag_get_language_code if you want to get the the
674 	 * ISO 639-1 language code from the returned ISO 639-2 one.
675 	 *
676 	 * Params:
677 	 *     res = the #GstMpegtsISO639LanguageDescriptor to fill
678 	 *
679 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
680 	 */
681 	public bool parseIso639Language(out ISO639LanguageDescriptor res)
682 	{
683 		GstMpegtsISO639LanguageDescriptor* outres = null;
684 
685 		auto p = gst_mpegts_descriptor_parse_iso_639_language(gstMpegtsDescriptor, &outres) != 0;
686 
687 		res = ObjectG.getDObject!(ISO639LanguageDescriptor)(outres);
688 
689 		return p;
690 	}
691 
692 	/**
693 	 * Extracts the iso 639-2 language information from specific table id in @descriptor.
694 	 *
695 	 * Note: Use #gst_tag_get_language_code if you want to get the the
696 	 * ISO 639-1 language code from the returned ISO 639-2 one.
697 	 *
698 	 * Params:
699 	 *     idx = Table id of the language to parse
700 	 *     lang = 4-byte gchar array to hold the language code
701 	 *     audioType = the #GstMpegtsIso639AudioType to set
702 	 *
703 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
704 	 */
705 	public bool parseIso639LanguageIdx(uint idx, out string lang, out GstMpegtsIso639AudioType audioType)
706 	{
707 		char* outlang = null;
708 
709 		auto p = gst_mpegts_descriptor_parse_iso_639_language_idx(gstMpegtsDescriptor, idx, &outlang, &audioType) != 0;
710 
711 		lang = Str.toString(outlang);
712 
713 		return p;
714 	}
715 
716 	/**
717 	 * Returns: The number of languages in @descriptor
718 	 */
719 	public uint parseIso639LanguageNb()
720 	{
721 		return gst_mpegts_descriptor_parse_iso_639_language_nb(gstMpegtsDescriptor);
722 	}
723 
724 	/**
725 	 * Extracts the logical channels from @descriptor.
726 	 *
727 	 * Params:
728 	 *     res = the #GstMpegtsLogicalChannelDescriptor to fill
729 	 *
730 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
731 	 */
732 	public bool parseLogicalChannel(out LogicalChannelDescriptor res)
733 	{
734 		GstMpegtsLogicalChannelDescriptor* outres = sliceNew!GstMpegtsLogicalChannelDescriptor();
735 
736 		auto p = gst_mpegts_descriptor_parse_logical_channel(gstMpegtsDescriptor, outres) != 0;
737 
738 		res = ObjectG.getDObject!(LogicalChannelDescriptor)(outres, true);
739 
740 		return p;
741 	}
742 
743 	/**
744 	 * Extracts the satellite delivery system information from @descriptor.
745 	 *
746 	 * Params:
747 	 *     res = the #GstMpegtsSatelliteDeliverySystemDescriptor to fill
748 	 *
749 	 * Returns: %TRUE if parsing succeeded, else %FALSE.
750 	 */
751 	public bool parseSatelliteDeliverySystem(out SatelliteDeliverySystemDescriptor res)
752 	{
753 		GstMpegtsSatelliteDeliverySystemDescriptor* outres = sliceNew!GstMpegtsSatelliteDeliverySystemDescriptor();
754 
755 		auto p = gst_mpegts_descriptor_parse_satellite_delivery_system(gstMpegtsDescriptor, outres) != 0;
756 
757 		res = ObjectG.getDObject!(SatelliteDeliverySystemDescriptor)(outres, true);
758 
759 		return p;
760 	}
761 
762 	/**
763 	 * Parses out the terrestrial delivery system from the @descriptor.
764 	 *
765 	 * Params:
766 	 *     res = #GstMpegtsTerrestrialDeliverySystemDescriptor
767 	 *
768 	 * Returns: %TRUE if the parsing happened correctly, else %FALSE.
769 	 */
770 	public bool parseTerrestrialDeliverySystem(out TerrestrialDeliverySystemDescriptor res)
771 	{
772 		GstMpegtsTerrestrialDeliverySystemDescriptor* outres = sliceNew!GstMpegtsTerrestrialDeliverySystemDescriptor();
773 
774 		auto p = gst_mpegts_descriptor_parse_terrestrial_delivery_system(gstMpegtsDescriptor, outres) != 0;
775 
776 		res = ObjectG.getDObject!(TerrestrialDeliverySystemDescriptor)(outres, true);
777 
778 		return p;
779 	}
780 
781 	/**
782 	 * Creates a #GstMpegtsDescriptor with custom @tag and @data
783 	 *
784 	 * Params:
785 	 *     tag = descriptor tag
786 	 *     data = descriptor data (after tag and length field)
787 	 *
788 	 * Returns: #GstMpegtsDescriptor
789 	 */
790 	public static Descriptor fromCustom(ubyte tag, ubyte[] data)
791 	{
792 		auto p = gst_mpegts_descriptor_from_custom(tag, data.ptr, cast(size_t)data.length);
793 
794 		if(p is null)
795 		{
796 			return null;
797 		}
798 
799 		return ObjectG.getDObject!(Descriptor)(cast(GstMpegtsDescriptor*) p, true);
800 	}
801 
802 	/**
803 	 * Creates a #GstMpegtsDescriptor with custom @tag, @tag_extension and @data
804 	 *
805 	 * Params:
806 	 *     tag = descriptor tag
807 	 *     tagExtension = descriptor tag extension
808 	 *     data = descriptor data (after tag and length field)
809 	 *
810 	 * Returns: #GstMpegtsDescriptor
811 	 */
812 	public static Descriptor fromCustomWithExtension(ubyte tag, ubyte tagExtension, ubyte[] data)
813 	{
814 		auto p = gst_mpegts_descriptor_from_custom_with_extension(tag, tagExtension, data.ptr, cast(size_t)data.length);
815 
816 		if(p is null)
817 		{
818 			return null;
819 		}
820 
821 		return ObjectG.getDObject!(Descriptor)(cast(GstMpegtsDescriptor*) p, true);
822 	}
823 
824 	/**
825 	 * Creates a #GstMpegtsDescriptor to be a %GST_MTS_DESC_DVB_NETWORK_NAME,
826 	 * with the network name @name. The data field of the #GstMpegtsDescriptor
827 	 * will be allocated, and transferred to the caller.
828 	 *
829 	 * Params:
830 	 *     name = the network name to set
831 	 *
832 	 * Returns: the #GstMpegtsDescriptor or %NULL on fail
833 	 */
834 	public static Descriptor fromDvbNetworkName(string name)
835 	{
836 		auto p = gst_mpegts_descriptor_from_dvb_network_name(Str.toStringz(name));
837 
838 		if(p is null)
839 		{
840 			return null;
841 		}
842 
843 		return ObjectG.getDObject!(Descriptor)(cast(GstMpegtsDescriptor*) p, true);
844 	}
845 
846 	/**
847 	 * Fills a #GstMpegtsDescriptor to be a %GST_MTS_DESC_DVB_SERVICE.
848 	 * The data field of the #GstMpegtsDescriptor will be allocated,
849 	 * and transferred to the caller.
850 	 *
851 	 * Params:
852 	 *     serviceType = Service type defined as a #GstMpegtsDVBServiceType
853 	 *     serviceName = Name of the service
854 	 *     serviceProvider = Name of the service provider
855 	 *
856 	 * Returns: the #GstMpegtsDescriptor or %NULL on fail
857 	 */
858 	public static Descriptor fromDvbService(GstMpegtsDVBServiceType serviceType, string serviceName, string serviceProvider)
859 	{
860 		auto p = gst_mpegts_descriptor_from_dvb_service(serviceType, Str.toStringz(serviceName), Str.toStringz(serviceProvider));
861 
862 		if(p is null)
863 		{
864 			return null;
865 		}
866 
867 		return ObjectG.getDObject!(Descriptor)(cast(GstMpegtsDescriptor*) p, true);
868 	}
869 
870 	/** */
871 	public static Descriptor fromDvbSubtitling(string lang, ubyte type, ushort composition, ushort ancillary)
872 	{
873 		auto p = gst_mpegts_descriptor_from_dvb_subtitling(Str.toStringz(lang), type, composition, ancillary);
874 
875 		if(p is null)
876 		{
877 			return null;
878 		}
879 
880 		return ObjectG.getDObject!(Descriptor)(cast(GstMpegtsDescriptor*) p, true);
881 	}
882 
883 	/**
884 	 * Creates a %GST_MTS_DESC_ISO_639_LANGUAGE #GstMpegtsDescriptor with
885 	 * a single language
886 	 *
887 	 * Params:
888 	 *     language = ISO-639-2 language 3-char code
889 	 *
890 	 * Returns: #GstMpegtsDescriptor, %NULL on failure
891 	 */
892 	public static Descriptor fromIso639Language(string language)
893 	{
894 		auto p = gst_mpegts_descriptor_from_iso_639_language(Str.toStringz(language));
895 
896 		if(p is null)
897 		{
898 			return null;
899 		}
900 
901 		return ObjectG.getDObject!(Descriptor)(cast(GstMpegtsDescriptor*) p, true);
902 	}
903 
904 	/**
905 	 * Creates a %GST_MTS_DESC_REGISTRATION #GstMpegtsDescriptor
906 	 *
907 	 * Params:
908 	 *     formatIdentifier = a 4 character format identifier string
909 	 *     additionalInfo = pointer to optional additional info
910 	 *
911 	 * Returns: #GstMpegtsDescriptor, %NULL on failure
912 	 */
913 	public static Descriptor fromRegistration(string formatIdentifier, ubyte[] additionalInfo)
914 	{
915 		auto p = gst_mpegts_descriptor_from_registration(Str.toStringz(formatIdentifier), additionalInfo.ptr, cast(size_t)additionalInfo.length);
916 
917 		if(p is null)
918 		{
919 			return null;
920 		}
921 
922 		return ObjectG.getDObject!(Descriptor)(cast(GstMpegtsDescriptor*) p, true);
923 	}
924 
925 	/**
926 	 * Finds the first descriptor of type @tag in the array.
927 	 *
928 	 * Note: To look for descriptors that can be present more than once in an
929 	 * array of descriptors, iterate the #GArray manually.
930 	 *
931 	 * Params:
932 	 *     descriptors = an array
933 	 *         of #GstMpegtsDescriptor
934 	 *     tag = the tag to look for
935 	 *
936 	 * Returns: the first descriptor matchin @tag, else %NULL.
937 	 */
938 	public static Descriptor findDescriptor(PtrArray descriptors, ubyte tag)
939 	{
940 		auto p = gst_mpegts_find_descriptor((descriptors is null) ? null : descriptors.getPtrArrayStruct(), tag);
941 
942 		if(p is null)
943 		{
944 			return null;
945 		}
946 
947 		return ObjectG.getDObject!(Descriptor)(cast(GstMpegtsDescriptor*) p);
948 	}
949 
950 	/**
951 	 * Parses the descriptors present in @buffer and returns them as an
952 	 * array.
953 	 *
954 	 * Note: The data provided in @buffer will not be copied.
955 	 *
956 	 * Params:
957 	 *     buffer = descriptors to parse
958 	 *     bufLen = Size of @buffer
959 	 *
960 	 * Returns: an
961 	 *     array of the parsed descriptors or %NULL if there was an error.
962 	 *     Release with #g_array_unref when done with it.
963 	 */
964 	public static PtrArray parseDescriptors(ubyte* buffer, size_t bufLen)
965 	{
966 		auto p = gst_mpegts_parse_descriptors(buffer, bufLen);
967 
968 		if(p is null)
969 		{
970 			return null;
971 		}
972 
973 		return new PtrArray(cast(GPtrArray*) p, true);
974 	}
975 }