File: Section.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 (610 lines) | stat: -rw-r--r-- 14,450 bytes parent folder | download | duplicates (4)
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
/*
 * 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.mpegts.Section;

private import glib.Bytes;
private import glib.ConstructionException;
private import glib.PtrArray;
private import gobject.ObjectG;
private import gst.mpegts.AtscEIT;
private import gst.mpegts.AtscETT;
private import gst.mpegts.AtscMGT;
private import gst.mpegts.AtscSTT;
private import gst.mpegts.AtscVCT;
private import gst.mpegts.BAT;
private import gst.mpegts.EIT;
private import gst.mpegts.NIT;
private import gst.mpegts.PMT;
private import gst.mpegts.PatProgram;
private import gst.mpegts.SDT;
private import gst.mpegts.TOT;
private import gst.mpegts.c.functions;
public  import gst.mpegts.c.types;
private import gstreamer.DateTime;
private import gstreamer.Element;
private import gstreamer.Event;
private import gstreamer.Message;
private import gstreamer.ObjectGst;


/**
 * For more details, refer to the ITU H.222.0 or ISO/IEC 13818-1 specifications
 * and other specifications mentioned in the documentation.
 */
public class Section
{
	/** the main Gtk struct */
	protected GstMpegtsSection* gstMpegtsSection;
	protected bool ownedRef;

