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