	/** Get the main Gtk struct */
	public GstMpegtsSection* getSectionStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gstMpegtsSection;
	}

	/** the main Gtk struct as a void* */
	protected void* getStruct()
	{
		return cast(void*)gstMpegtsSection;
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GstMpegtsSection* gstMpegtsSection, bool ownedRef = false)
	{
		this.gstMpegtsSection = gstMpegtsSection;
		this.ownedRef = ownedRef;
	}


	/** */
	public static GType getType()
	{
		return gst_mpegts_section_get_type();
	}

	/**
	 * Creates a new #GstMpegtsSection from the provided @data.
	 *
	 * Note: Ensuring @data is big enough to contain the full section is the
	 * responsibility of the caller. If it is not big enough, %NULL will be
	 * returned.
	 *
	 * Note: it is the responsibility of the caller to ensure @data does point
	 * to the beginning of the section.
	 *
	 * Params:
	 *     pid = the PID to which this section belongs
	 *     data = a pointer to the beginning of the section (i.e. the first byte
	 *         should contain the table_id field).
	 *
	 * Returns: A new #GstMpegtsSection if the data was valid,
	 *     else %NULL
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(ushort pid, ubyte[] data)
	{
		auto p = gst_mpegts_section_new(pid, data.ptr, cast(size_t)data.length);

		if(p is null)
		{
			throw new ConstructionException("null returned by new");
		}

		this(cast(GstMpegtsSection*) p);
	}

	/**
	 * Returns the #GstMpegtsAtscVCT contained in the @section
	 *
	 * Returns: The #GstMpegtsAtscVCT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public AtscVCT getAtscCvct()
	{
		auto p = gst_mpegts_section_get_atsc_cvct(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(AtscVCT)(cast(GstMpegtsAtscVCT*) p);
	}

	/**
	 * Returns the #GstMpegtsAtscEIT contained in the @section.
	 *
	 * Returns: The #GstMpegtsAtscEIT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public AtscEIT getAtscEit()
	{
		auto p = gst_mpegts_section_get_atsc_eit(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(AtscEIT)(cast(GstMpegtsAtscEIT*) p);
	}

	/**
	 * Returns the #GstMpegtsAtscETT contained in the @section.
	 *
	 * Returns: The #GstMpegtsAtscETT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public AtscETT getAtscEtt()
	{
		auto p = gst_mpegts_section_get_atsc_ett(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(AtscETT)(cast(GstMpegtsAtscETT*) p);
	}

	/**
	 * Returns the #GstMpegtsAtscMGT contained in the @section.
	 *
	 * Returns: The #GstMpegtsAtscMGT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public AtscMGT getAtscMgt()
	{
		auto p = gst_mpegts_section_get_atsc_mgt(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(AtscMGT)(cast(GstMpegtsAtscMGT*) p);
	}

	/**
	 * Returns the #GstMpegtsAtscSTT contained in the @section.
	 *
	 * Returns: The #GstMpegtsAtscSTT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public AtscSTT getAtscStt()
	{
		auto p = gst_mpegts_section_get_atsc_stt(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(AtscSTT)(cast(GstMpegtsAtscSTT*) p);
	}

	/**
	 * Returns the #GstMpegtsAtscVCT contained in the @section
	 *
	 * Returns: The #GstMpegtsAtscVCT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public AtscVCT getAtscTvct()
	{
		auto p = gst_mpegts_section_get_atsc_tvct(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(AtscVCT)(cast(GstMpegtsAtscVCT*) p);
	}

	/**
	 * Returns the #GstMpegtsBAT contained in the @section.
	 *
	 * Returns: The #GstMpegtsBAT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public BAT getBat()
	{
		auto p = gst_mpegts_section_get_bat(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(BAT)(cast(GstMpegtsBAT*) p);
	}

	/**
	 * Returns the array of #GstMpegtsDescriptor contained in the Conditional
	 * Access Table.
	 *
	 * Returns: The
	 *     #GstMpegtsDescriptor contained in the section, or %NULL if an error
	 *     happened. Release with #g_array_unref when done.
	 */
	public PtrArray getCat()
	{
		auto p = gst_mpegts_section_get_cat(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return new PtrArray(cast(GPtrArray*) p);
	}

	/**
	 * Gets the original unparsed section data.
	 *
	 * Returns: The original unparsed section data.
	 */
	public Bytes getData()
	{
		auto p = gst_mpegts_section_get_data(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return new Bytes(cast(GBytes*) p, true);
	}

	/**
	 * Returns the #GstMpegtsEIT contained in the @section.
	 *
	 * Returns: The #GstMpegtsEIT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public EIT getEit()
	{
		auto p = gst_mpegts_section_get_eit(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(EIT)(cast(GstMpegtsEIT*) p);
	}

	/**
	 * Returns the #GstMpegtsNIT contained in the @section.
	 *
	 * Returns: The #GstMpegtsNIT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public NIT getNit()
	{
		auto p = gst_mpegts_section_get_nit(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(NIT)(cast(GstMpegtsNIT*) p);
	}

	/**
	 * Parses a Program Association Table (ITU H.222.0, ISO/IEC 13818-1).
	 *
	 * Returns the array of #GstMpegtsPatProgram contained in the section.
	 *
	 * Note: The PAT "transport_id" field corresponds to the "subtable_extension"
	 * field of the provided @section.
	 *
	 * Returns: The
	 *     #GstMpegtsPatProgram contained in the section, or %NULL if an error
	 *     happened. Release with #g_ptr_array_unref when done.
	 */
	public PtrArray getPat()
	{
		auto p = gst_mpegts_section_get_pat(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return new PtrArray(cast(GPtrArray*) p);
	}

	/**
	 * Returns the #GstMpegtsPMT contained in the @section.
	 *
	 * Returns: The #GstMpegtsPMT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public PMT getPmt()
	{
		auto p = gst_mpegts_section_get_pmt(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(PMT)(cast(GstMpegtsPMT*) p);
	}

	/**
	 * Returns the #GstMpegtsSDT contained in the @section.
	 *
	 * Returns: The #GstMpegtsSDT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public SDT getSdt()
	{
		auto p = gst_mpegts_section_get_sdt(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(SDT)(cast(GstMpegtsSDT*) p);
	}

	/**
	 * Returns the #GstDateTime of the TDT
	 *
	 * Returns: The #GstDateTime contained in the section, or %NULL
	 *     if an error happened. Release with #gst_date_time_unref when done.
	 */
	public DateTime getTdt()
	{
		auto p = gst_mpegts_section_get_tdt(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(DateTime)(cast(GstDateTime*) p, true);
	}

	/**
	 * Returns the #GstMpegtsTOT contained in the @section.
	 *
	 * Returns: The #GstMpegtsTOT contained in the section, or %NULL if an error
	 *     happened.
	 */
	public TOT getTot()
	{
		auto p = gst_mpegts_section_get_tot(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(TOT)(cast(GstMpegtsTOT*) p);
	}

	/**
	 * Returns the array of #GstMpegtsDescriptor contained in the section
	 *
	 * Returns: The
	 *     #GstMpegtsDescriptor contained in the section, or %NULL if an error
	 *     happened. Release with #g_array_unref when done.
	 */
	public PtrArray getTsdt()
	{
		auto p = gst_mpegts_section_get_tsdt(gstMpegtsSection);

		if(p is null)
		{
			return null;
		}

		return new PtrArray(cast(GPtrArray*) p);
	}

	/**
	 * If the data in @section has already been packetized, the data pointer is returned
	 * immediately. Otherwise, the data field is allocated and populated.
	 *
	 * Returns: pointer to section data, or %NULL on fail
	 */
	public ubyte[] packetize()
	{
		size_t outputSize;

		auto p = gst_mpegts_section_packetize(gstMpegtsSection, &outputSize);

		return p[0 .. outputSize];
	}

	/**
	 * Creates a custom #GstEvent with a @GstMpegtsSection.
	 * The #GstEvent is sent to the @element #GstElement.
	 *
	 * Params:
	 *     element = The #GstElement to send to section event to
	 *
	 * Returns: %TRUE if the event is sent
	 */
	public bool sendEvent(Element element)
	{
		return gst_mpegts_section_send_event(gstMpegtsSection, (element is null) ? null : element.getElementStruct()) != 0;
	}

	/**
	 * Ownership of @nit is taken. The data in @nit is managed by the #GstMpegtsSection
	 *
	 * Params:
	 *     nit = a #GstMpegtsNIT to create the #GstMpegtsSection from
	 *
	 * Returns: the #GstMpegtsSection
	 */
	public static Section fromNit(NIT nit)
	{
		auto p = gst_mpegts_section_from_nit((nit is null) ? null : nit.getNITStruct());

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true);
	}

	/**
	 * Creates a PAT #GstMpegtsSection from the @programs array of #GstMpegtsPatPrograms
	 *
	 * Params:
	 *     programs = an array of #GstMpegtsPatProgram
	 *     tsId = Transport stream ID of the PAT
	 *
	 * Returns: a #GstMpegtsSection
	 */
	public static Section fromPat(PtrArray programs, ushort tsId)
	{
		auto p = gst_mpegts_section_from_pat((programs is null) ? null : programs.getPtrArrayStruct(), tsId);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true);
	}

	/**
	 * Creates a #GstMpegtsSection from @pmt that is bound to @pid
	 *
	 * Params:
	 *     pmt = a #GstMpegtsPMT to create a #GstMpegtsSection from
	 *     pid = The PID that the #GstMpegtsPMT belongs to
	 *
	 * Returns: #GstMpegtsSection
	 */
	public static Section fromPmt(PMT pmt, ushort pid)
	{
		auto p = gst_mpegts_section_from_pmt((pmt is null) ? null : pmt.getPMTStruct(), pid);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true);
	}

	/**
	 * Ownership of @sdt is taken. The data in @sdt is managed by the #GstMpegtsSection
	 *
	 * Params:
	 *     sdt = a #GstMpegtsSDT to create the #GstMpegtsSection from
	 *
	 * Returns: the #GstMpegtsSection
	 */
	public static Section fromSdt(SDT sdt)
	{
		auto p = gst_mpegts_section_from_sdt((sdt is null) ? null : sdt.getSDTStruct());

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true);
	}

	/**
	 * Extracts the #GstMpegtsSection contained in the @event #GstEvent
	 *
	 * Params:
	 *     event = #GstEvent containing a #GstMpegtsSection
	 *
	 * Returns: The extracted #GstMpegtsSection
	 */
	public static Section eventParseMpegtsSection(Event event)
	{
		auto p = gst_event_parse_mpegts_section((event is null) ? null : event.getEventStruct());

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true);
	}

	/**
	 * Creates a new #GstMessage for a @GstMpegtsSection.
	 *
	 * Params:
	 *     parent = The creator of the message
	 *     section = The #GstMpegtsSection to put in a message
	 *
	 * Returns: The new #GstMessage to be posted, or %NULL if the
	 *     section is not valid.
	 */
	public static Message messageNewMpegtsSection(ObjectGst parent, Section section)
	{
		auto p = gst_message_new_mpegts_section((parent is null) ? null : parent.getObjectGstStruct(), (section is null) ? null : section.getSectionStruct());

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Message)(cast(GstMessage*) p, true);
	}

	/**
	 * Returns the #GstMpegtsSection contained in a message.
	 *
	 * Params:
	 *     message = a #GstMessage
	 *
	 * Returns: the contained #GstMpegtsSection, or %NULL.
	 */
	public static Section messageParseMpegtsSection(Message message)
	{
		auto p = gst_message_parse_mpegts_section((message is null) ? null : message.getMessageStruct());

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Section)(cast(GstMpegtsSection*) p, true);
	}
}